You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
fix: division by zero in DICOMReader._get_affine for single-slice 3D volumes #8925
When n == 1 (single-slice 3D DICOM segmentation), n - 1 = 0 causes a ZeroDivisionError.
This occurs in the segmentation code path (_get_seg_data) at line 898, where lastImagePositionPatient is always set from the frame metadata regardless of the number of frames. For a single-frame segmentation, the first and last positions are identical, so t1n - sx = 0, t2n - sy = 0, t3n - sz = 0, and n - 1 = 0, resulting in 0 / 0.
Proposed Fix
Guard the lastImagePositionPatient computation in _get_affine with n > 1:
Activity
fix: guard division by zero in DICOMReader._get_affine for single-sli…
fix: guard division by zero in DICOMReader._get_affine for single-sli…
fix(data): avoid divide-by-zero in pydicom affine for single-slice vo…