0001 function outpoints = rest_mni2tal(inpoints)
0002
0003
0004
0005
0006
0007
0008
0009
0010 dimdim = find(size(inpoints) == 3);
0011 if isempty(dimdim)
0012 error('input must be a N by 3 or 3 by N matrix')
0013 end
0014 if dimdim == 2
0015 inpoints = inpoints';
0016 end
0017
0018
0019 upT = rest_spm_matrix([0 0 0 0.05 0 0 0.99 0.97 0.92]);
0020 downT = rest_spm_matrix([0 0 0 0.05 0 0 0.99 0.97 0.84]);
0021
0022 tmp = inpoints(3,:)<0;
0023 inpoints = [inpoints; ones(1, size(inpoints, 2))];
0024 inpoints(:, tmp) = downT * inpoints(:, tmp);
0025 inpoints(:, ~tmp) = upT * inpoints(:, ~tmp);
0026 outpoints = inpoints(1:3, :);
0027 if dimdim == 2
0028 outpoints = outpoints';
0029 end
0030
0031
0032
0033