File tree Expand file tree Collapse file tree 3 files changed +7
-1
lines changed Expand file tree Collapse file tree 3 files changed +7
-1
lines changed Original file line number Diff line number Diff line change @@ -201,7 +201,7 @@ def voxel_sizes(self):
201
201
zs = self .get ('SpacingBetweenSlices' )
202
202
if zs is None :
203
203
zs = self .get ('SliceThickness' )
204
- if zs is None :
204
+ if zs is None or zs == '' :
205
205
zs = 1
206
206
# Protect from python decimals in pydicom 0.9.7
207
207
zs = float (zs )
Original file line number Diff line number Diff line change 35
35
DATA_FILE_SLC_NORM = pjoin (IO_DATA_PATH , 'csa_slice_norm.dcm' )
36
36
DATA_FILE_DEC_RSCL = pjoin (IO_DATA_PATH , 'decimal_rescale.dcm' )
37
37
DATA_FILE_4D = pjoin (IO_DATA_PATH , '4d_multiframe_test.dcm' )
38
+ DATA_FILE_EMPTY_ST = pjoin (IO_DATA_PATH , 'slicethickness_empty_string.dcm' )
38
39
39
40
# This affine from our converted image was shown to match our image spatially
40
41
# with an image from SPM DICOM conversion. We checked the matching with SPM
@@ -616,6 +617,11 @@ def test_data_real(self):
616
617
assert_equal (sha1 (dat_str ).hexdigest (),
617
618
'149323269b0af92baa7508e19ca315240f77fa8c' )
618
619
620
+ @dicom_test
621
+ def test_slicethickness_fallback (self ):
622
+ dw = didw .wrapper_from_file (DATA_FILE_EMPTY_ST )
623
+ assert_equal (dw .voxel_sizes [2 ], 1.0 )
624
+
619
625
@dicom_test
620
626
def test_data_fake (self ):
621
627
# Test algorithm for get_data
You can’t perform that action at this time.
0 commit comments