What do you mean by "ras matlab subscripts"? Those looks like indices, not RAS. Assuming those are indices, then that looks right. doug
On 05/18/2012 02:02 PM, Jordan L. Poppenk wrote:
Dear Doug,
To generalize from this earlier conversion question, to interpret the coordinate space of a file loaded by freesufer/matlab/MRIread.m, would one use the following transform to move from ras matlab subscripts (e.g., 1:256,1:256,1:256) to mni coords?
mni = talairach.xfm * vox2ras1 * [r a s 1]
The coordinates I get out of this transform do not seem quite right.
Cheers, Jordan
On May 3, 2012, at 5:40 PM, Jordan Poppenk wrote:
Dear Douglas,
That's exactly the information I was looking for. This worked perfectly. Thank you for your help!
Cheers, Jordan
Here's how to convert from surface RAS to mni305
mni305ras = X*S*inv(K)*ras X = talairach.xfm S = scanner vox2ras (mri_info --vox2ras orig.mgz) K = tkreg vox2ras (mri_info --vox2ras-tkr orig.mgz) ras = surface ras
If you want to go from mni305 to approximate talairach, you can use this transform from Matthew Brett:
function outpoints = mni2tal(inpoints) % Converts coordinates from MNI brain to best guess % for equivalent Talairach coordinates % FORMAT outpoints = mni2tal(inpoints) % Where inpoints is N by 3 or 3 by N matrix of coordinates % (N being the number of points) % outpoints is the coordinate matrix with Talairach points % Matthew Brett 10/8/99
dimdim = find(size(inpoints) == 3); if isempty(dimdim) error('input must be a N by 3 or 3 by N matrix') end if dimdim == 2 inpoints = inpoints'; %' end
% Transformation matrices, different zooms above/below AC upT = spm_matrix([0 0 0 0.05 0 0 0.99 0.97 0.92]); downT = spm_matrix([0 0 0 0.05 0 0 0.99 0.97 0.84]);
tmp = inpoints(3,:)<0; % 1 if below AC inpoints = [inpoints; ones(1, size(inpoints, 2))]; inpoints(:, tmp) = downT * inpoints(:, tmp); inpoints(:, ~tmp) = upT * inpoints(:, ~tmp); outpoints = inpoints(1:3, :); if dimdim == 2 outpoints = outpoints'; %' end
On 05/02/2012 12:54 PM, Jordan Poppenk wrote: Dear FreeSurfer experts,
How does one properly convert from surfaceRAS coords, as provided by fs_read_surf.m, to talairach coords? I have tried using freesurfer_surf2tal.m posted on the web by Darren Weber, supplying it with transform data from transforms/talairach.xfm, but the values returned often differ from those in tksurfer by as much as 20mm (and are clearly wrong). What I would like to do is match the coordinate system in tksurfer (which is clearly right). How does tksurfer do it?
Cheers,
Jordan
Freesurfer mailing list
Freesurfer at nmr.mgh.harvard.edu https://mail.nmr.mgh.harvard.edu/mailman/listinfo/freesurfer
-- Douglas N. Greve, Ph.D. MGH-NMR Center
greve at 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