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

📄 msk_coords.m

📁 toolbox of BVQX, This is the access between BV and matlab. It will help you to analysis data from BV
💻 M
字号:
function vox = msk_Coords(hfile, csc)
% MSK::Coords  - return a list of coordinates in a mask
%
% FORMAT:       vox = msk.Coords([convention])
%
% Input fields:
%
%       convention  either 'bvint', {'bvsys'}, or 'tal'
%
% Output fields:
%
%       vox         Vx3 list of coordinates

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

% argument check
if nargin < 1 || ...
    numel(hfile) ~= 1 || ...
   ~isBVQXfile(hfile, 'msk')
    error( ...
        'BVQXfile:BadArgument', ...
        'Invalid call to ''%s''.', ...
        mfilename ...
    );
end
bc = bvqxfile_getcont(hfile.L);
if nargin < 2 || ...
   ~ischar(csc) || ...
   ~any(strcmpi(csc(:)', {'bvint', 'bvsys', 'int', 'sys', 'tal'}))
    csc = 'bvsys';
else
    csc = lower(csc(:)');
end

% find coordinates
[c1, c2, c3] = ind2sub(size(bc.Mask), find(bc.Mask ~= 0));

% multiply correctly and add ?Start Value
res = bc.Resolution;
c1 = (c1 - 1) .* res + bc.XStart;
c2 = (c2 - 1) .* res + bc.YStart;
c3 = (c3 - 1) .* res + bc.ZStart;

% what convention
switch (csc)
    
    % BV internal
    case {'bvint', 'int'}
        vox = [c1(:), c2(:), c3(:)];
    
    % BV internal
    case {'bvsys', 'sys'}
        vox = [c3(:), c1(:), c2(:)];
    
    % BV internal
    case {'tal'}
        vox = 128 - [c3(:), c1(:), c2(:)];
end

⌨️ 快捷键说明

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