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

📄 bv2tal.m

📁 toolbox of BVQX, This is the access between BV and matlab. It will help you to analysis data from BV
💻 M
字号:
function [tal, vmult] = bv2tal(bv, offset, res)
% bv2tal  - converting BV system coordinates to TAL system
%
% FORMAT:       [tal, vmult] = bv2tal(bv [, offset [, res]])
%
% Input fields:
%
%       bv          BrainVoyager system coordinates
%       offset      1x3 coordinate offset (default: [-128, -128, -128])
%       res         1x3 resolution (default: [1, 1, 1])
%
% Output fields:
%
%       tal         coordinates in Talairach compliant system
%       vmult       multiplication matrix

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

% argument check
if nargin < 1 || ...
   ~isa(bv, 'double') || ...
   ~any(size(bv) == 3)
    error( ...
        'BVQXtools:BadArgument', ...
        'Bad or missing first argument.' ...
    );
end
if size(bv, 2) == 3 && ...
    size(bv, 1) ~= 3
    bv = bv';
end
if nargin < 3 || ...
   ~isa(res, 'double') || ...
   (numel(res) ~= 1 && numel(res) ~= 3) || ...
    any(isinf(res) | isnan(res))
    res = [1, 1, 1];
elseif numel(res) == 1
    res = [res, res, res];
else
    res = res(:)';
end
if nargin < 2 || ...
   ~isa(offset, 'double') || ...
    numel(offset) ~= 3 || ...
    any(isinf(offset) | isnan(offset))
    offset = [-128, -128, -128] ./ res;
else
    offset = offset(:);
end

% make 4x4 compliant and prepare mult matrix
bv(4, :) = 1;
vmult = [ ...
          0       0 -res(1)  -offset(1); ...
    -res(2)       0       0  -offset(2); ...
          0 -res(3)       0  -offset(3); ...
          0       0       0          1];

% multiply coordinates
tal = vmult * bv;
tal(4, :) = [];

⌨️ 快捷键说明

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