将.png文件转换为.nii(NiFti文件) [英] Convert .png files to .nii (NiFti files)

查看:325
本文介绍了将.png文件转换为.nii(NiFti文件)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前正在处理一个项目,该项目处理来自 neuro images .nii 个文件.我将该文件转换为80个 .png 文件.现在,我需要再次将这80个 .png 合并到 .nii 文件中.

I'm currently working in a project which handles .nii files from neuro images. I converted that file into 80 .png files. Now I need to combine those 80 .png into .nii files again.

请帮助.

谢谢.

推荐答案

严格的答案是不,您不能这样做.因为png文件不包含NIfTI文件所需的那些信息.

The strict answer is no, you can't do it. Because png files do not contain those information needed for NIfTI file.

但是,如果您不在乎坐标和左右信息是否正确,则可以生成伪造的nii文件.您可以使用 for 循环读取png文件(我想它们具有相同的尺寸):

However if you don't care whether the coordinate and left-right information is correct or not, you could generate a fake nii file. You can read your png files (I suppose they have the same dimension) using a for loop:

for i = 1:numberOfPNG_file
    img(:,:,i) = imread(png_Files{i});
end

您可以使用Matlab NIfTI工具来创建nii文件:

The you can use the Matlab NIfTI tool to create nii file:

nii = nii_tool('init', img);
nii_tool('save', nii, 'my_nii.nii');

这篇关于将.png文件转换为.nii(NiFti文件)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆