-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathcor2mni.m
35 lines (33 loc) · 906 Bytes
/
cor2mni.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%% cor2mni
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
function mni = cor2mni(cor, T)
% function mni = cor2mni(cor, T)
% convert matrix coordinate to mni coordinate
%
% cor: an Nx3 matrix
% T: (optional) rotation matrix
% mni is the returned coordinate in mni space
%
% caution: if T is not given, the default T is
% T = ...
% [-4 0 0 84;...
% 0 4 0 -116;...
% 0 0 4 -56;...
% 0 0 0 1];
%
% xu cui
% 2004-8-18
% last revised: 2005-04-30
if nargin == 1
T = ...
[-4 0 0 84;...
0 4 0 -116;...
0 0 4 -56;...
0 0 0 1];
end
cor = round(cor);
mni = T*[cor(:,1) cor(:,2) cor(:,3) ones(size(cor,1),1)]';
mni = mni';
mni(:,4) = [];
return;