Chris Oswald
commited on
Commit
·
ba3659a
1
Parent(s):
0f058a2
debugging
Browse files
SPIDER.py
CHANGED
|
@@ -479,6 +479,9 @@ class SPIDER(datasets.GeneratorBasedBuilder):
|
|
| 479 |
image_path = os.path.join(paths_dict['images'], 'images', example)
|
| 480 |
image = sitk.ReadImage(image_path)
|
| 481 |
|
|
|
|
|
|
|
|
|
|
| 482 |
# Convert .mha image to original size numeric array
|
| 483 |
image_array_original = sitk.GetArrayFromImage(image)
|
| 484 |
|
|
@@ -495,6 +498,9 @@ class SPIDER(datasets.GeneratorBasedBuilder):
|
|
| 495 |
mask_path = os.path.join(paths_dict['masks'], 'masks', example)
|
| 496 |
mask = sitk.ReadImage(mask_path)
|
| 497 |
|
|
|
|
|
|
|
|
|
|
| 498 |
# Convert .mha mask to original size numeric array
|
| 499 |
mask_array_original = sitk.GetArrayFromImage(mask)
|
| 500 |
|
|
|
|
| 479 |
image_path = os.path.join(paths_dict['images'], 'images', example)
|
| 480 |
image = sitk.ReadImage(image_path)
|
| 481 |
|
| 482 |
+
# Rescale image intensities to [0, 255] and cast as UInt8 type
|
| 483 |
+
image = sitk.Cast(sitk.RescaleIntensity(image), sitk.sitkUInt8)
|
| 484 |
+
|
| 485 |
# Convert .mha image to original size numeric array
|
| 486 |
image_array_original = sitk.GetArrayFromImage(image)
|
| 487 |
|
|
|
|
| 498 |
mask_path = os.path.join(paths_dict['masks'], 'masks', example)
|
| 499 |
mask = sitk.ReadImage(mask_path)
|
| 500 |
|
| 501 |
+
# Rescale mask intensities to [0, 255] and cast as UInt8 type
|
| 502 |
+
mask = sitk.Cast(sitk.RescaleIntensity(mask), sitk.sitkUInt8)
|
| 503 |
+
|
| 504 |
# Convert .mha mask to original size numeric array
|
| 505 |
mask_array_original = sitk.GetArrayFromImage(mask)
|
| 506 |
|