Spaces:
Sleeping
Sleeping
Update preprocessing.py
Browse files- preprocessing.py +8 -0
preprocessing.py
CHANGED
|
@@ -15,3 +15,11 @@ def normalize_image(img):
|
|
| 15 |
|
| 16 |
def to_3channel(img):
|
| 17 |
return np.stack([img, img, img], axis=-1)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 15 |
|
| 16 |
def to_3channel(img):
|
| 17 |
return np.stack([img, img, img], axis=-1)
|
| 18 |
+
|
| 19 |
+
def preprocess_dicom(path):
|
| 20 |
+
img = load_dicom_image(path)
|
| 21 |
+
img = resize_image(img)
|
| 22 |
+
img = normalize_image(img)
|
| 23 |
+
img = to_3channel(img)
|
| 24 |
+
img = np.expand_dims(img, axis=0)
|
| 25 |
+
return img
|