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

📄 applybvtrf.m

📁 toolbox of BVQX, This is the access between BV and matlab. It will help you to analysis data from BV
💻 M
字号:
function tc = applybvtrf(c, t, it)
% applybvtrf  - apply BV transformation matrix to system coords
%
% FORMAT:       tc = applybvtrf(c, t [, it])
%
% Input fields:
%
%       c           Cx3 coordinate list
%       t           4x4 transformation matrix (from TRF file, type 2)
%       it          inverse transformation flag, default: true (!)
%
% Output fields:
%
%       tc          transformed coordinates
% 
% Note: since BV stores the transformation as to sample the intensities
%       the matrix is actually already an inverse of the configured
%       matrix. To keep this logic, the it parameter must be set to false

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

% argument check
if nargin < 2 || ...
   ~isa(c, 'double') || ...
   ~isa(t, 'double') || ...
    size(c, 2) ~= 3 || ...
    numel(t) ~= 16 || ...
    any(size(t) ~= 4) || ...
    any(isinf(t(:)) | isnan(t(:)))
    error( ...
        'BVQXtools:BadArgument', ...
        'Bad or missing input argument.' ...
    );
end
if nargin < 3 || ...
   ~islogical(it) || ...
    isempty(it)
    it = true;
end

% swap and append columns, subtract center coordinate
tc = [c(:, [2, 3, 1]) - 127.5, ones(size(c, 1), 1)];

% apply transformation
if it(1)
    tc = tc * inv(t)';
else
    tc = tc * t';
end

% swap and remove columns again and add center again
tc = 127.5 + tc(:, [3, 1, 2]);

⌨️ 快捷键说明

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