首页 > 解决方案 > 带有 .nii.gz 文件的医学成像 (PyRadiomics)

问题描述

我正在尝试实施该软件包:

https://pyradiomics.readthedocs.io/en/latest/usage.html

它看起来超级简单,但他们需要 .nrrd文件。我的文件是.nii.gz。我该如何解决这个问题?另外,有没有人尝试在 TCIA 数据上应用 PyRadiomics?如果是这样,我可以看看你的 github 或 Jupyter Notebook 吗?

非常感谢。

标签: pythonimagemedicalnifti

解决方案


You could turn NII into numpy array firstly and then turn it into NRRD with using:

nrrd and nibabel

import numpy as np
import nibabel as nib
import nrrd

# Download NII
example_filename = "image.nii.gz"
image = nib.load(example_filename)

# Turn into numpy array
array = np.array(img.dataobj)

# Save NRRD
nrrd_path_to = "image.nrrd"
nrrd.write(image_path_to, array)

推荐阅读