Skip to content

Commit 05752f1

Browse files
authored
Merge pull request #471 from zivy/bugThumbnailCreation
Correct parameter passing to sitk.IntensityWindowing.
2 parents 7757fed + a04bdae commit 05752f1

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

Python/scripts/characterize_data.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -552,11 +552,11 @@ def image_to_thumbnail(img, thumbnail_sizes, interpolator, projection_axis):
552552
outputMaximum=255.0,
553553
)
554554
img = sitk.Cast(wl_image, sitk.sitkUInt8)
555-
else:
555+
else: # pixel type of uint8
556556
img = sitk.IntensityWindowing(
557-
img,
558-
windowMinimum=np.min(sitk.GetArrayViewFromImage(img)),
559-
windowMaximum=np.max(sitk.GetArrayViewFromImage(img)),
557+
img, # numpy returns its own type np.uint8 which isn't converted implicitly by SimpleITK
558+
windowMinimum=int(np.min(sitk.GetArrayViewFromImage(img))),
559+
windowMaximum=int(np.max(sitk.GetArrayViewFromImage(img))),
560560
)
561561
# Computations below are simplified if we assume image axes are the
562562
# standard basis. This is reasonable for the purpose of creating a

0 commit comments

Comments
 (0)