-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Closed
Labels
bugSomething isn't workingSomething isn't working
Description
Describe the bug
I found some issues in the following code snip:
MONAI/monai/data/image_reader.py
Lines 510 to 521 in 2cbed6c
| first_slice = slices[0] | |
| average_distance = 0.0 | |
| first_array = self._get_array_data(first_slice) | |
| shape = first_array.shape | |
| spacing = getattr(first_slice, "PixelSpacing", [1.0, 1.0, 1.0]) | |
| pos = getattr(first_slice, "ImagePositionPatient", (0.0, 0.0, 0.0))[2] | |
| stack_array = [first_array] | |
| for idx in range(1, len(slices)): | |
| slc_array = self._get_array_data(slices[idx]) | |
| slc_shape = slc_array.shape | |
| slc_spacing = getattr(first_slice, "PixelSpacing", (1.0, 1.0, 1.0)) | |
| slc_pos = getattr(first_slice, "ImagePositionPatient", (0.0, 0.0, float(idx)))[2] |
- In line 520, spacing should be got from
slices[idx]instead offirst_slice; there's the same issue in line 521; - the default value in line 514 is
[1.0, 1.0, 1.0], which is alistinstance, while the default value in line 520 is(1.0, 1.0, 1.0), which is atupleinstance, and(1.0, 1.0, 1.0) == [1.0, 1.0, 1.0]will result inFalse.
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working