Skip to content

Commit b3f8c06

Browse files
authored
Fix missing func of load_dcm
1 parent ae6678f commit b3f8c06

File tree

1 file changed

+13
-0
lines changed
  • CV/Effective Transformer-based Solution for RSNA Intracranial Hemorrhage Detection/easymia/transforms

1 file changed

+13
-0
lines changed

CV/Effective Transformer-based Solution for RSNA Intracranial Hemorrhage Detection/easymia/transforms/functional.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -177,3 +177,16 @@ def hu2uint8(image, HU_min=-1200.0, HU_max=600.0, HU_nan=-2000.0):
177177
image_new = (image_new * 255).astype('uint8')
178178

179179
return image_new
180+
181+
182+
def load_dcm(sorted_dcm_list):
183+
"""
184+
Return img array and [z,y,x]-ordered origin and spacing
185+
"""
186+
itkimage = sitk.ReadImage(sorted_dcm_list)
187+
numpyImage = sitk.GetArrayFromImage(itkimage)
188+
189+
numpyOrigin = np.array(list(reversed(itkimage.GetOrigin())))
190+
numpySpacing = np.array(list(reversed(itkimage.GetSpacing())))
191+
192+
return numpyImage, numpyOrigin, numpySpacing

0 commit comments

Comments
 (0)