.img/.hdr格式轉.nii格式的操作
阿新 • • 發佈:2020-07-02
MATLAB轉格式,需要使用spm package(https://github.com/neurodebian/spm12).
%%img2nii.m-------------------------------------------- %Script to convert hdr/img files to nii. %This script uses SPM function,so you need to install SPM5 or later. %Kiyotaka Nemoto 05-Nov-2014 %select files f = spm_select(Inf,'img$','Select img files to be converted'); %convert img files to nii for i=1:size(f,1) input = deblank(f(i,:)); [pathstr,fname,ext] = fileparts(input); output = strcat(fname,'.nii'); V=spm_vol(input); ima=spm_read_vols(V); V.fname=output; spm_write_vol(V,ima); end
附加一下volume data是如何轉surface data的吧…
wb_command -volume-to-surface-mapping ArticParcels_Smithetal.nii /home/murphyhuang/tmp/nii/HCP_fMRI/Q1-Q6_R440.L.flat.32k_fs_LR.surf.gii outL.shape.gii -trilinear
補充知識:資料讀取——(.img .hdr)
1、定義
該影象格式含有兩部分:一個是影象 ‘.img ',另一個是影象標頭檔案 '.hdr',該檔案記錄了影象的資訊,如影象尺寸、波段數、資料型別和大小端等。如果缺少標頭檔案,將無法對影象進行讀取,因此標頭檔案十分重要。
2、讀取
使用Matlab中NifTi包讀取。
eg:
img=load_nii(‘D:\a01_101_bmask.hdr')
以上這篇.img/.hdr格式轉.nii格式的操作就是小編分享給大家的全部內容了,希望能給大家一個參考,也希望大家多多支援我們。