📜  从图像位置计算切片距离 - Python 代码示例

📅  最后修改于: 2022-03-11 14:45:29.110000             🧑  作者: Mango

代码示例1
#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)