Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

compute slice distance from image position

#cosines are stored under the image orientation tag
#ipp are stored under the image position tag
cosines = get_image_orientation(slices[0])
normal = np.cross(cosines[:3], cosines[3:])
distances = []
for slice_ in slices:
  	ipp = get_image_position(slice)
	dist = np.sum(normal*ipp)
    distances.append(dist)
dist_arr = np.array(distances)
dist_arr_sorted = np.sort(dist_arr)
dist_between_slices = np.ediff1d(dist_arr_sorted)
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #compute #slice #distance #image #position
ADD COMMENT
Topic
Name
6+6 =