Dear doug,
Thank you for your quick reply - Unfortunately this does not yet work. I have written a small matlab example to more clearly show my problem:
clear all; clc;
% I would like to load a surface with
% [rh.pial.vertices,rh.pial.faces] = read_surf([surfdir 'rh.pial' ]);
%
% rh.pial.vertices(59551,:) for example yields the vertex coordinates for
% vertex 59550: [34.2031 -24.7783 44.7629]
% when I open the image and the surface in freeview I can select this
% vertex and freeview tells me, that the voxel position in the image is [293 275 236]
% and the RAS is [44.19 -15.96 73.19]
% how can I calculate the voxel position or the RAS
% based on the vertex coordinates I obtained with read_surf?
% This is what I tried so far:
%% example: Vertex 59550
RAS = [44.19 -15.96 73.19];
ImageVoxel = [293 275 236];
VertexCoordinate = [34.20 -24.78 44.76];
%% Image
originator = [ 2.060349426269531e+02, ...
2.073668823242188e+02, ...
90.155899047851560, ...
31551,...
-7805];
sMatrix = [ 0.5 ,0 ,0 ,-1.025174713134766e+02; ...
0 ,-0.5 ,0 ,1.213165588378906e+02; ...
0 ,0 ,0.5 ,-44.577949523925780;
0 ,0 ,0 ,1];
%% RAS2Vox
Ras2VoxTransf = inv(sMatrix);
Ras2VoxResult = round(RAS * Ras2VoxTransf(1:3,1:3)+Ras2VoxTransf(1:3,4)');
% now Ras2VoxResult is equal to ImageVoxel :)
% now I only need a transform from VertexCoordinate to RAS ...
%% RasTkr2Vox
vox2rastkr = [-0.50000 0.00000 0.00000 112.50000; ...
0.00000 0.00000 0.50000 -73.00000; ...
0.00000 -0.50000 0.00000 112.50000; ...
0.00000 0.00000 0.00000 1.00000];
Ras2VoxTkrTransf = inv(vox2rastkr);
Ras2VoxTkrResult = round( ...
VertexCoordinate * Ras2VoxTkrTransf(1:3,1:3)+ ...
Ras2VoxTkrTransf(1:3,4)');
% This yields not the desired result - so, which Matrix do I have to use?
Thank you
Steffen
2011/2/9 Douglas N Greve
<greve@nmr.mgh.harvard.edu>
The --vox2ras-tkr transform will take you to voxel space in the conformed coordinates (not the raw input). Is this good enough?
doug
Steffen Bollmann wrote:
Dear freesurfer experts,
I would like to display freesurfer surfaces in the voxelspace of the original subject image using matlab.
Which coordinate transformation do I have to apply to get the vertex-coordinates to the RAS space and finally to the original voxelspace of the subject? (i guess for RAS2Vox I can use the matrix I can obtain with mri_info ... but I cannot find a way from vertex-coordinates to RAS)
Thank you for any hint
Best Regards
Steffen Bollmann
_______________________________________________
Freesurfer mailing list
Freesurfer@nmr.mgh.harvard.edu
https://mail.nmr.mgh.harvard.edu/mailman/listinfo/freesurfer
--
Douglas N. Greve, Ph.D.
MGH-NMR Center
greve@nmr.mgh.harvard.edu
Phone Number: 617-724-2358 Fax: 617-726-7422
Bugs: surfer.nmr.mgh.harvard.edu/fswiki/BugReporting
FileDrop: www.nmr.mgh.harvard.edu/facility/filedrop/index.html
The information in this e-mail is intended only for the person to whom it is
addressed. If you believe this e-mail was sent to you in error and the e-mail
contains patient information, please contact the Partners Compliance HelpLine at
http://www.partners.org/complianceline . If the e-mail was sent to you in error
but does not contain patient information, please contact the sender and properly
dispose of the e-mail.