Skip to content

Commit 774ac6c

Browse files
committed
BUGFIX: account for negative Spacings Between Slices in Siemens MultiSlice 3D SPECT data
1 parent 156b50a commit 774ac6c

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

pymirc/fileio/read_dicom.py

+9
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,7 @@ def reorient_volume(self, patvol):
146146
3d numpy array
147147
reoriented numpy array in LPS orientation
148148
"""
149+
149150
# check the directions of the norm, col and row dir and revert some axis if necessary
150151
if(self.normdir == -1):
151152
patvol = patvol[::-1,:,:]
@@ -372,6 +373,13 @@ def get_multislice_3d_data(self, dcm_data):
372373
self.v0 /= np.sqrt((self.v0**2).sum())
373374
self.v0 *= self.sliceDistance
374375

376+
# heuristic modification of v0 and normdir if SpacingBetweenSlices is negative
377+
# tested on Siemens SPECT data
378+
if 'SpacingBetweenSlices' in dcm_data:
379+
if float(dcm_data.SpacingBetweenSlices) < 0:
380+
self.v0 *= -1
381+
self.normdir *= -1
382+
375383
ipp = None
376384

377385
if 'DetectorInformationSequence' in dcm_data:
@@ -403,6 +411,7 @@ def get_multislice_3d_data(self, dcm_data):
403411
self.affine[:3,2] = self.v2
404412
self.affine[:3,3] = self.offset
405413

414+
406415
return patvol
407416

408417

0 commit comments

Comments
 (0)