Skip to content

Commit

Permalink
Fix missing func of load_dcm
Browse files Browse the repository at this point in the history
  • Loading branch information
parap1uie-s committed Nov 7, 2022
1 parent ae6678f commit b3f8c06
Showing 1 changed file with 13 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -177,3 +177,16 @@ def hu2uint8(image, HU_min=-1200.0, HU_max=600.0, HU_nan=-2000.0):
image_new = (image_new * 255).astype('uint8')

return image_new


def load_dcm(sorted_dcm_list):
"""
Return img array and [z,y,x]-ordered origin and spacing
"""
itkimage = sitk.ReadImage(sorted_dcm_list)
numpyImage = sitk.GetArrayFromImage(itkimage)

numpyOrigin = np.array(list(reversed(itkimage.GetOrigin())))
numpySpacing = np.array(list(reversed(itkimage.GetSpacing())))

return numpyImage, numpyOrigin, numpySpacing

0 comments on commit b3f8c06

Please sign in to comment.