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

📄 mni2tal.m

📁 toolbox of BVQX, This is the access between BV and matlab. It will help you to analysis data from BV
💻 M
字号:
function talout = mni2tal(mniin, rounded)
% mni2tal  - converts coordinates from MNI brain to best Talairach guess
%
% FORMAT:       talout = mni2tal(mniin [, rounded])
%
% Input fields:
%
%       mniin       N-by-3 or 3-by-N matrix of coordinates
%       rounded     1x1 double, if given, coordinates are rounded to
%                   specified number of digits
%
% Output fields:
%
%       talout      is the coordinate matrix with Talairach points
%
% (c) Matthew Brett 10/8/99
%
% See also spm_matrix

% Version:  v0.5c
% Build:    6120415
% Date:     Dec-04 2006, 3:15 PM CET
% Author:   Matthew Brett
% URL/Info: http://wiki.brainvoyager.com/BVQXtools

% argument check
if nargin < 1 || ...
    length(size(mniin)) > 2 || ...
   ~isa(mniin, 'double')
    error( ...
        'BVQXtools:BadArgument', ...
        'Bad or missing input argument mniin.' ...
    );
end

dimdim = find(size(mniin) == 3);
if isempty(dimdim)
    error( ...
        'BVQXtools:BadArguments', ...
        'mniin argument must be a N-by-3 or 3-by-N matrix' ...
    );
end

% transpose as needed
if dimdim(1) == 2
    mniin = mniin';
end

% Transformation matrices, different zooms above/below AC
upT   = spm_matrix([0 0 0  0.05 0 0  0.99 0.97 0.92  0 0 0]);
downT = spm_matrix([0 0 0  0.05 0 0  0.99 0.97 0.84  0 0 0]);

% find points below axial AC plane
tmp = mniin(3,:) < 0;  % 1 if below AC

% add 1's for matrix multiplication
talout = [mniin; ones(1, size(mniin, 2))];

% multiply according to above/below axial AC plane
talout(:,  tmp) = downT * talout(:,  tmp);
talout(:, ~tmp) = upT   * talout(:, ~tmp);

% return only 3 coordinate points
talout = talout(1:3, :);

% retranspose to match input
if dimdim(1) == 2
    talout = talout';
end

% round output
if nargin > 1 && ...
    isa(rounded, 'double') && ...
   ~isempty(rounded)
    talout = (1/10^rounded(1)) * round(talout * 10^rounded(1));
end

⌨️ 快捷键说明

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