【发布时间】:2021-09-25 15:18:26
【问题描述】:
我是医学图像的新手,遇到了一种名为 .nii/.nii.gz 的文件格式:(576, 576, 88) > 高宽576,深88。
但我想以这种方式重新定位 (88, 576, 576)。即深度必须是第一位的。在这种情况下,如何使用 python 实现这一点? 我做了如下;
import nibabel as nib
img1 = nib.load("path_to_the_file/segmentation.nii.gz")
img1.shape
(576, 576, 88)
我确实喜欢这个;
img1 = np.reshape(img1, (88, 576, 576))
但未能成功。
【问题讨论】:
标签: python python-3.x numpy numpy-slicing nifti