-
Notifications
You must be signed in to change notification settings - Fork 1
/
vox2ras_1to0.m
51 lines (36 loc) · 908 Bytes
/
vox2ras_1to0.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
36
37
38
39
40
41
42
43
44
function M0 = vox2ras_1to0(M1)
% M0 = vox2ras_1to0(M1)
%
% Converts a 1-based vox2ras matrix to 0-based, ie,
% Pxyz = M0*[c r s 1]' = M1*[(c+1) (r+1) (s+1) 1]'
%
% See also: vox2ras_0to1
%
%
% vox2ras_1to0.m
%
% Original Author: Doug Greve
% CVS Revision Info:
% $Author: nicks $
% $Date: 2011/03/02 00:04:13 $
% $Revision: 1.3 $
%
% Copyright © 2011 The General Hospital Corporation (Boston, MA) "MGH"
%
% Terms and conditions for use, reproduction, distribution and contribution
% are found in the 'FreeSurfer Software License Agreement' contained
% in the file 'LICENSE' found in the FreeSurfer distribution, and here:
%
% https://surfer.nmr.mgh.harvard.edu/fswiki/FreeSurferSoftwareLicense
%
% Reporting: [email protected]
%
M0 = [];
if(nargin ~= 1)
fprintf('M0 = vox2ras_1to0(M1)');
return;
end
Q = zeros(4);
Q(1:3,4) = -ones(3,1);
M0 = inv(inv(M1)+Q);
return;