Chris Oswald
commited on
Commit
·
c712771
1
Parent(s):
7ed1b1f
debugging
Browse files
SPIDER.py
CHANGED
|
@@ -44,16 +44,15 @@ def subset_file_list(all_files: List[str], subset_ids: Set[int]):
|
|
| 44 |
|
| 45 |
def standardize_3D_image(
|
| 46 |
image: np.ndarray,
|
| 47 |
-
resize_shape: Tuple[int, int]
|
| 48 |
) -> np.ndarray:
|
| 49 |
"""Aligns dimensions of image to be (height, width, channels) and resizes
|
| 50 |
-
images to values specified in resize_shape
|
| 51 |
-
are preserved)."""
|
| 52 |
# Align height, width, channel dims
|
| 53 |
if image.shape[0] < image.shape[2]:
|
| 54 |
image = np.transpose(image, axes=[1, 2, 0])
|
| 55 |
# Resize image
|
| 56 |
-
image = skimage.transform.resize(image, resize_shape)
|
| 57 |
# Rescale to UInt8 type
|
| 58 |
image = skimage.img_as_ubyte(image)
|
| 59 |
return image
|
|
@@ -64,7 +63,7 @@ N_PATIENTS = 218
|
|
| 64 |
MIN_IVD = 0
|
| 65 |
MAX_IVD = 9
|
| 66 |
DEFAULT_SCAN_TYPES = ['t1', 't2', 't2_SPACE']
|
| 67 |
-
DEFAULT_RESIZE = (512, 512)
|
| 68 |
|
| 69 |
_CITATION = """\
|
| 70 |
@misc{vandergraaf2023lumbar,
|
|
|
|
| 44 |
|
| 45 |
def standardize_3D_image(
|
| 46 |
image: np.ndarray,
|
| 47 |
+
resize_shape: Tuple[int, int, int]
|
| 48 |
) -> np.ndarray:
|
| 49 |
"""Aligns dimensions of image to be (height, width, channels) and resizes
|
| 50 |
+
images to values specified in resize_shape."""
|
|
|
|
| 51 |
# Align height, width, channel dims
|
| 52 |
if image.shape[0] < image.shape[2]:
|
| 53 |
image = np.transpose(image, axes=[1, 2, 0])
|
| 54 |
# Resize image
|
| 55 |
+
image = skimage.transform.resize(image, resize_shape)
|
| 56 |
# Rescale to UInt8 type
|
| 57 |
image = skimage.img_as_ubyte(image)
|
| 58 |
return image
|
|
|
|
| 63 |
MIN_IVD = 0
|
| 64 |
MAX_IVD = 9
|
| 65 |
DEFAULT_SCAN_TYPES = ['t1', 't2', 't2_SPACE']
|
| 66 |
+
DEFAULT_RESIZE = (512, 512, 30)
|
| 67 |
|
| 68 |
_CITATION = """\
|
| 69 |
@misc{vandergraaf2023lumbar,
|