Вычислять расстояние с разреза от положения изображения

#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)
Real Raccoon