📄 importvmpfromspms.m
字号:
function vmp = importvmpfromspms(maps, maptype, bbox, res, imeth)
% importvtcfromanalyze - import several Analzye SPM map files
%
% FORMAT: vmp = importvmpfromspms([maps [, type [, bbox, res [, imeth]]]])
%
% Input fields:
%
% maps char or cell array with SPM map filenames
% type type of map ('a' for auto, default)
% bbox optional 2x3 bounding box (default: small TAL box)
% res optional resolution (default: 3)
% imeth interpolation, {'linear'}, 'cubic', 'spline'
%
% Output fields:
%
% vmp created VMP object
% Version: v0.7b
% Build: 7091222
% Date: Sep-12 2007, 10:45 PM CEST
% Author: Jochen Weber, Brain Innovation, B.V., Maastricht, NL
% URL/Info: http://wiki.brainvoyager.com/BVQXtools
% argument check
if nargin < 1 || ...
isempty(maps) || ...
(~iscell(maps) && ...
~ischar(maps))
if mainver > 6
msargs = {'MultiSelect', 'on'};
else
msargs = {};
end
[mapf, mapp] = uigetfile( ...
{'*.hdr', 'SPM2 result map files (*.hdr)'; ...
'*.nii', 'SPM5 result map files (*.nii)'}, ...
'Please select the SPM map files to import...', '', msargs{:});
if isequal(mapf, 0) || ...
isequal(mapp, 0)
vmp = [];
return;
end
if ~iscell(mapf)
maps = strrep([strrep(mapp, '\', '/') '/' mapf], '//', '/');
else
maps = mapf;
for mc = 1:numel(maps)
maps{mc} = strrep([strrep(mapp, '\', '/') '/' maps{mc}], '//', '/');
end
end
end
if ~iscell(maps)
if size(maps, 1) > 1
maps = cellstr(maps);
else
maps = {maps};
end
end
if nargin < 2 || ...
~ischar(maptype)
maptype = 'a';
end
if nargin < 3 || ...
~isa(bbox, 'double') || ...
~isequal([2, 3], size(bbox))
bbox = [51, 43, 53; 236, 192, 202];
end
if nargin < 4 || ...
~isa(res, 'double') || ...
numel(res) ~= 1 || ...
~any((1:12) == res)
res = 3;
end
if nargin < 5 || ...
~ischar(imeth) || ...
~any(strcmpi(imeth(:)', {'cubic', 'linear', 'nearest', 'spline'}))
imeth = 'linear';
else
imeth = lower(imeth(:)');
end
% big try and catch
try
vmps = cell(1, 1);
vmp = newnatresvmp(bbox, res);
vmps{1} = vmp;
opts = struct;
opts.interp = imeth;
opts.maptype = maptype;
vmp.ImportSPMMaps(maps, opts);
vmp.Map = vmp.Map(2:end);
vmp.NrOfMaps = numel(vmp.Map);
bless(vmp, 1);
catch
clearbvqxobjects(vmps);
rethrow(lasterror);
end
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -