Chris Oswald
commited on
Commit
•
dd91a36
1
Parent(s):
f2ef76c
changed resolution to reduce image loading time
Browse files
SPIDER.py
CHANGED
@@ -46,6 +46,8 @@ def standardize_3D_image(
|
|
46 |
image = np.transpose(image, axes=[1, 2, 0])
|
47 |
# Resize image
|
48 |
image = skimage.transform.resize(image, resize_shape)
|
|
|
|
|
49 |
return image
|
50 |
|
51 |
|
@@ -163,8 +165,8 @@ class SPIDER(datasets.GeneratorBasedBuilder):
|
|
163 |
"scan_type": datasets.Value("string"),
|
164 |
"image_path": datasets.Value("string"),
|
165 |
"mask_path": datasets.Value("string"),
|
166 |
-
"image_array": datasets.Array3D(shape=image_size, dtype='
|
167 |
-
"mask_array": datasets.Array3D(shape=image_size, dtype='
|
168 |
"metadata": {
|
169 |
"num_vertebrae": datasets.Value(dtype="string"), #TODO: more specific types
|
170 |
"num_discs": datasets.Value(dtype="string"),
|
|
|
46 |
image = np.transpose(image, axes=[1, 2, 0])
|
47 |
# Resize image
|
48 |
image = skimage.transform.resize(image, resize_shape)
|
49 |
+
# Rescale to UInt8 type
|
50 |
+
image = skimage.img_as_ubyte(image)
|
51 |
return image
|
52 |
|
53 |
|
|
|
165 |
"scan_type": datasets.Value("string"),
|
166 |
"image_path": datasets.Value("string"),
|
167 |
"mask_path": datasets.Value("string"),
|
168 |
+
"image_array": datasets.Array3D(shape=image_size, dtype='uint8'),
|
169 |
+
"mask_array": datasets.Array3D(shape=image_size, dtype='uint8'),
|
170 |
"metadata": {
|
171 |
"num_vertebrae": datasets.Value(dtype="string"), #TODO: more specific types
|
172 |
"num_discs": datasets.Value(dtype="string"),
|