⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 voi_details.m

📁 toolbox of BVQX, This is the access between BV and matlab. It will help you to analysis data from BV
💻 M
字号:
function void = voi_Details(hfile, vmp, vmpnum)
% VOI::Details  - extract VOI details from a VMP
%
% FORMAT:       void = voi.Details(vmp [, vmpnum])
%
% Input fields:
%
%       vmp         VMP object
%       vmpnum      map number (default: 1)
%
% Output fields:
%
%       void        ROID object with ROI details

% Version:  v0.7b
% Build:    7090215
% Date:     Sep-02 2007, 3:05 PM CEST
% Author:   Jochen Weber, Brain Innovation, B.V., Maastricht, NL
% URL/Info: http://wiki.brainvoyager.com/BVQXtools

% argument check
if nargin < 2 || ...
    numel(hfile) ~= 1 || ...
   ~isBVQXfile(hfile, 'voi') || ...
    numel(vmp) ~= 1 || ...
   ~isBVQXfile(vmp, 'vmp')
    error( ...
        'BVQXfile:BadArguments', ...
        'Invalid call to %s.', ...
        mfilename ...
    );
end
bc = bvqxfile_getcont(hfile.L);
vmpc = bvqxfile_getcont(vmp.L);
if nargin < 3 || ...
   ~isa(vmpnum, 'double') || ...
   ~isreal(vmpnum) || ...
    numel(vmpnum) ~= 1 || ...
    isinf(vmpnum) || ...
    isnan(vmpnum) || ...
    vmpnum < 1 || ...
    vmpnum > numel(vmpc.Map)
    vmpnum = 1;
else
    vmpnum = fix(vmpnum);
end

% get coords
numvois = numel(bc.VOI);
voitype = bc.CoordsType;
crdsnum = zeros(1, numvois);
coords = cell(numvois, 1);
for vc = 1:numvois
    coords{vc} = bc.VOI(vc).Voxels;
    crdsnum(vc) = size(coords{vc}, 1);
end

% total coords
crdssum = sum(crdsnum);
crdstat = zeros(crdssum, 5);
crdoffs = cumsum([1, crdsnum]);

% stat type
calcp = '';
df1 = vmpc.Map(vmpnum).DF1;
switch (vmpc.Map(vmpnum).Type)
    case {1}
        statype = sprintf('t(%d)', df1);
        calcp = 't';
        crdstat(:, end + 1) = 0;
    case {2}
        statype = sprintf('r(%d)', df1);
    otherwise
        statype = 'unsupported';
end

% get stats for each VOI
for vc = 1:numvois
    fromc = crdoffs(vc);
    toc = crdoffs(vc + 1) - 1;
    if strcmpi(voitype, 'tal')
        bcrd = tal2bv(coords{vc})';
        crdstat(fromc:toc, 1:3) = bcrd(:, [3,1,2]);
    else
        crdstat(fromc:toc, 1:3) = coords{vc}(:, [3,1,2]);
    end
    crdstat(fromc:toc, 4) = vc;
    crdstat(fromc:toc, 5) = ...
        vmp_VoxelStats(vmp, vmpnum, coords{vc}, voitype);
end

% calculate further stats
switch (calcp)
    case {'t'}
        crdstat(fromc:toc, 6) = 2 - 2 * custom_tcdf(abs(crdstat(:, 5)), df1);
end

% output object
void = BVQXfile('new:roid');
bc2 = bvqxfile_getcont(void.L);
bc2.TypeOfStatistic = statype;
bc2.NrOfVoxels = crdssum;
bc2.StatMinValue = min(crdstat(:, 5));
bc2.StatMaxValue = max(crdstat(:, 5));
bc2.AvgStatValue = mean(crdstat(:, 5));
bc2.StatWeightedMass = sum(crdstat(:, 5));
switch (calcp)
    case {'t'}
        bc2.AvgPValue = mean(crdstat(:, 6));
        bc2.PWeightedMass = sum(crdstat(:, 6));
    otherwise
        bc2.AvgPValue = 1;
        bc2.PWeightedMass = 0;
end
bc2.VoxelData = crdstat;
bc2.VoxelCoords = crdstat(:, 1:3);
bc2.VoxelStats = crdstat(:, 5);
bc2.NrOfSubROIs = numvois;

% sub ROIs
for vc = 1:numvois
    fromc = crdoffs(vc);
    toc = crdoffs(vc + 1) - 1;
    bc2.ROI(vc).NrOfVoxels = toc + 1 - fromc;
    bc2.ROI(vc).VoxelCoords = crdstat(fromc:toc, 1:3);
    bc2.ROI(vc).VoxelStats = crdstat(fromc:toc, 5);
end

% put back
bvqxfile_setcont(void.L, bc2);

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -