資源簡介
依賴于MATLAB,可以讀取nii格式的文件,寫入和操作輸入的醫學影像數據
使用方法:1.下載壓縮包并解壓至MATLAB安裝路徑的toobox文件夾下 2.enjoy it!
代碼片段和文件信息
%??Using?2D?or?3D?affine?matrix?to?rotate?translate?scale?reflect?and
%??shear?a?2D?image?or?3D?volume.?2D?image?is?represented?by?a?2D?matrix
%??3D?volume?is?represented?by?a?3D?matrix?and?data?type?can?be?real?
%??integer?or?floating-point.
%
%??You?may?notice?that?MATLAB?has?a?function?called?‘imtransform.m‘?for
%??2D?spatial?transformation.?However?keep?in?mind?that?‘imtransform.m‘
%??assumes?y?for?the?1st?dimension?and?x?for?the?2nd?dimension.?They?are
%??equivalent?otherwise.
%
%??In?addition?if?you?adjust?the?‘new_elem_size‘?parameter?this?‘affine.m‘
%??is?equivalent?to?‘interp2.m‘?for?2D?image?and?equivalent?to?‘interp3.m‘
%??for?3D?volume.
%
%??Usage:?[new_img?new_M]?=?...
% affine(old_img?old_M?[new_elem_size]?[verbose]?[bg]?[method]);
%
%??old_img??- original?2D?image?or?3D?volume.?We?assume?x?for?the?1st
% dimension?y?for?the?2nd?dimension?and?z?for?the?3rd
% dimension.
%
%??old_M??- a?3x3?2D?affine?matrix?for?2D?image?or?a?4x4?3D?affine
% matrix?for?3D?volume.?We?assume?x?for?the?1st?dimension
% y?for?the?2nd?dimension?and?z?for?the?3rd?dimension.
%
%??new_elem_size?(optional)??-??size?of?voxel?along?x?y?z?direction?for?
% a?transformed?3D?volume?or?size?of?pixel?along?x?y?for
% a?transformed?2D?image.?We?assume?x?for?the?1st?dimension
% y?for?the?2nd?dimension?and?z?for?the?3rd?dimension.
% ‘new_elem_size‘?is?1?if?it?is?default?or?empty.
%
% You?can?increase?its?value?to?decrease?the?resampling?rate
% and?make?the?2D?image?or?3D?volume?more?coarse.?It?works
% just?like?‘interp3‘.
%
%??verbose?(optional)?-?1?0
% 1:??show?transforming?progress?in?percentage
% 2:??progress?will?not?be?displayed
% ‘verbose‘?is?1?if?it?is?default?or?empty.
%
%??bg?(optional)??- background?voxel?intensity?in?any?extra?corner?that
% is?caused?by?the?interpolation.?0?in?most?cases.?If?it?is
% default?or?empty?‘bg‘?will?be?the?average?of?two?corner
% voxel?intensities?in?original?data.
%
%??method?(optional)??- 1?2?or?3
% 1:??for?Trilinear?interpolation
% 2:??for?Nearest?Neighbor?interpolation
% 3:??for?Fischer‘s?Bresenham?interpolation
% ‘method‘?is?1?if?it?is?default?or?empty.
%
%??new_img??- transformed?2D?image?or?3D?volume
%
%??new_M??- transformed?affine?matrix
%
%??Example?1?(3D?rotation):
% load?mri.mat;???old_img?=?double(squeeze(D));
% old_M?=?[0.88?0.5?3?-90;?-0.5?0.88?3?-126;?0?0?2?-72;?0?0?0?1];
% new_img?=?affine(old_img?old_M?2);
% [x?y?z]?=?meshgrid(1:1281:1281:27);
% sz?=?size(new_img);
% [x1?y1?z1]?=?meshgrid(1:sz(2)1:sz(1)1:sz(3));
% figure;?slice(x?y?z?old_img?64?64?13.5);
% shading?flat;?colormap(map);?view(-66?66);
% figure;?slice(x1?y1?z1?new_img?sz(1)/2?sz(2)/2?sz(3)/2);
% shading?flat;?colormap(map);?view(-66?66);
%
%??Example?2?(2D?interpolation):
% load?mri.mat;???old_img=D(::113)‘;
% old_M?=?[1?0?0;?0?1?0;?0?0?1];
% new_img?=?affine(old_img?old_M?[.2?.4]);
% figure;?image(old_img);?colorma
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????文件???268435456??2015-09-07?18:01??NIfTI_20140122\test\nCT_SALINE_185_20150814_131414_1_IMG.img
?????目錄???????????0??2015-09-07?23:22??NIfTI_20140122\
?????文件??????206445??2014-01-23?06:26??NIfTI_20140122\FAQ.pdf
?????文件???????61950??2014-01-23?06:26??NIfTI_20140122\NIfTI_tools.pdf
?????文件???????91343??2014-01-23?06:25??NIfTI_20140122\UseANALYZE.pdf
?????文件???????16664??2008-10-24?02:22??NIfTI_20140122\affine.m
?????文件????????2239??2005-05-12?02:27??NIfTI_20140122\bipolar.m
?????文件????????4682??2008-08-22?03:40??NIfTI_20140122\bresenham_line3d.m
?????文件????????3421??2012-10-13?04:35??NIfTI_20140122\clip_nii.m
?????文件????????7038??2013-03-07?06:14??NIfTI_20140122\collapse_nii_scan.m
?????文件????????4513??2015-09-07?18:00??NIfTI_20140122\create_hdr.m
?????文件???268435808??2015-09-07?17:58??NIfTI_20140122\ct.nii
?????文件????????3929??2011-02-16?08:19??NIfTI_20140122\examples.txt
?????文件????????1381??2013-03-07?06:14??NIfTI_20140122\expand_nii_scan.m
?????文件????????8085??2005-08-15?03:58??NIfTI_20140122\extra_nii_hdr.m
?????文件????????3568??2009-07-04?03:55??NIfTI_20140122\flip_lr.m
?????文件????????4497??2013-03-07?06:14??NIfTI_20140122\get_nii_fr
?????文件????11291540??2015-09-07?18:01??NIfTI_20140122\img.mat
?????文件????????1310??2014-02-12?14:45??NIfTI_20140122\license.txt
?????文件????????7006??2013-03-07?06:16??NIfTI_20140122\load_nii.m
?????文件????????5544??2013-03-07?06:14??NIfTI_20140122\load_nii_ext.m
?????文件???????10311??2012-10-13?04:34??NIfTI_20140122\load_nii_hdr.m
?????文件???????12720??2011-06-09?23:03??NIfTI_20140122\load_nii_img.m
?????文件????????8293??2008-10-24?03:13??NIfTI_20140122\load_untouch0_nii_hdr.m
?????文件????????7255??2013-03-07?06:15??NIfTI_20140122\load_untouch_header_only.m
?????文件????????6373??2013-03-07?06:15??NIfTI_20140122\load_untouch_nii.m
?????文件????????8739??2008-10-24?03:15??NIfTI_20140122\load_untouch_nii_hdr.m
?????文件???????15224??2011-06-09?23:03??NIfTI_20140122\load_untouch_nii_img.m
?????文件????????5665??2011-06-10?23:57??NIfTI_20140122\make_ana.m
?????文件????????7105??2011-09-01?22:36??NIfTI_20140122\make_nii.m
?????文件????????2691??2008-07-07?22:15??NIfTI_20140122\mat_into_hdr.m
............此處省略72個文件信息
評論
共有 條評論