我正在尝试写出我从 DICOM 图像创建的 NIfTI 文件。在这个例子中,我使用了来自 Kaggle 的 Data Science Bowl 的 DICOM 图像。
您必须接受条款才能下载示例文件,但可以在“stage1”文件夹中找到它:
https://www.kaggle.com/c/second-annual-data-science-bowl/data
pacman::p_load(oro.dicom, oro.nifti)
all_slices_fb99a80cbb2f441bb90135bab5b029fe <- readDICOM("stage1/fb99a80cbb2f441bb90135bab5b029fe")
nii_test <- dicom2nifti(all_slices_fb99a80cbb2f441bb90135bab5b029fe)
d=dim(nii_test); d; class(nii_test) #512 512 111
nii_test
NIfTI-1 format Type : nifti Data Type : 4 (INT16) Bits per Pixel : 16 Slice Code : 0 (Unknown) Intent Code : 0 (None) Qform Code : 2 (Aligned_Anat) Sform Code : 2 (Aligned_Anat) Dimension : 512 x 512 x 111 Pixel Dimension : 0.68 x 0.68 x NA Voxel Units : mm Time Units : sec
fname="output_3D_file"
writeNIfTI(nim=nii_test, filename=fname)
Error in if (!all(object@dim_[indices] > 0 & pixdim(object)[indices] > : missing value where TRUE/FALSE needed