资源简介
医学图像处理MRI脑仿真库BrainWeb,mnc格式文件的读取代码。
代码片段和文件信息
function [imaVOLscaninfo] = loadminc(filename)
%function [imaVOLscaninfo] = loadminc(filename)
%
% Function to load minc format input file.
% This function use the netcdf MATLAB utility
%
% Matlab library function for MIA_gui utility.
% University of Debrecen PET Center/LB 2010
if nargin == 0
[FileName FilePath] = uigetfile(‘*.mnc‘‘Select minc file‘);
filename = [FilePathFileName];
if FileName == 0;
imaVOL = [];scaninfo = [];
return;
end
end
ncid=netcdf.open(filename‘NC_NOWRITE‘);
scaninfo.filename = filename;
%[ndims nvars natts dimm] = netcdf.inq(ncid);
%[varname xtype dimids atts] = netcdf.inqVar(ncidnetcdf.inqVarID(ncid‘xspace‘));
% for i=1:atts
%attname = netcdf.inqattname(ncidnetcdf.inqVarID(ncidvarname)i-1)
%attval = netcdf.getAtt(ncidnetcdf.inqVarID(ncidvarname)attname)
%end%
pixsizex = netcdf.getAtt(ncidnetcdf.inqVarID(ncid‘xspace‘)‘step‘);
pixsizey = netcdf.getAtt(ncidnetcdf.inqVarID(ncid‘yspace‘)‘step‘);
pixsizez = netcdf.getAtt(ncidnetcdf.inqVarID(ncid‘zspace‘)‘step‘);
x_start = netcdf.getAtt(ncidnetcdf.inqVarID(ncid‘xspace‘)‘start‘);
if isempty(x_start)
x_start = 0;
end
y_start = netcdf.getAtt(ncidnetcdf.inqVarID(ncid‘yspace‘)‘start‘);
if isempty(y_start)
y_start = 0;
end
z_start = netcdf.getAtt(ncidnetcdf.inqVarID(ncid‘zspace‘)‘start‘);
if isempty(z_start)
z_start = 0;
end
scaninfo.pixsize = abs([pixsizex pixsizey pixsizez]); % abs: Strange could happen
scaninfo.space_start = ([x_start y_start z_start]);
varid = netcdf.inqVarID(ncid‘image-max‘);
slice_max = netcdf.getVar(ncidvarid‘float‘);
scaninfo.mag = slice_max;
maxx = max(slice_max(:));
if maxx == round(maxx)
precision = ‘short‘;
scaninfo.float = 0;
else
precision = ‘float‘;
scaninfo.float = 1;
end
varid = netcdf.inqVarID(ncid‘image‘);
volume = netcdf.getVar(ncidvaridprecision);
varid = netcdf.inqVarID(ncid‘image-min‘);
slice_min = netcdf.getVar(ncidvaridprecision);
scaninfo.min = slice_min;
scaninfo.num_of_slice = size(volume3);
netcdf.close(ncid);
volume = double(volume);
imsize = size(volume);
% permute the slice image dim. This is for the permut command in thex for
% loop
imaVOL = zeros(imsize([213]));
slice_min = double(slice_min);
slice_max = double(slice_max);
if length(slice_min) >1 % ha minden slice-hoz el van t醨olva a max-min 閞t閗
for i=1: size(volume3)
currentslice = volume(::i);
imaVOL(::i) = permute( ((currentslice - min(currentslice(:))) / ( max(currentslice(:))- min(currentslice(:)) )...
*(slice_max(i)- slice_min(i))) - slice_min(i)[2 1]);
end
else
imaVOL = permute( ( (volume - min(volume(:))) / ( max(volume(:))- min(volume(:)) )*...
((slice_max- slice_min))) - slice_min[2 1 3]);
end
if strcmp(precision‘short‘)
imaVOL = int32(imaVOL);
end
scaninfo.imfm = [size(volume1) size(volume2)];
sca
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 3182 2014-02-12 13:35 loadminc.m
----------- --------- ---------- ----- ----
3182 1
相关资源
- Pattern Recognition and Machine Learning(高清
- MATLAB 编程 第二版 Stephen J. Chapman 著
- 均值滤波和FFT频谱分析Matlab代码
- 《MATLAB扩展编程》代码
- HDB3码、AMI码的MATLAB实现
- 3点GPS定位MATLAB仿真
- MATLAB数字信号处理85个实用案例精讲入
- matlab从入门到精通pdf94795
- 欧拉放大论文及matlab代码
- 跳一跳辅助_matlab版本
- 全面详解LTE MATLAB建模、仿真与实现
- MIMO-OFDM无线通信技术及MATLAB实现_孙锴
- MATLAB Programming for Engineers 4th - Chapman
- matlab 各种谱分析对比
- 分数阶chen混沌matlab程序
- 基于粒子群算法的非合作博弈的matl
- MATLAB车流仿真 包括跟驰、延误
- matlab空间桁架计算程序
- 基于MATLAB的图像特征点匹配和筛选
- DMA-TVP-FAVAR
- GPS信号的码捕获matlab代码.7z
- 一维光子晶体MATLAB仿真代码吸收率折
- newmark法源程序
- 传统关联成像、计算鬼成像matlab
- pri传统分选算法
- 摆动滚子推杆盘形凸轮设计
- 医学图像重建作业matlab源码
- Matlab实现混沌系统的控制
- 检测疲劳驾驶
- Matlab锁相环仿真-Phase Locked Loop.rar
评论
共有 条评论