File size: 230 Bytes
72417f2
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
function vox = ras2vox(ras,vox2ras0)

if size(ras,2)==3
    ras2=[ras'; ones(1,size(ras,1))];
else
    ras2=[ras; ones(1,size(ras,2))];
end

vox = inv(vox2ras0) * ras2;

vox=vox([2 1 3],:)-1;  % matlab flip and 1-based indexing