There are several "RAS" coordinates in tkmedit. One is scanner coords (vol2ras), the other is "volume RAS" coordinates (tkrvox2ras). doug
On 12/18/12 11:31 PM, octavian lie wrote:
Dear Douglas, yes, it matches the T1. I am interested though in matching the volume RAS as it appears in tkmedit, so I changed the code to use tkrvox2ras instead of vox2ras0. Thank you, octavian.
On Tue, Dec 18, 2012 at 10:23 PM, Douglas Greve <greve@nmr.mgh.harvard.edu mailto:greve@nmr.mgh.harvard.edu> wrote:
That code looks correct. It should match the scanner coordinates. Does the volume geometry (ie, vox2ras) in the labelMRI.mgz file match that of the orig.mgz/T1.mgz? doug On 12/18/12 6:10 PM, octavian lie wrote:Dear Douglas, I adapted the following script to get the RAS coordinates: segmri = MRIread(labelMRI.mgz); %labelMRI is the input resection volume .mgz segid =1; % Get list of voxels with seg id indlab = find(segmri.vol == segid); nlab = length(indlab); % Convert indices to row, col, slice [r c s] = ind2sub(segmri.volsize,indlab); crs = [c r s]' - 1 ; % 0-based crs = [crs; ones(1,nlab)]; % Convert row, col, slice to XYZ xyz1 = segmri.vox2ras0 * crs; xyz = xyz1(1:3,:)'; inspecting the xyz matrix, copying individual RAS coordinates from xyz to tkmedit volume RAS field, and noting the RAS coordinates of the boundaries in the R,A,S, directions, it looks like x and y/ R and A are ok, but the S/z is off, closer in nos with the volume scanner coordinates. I could not figure out why this is. I mention that the labelMRI.mgz was generated by using mri_convert on a labelMRI.nii mask file imported from itksnap without additional flags. Please advise, I also mention that the labelMRI.mgz file aligns well in tkmedit with the patient's T1.mgz. Below I paste the mri_info on labelMRI.mgz type: MGH dimensions: 256 x 256 x 256 voxel sizes: 1.0000, 1.0000, 1.0000 type: FLOAT (3) fov: 256.000 dof: 0 xstart: -128.0, xend: 128.0 ystart: -128.0, yend: 128.0 zstart: -128.0, zend: 128.0 TR: 0.00 msec, TE: 0.00 msec, TI: 0.00 msec, flip angle: 0.00 degrees nframes: 1 PhEncDir: UNKNOWN ras xform present xform info: x_r = -1.0000, y_r = -0.0000, z_r = -0.0000, c_r = -0.2196 : x_a = -0.0000, y_a = 0.0000, z_a = 1.0000, c_a = 1.9029 : x_s = 0.0000, y_s = -1.0000, z_s = 0.0000, c_s = 28.2156 talairach xfm : Orientation : LIA Primary Slice Direction: coronal voxel to ras transform: -1.0000 -0.0000 -0.0000 127.7804 -0.0000 0.0000 1.0000 -126.0971 0.0000 -1.0000 0.0000 156.2156 0.0000 0.0000 0.0000 1.0000 voxel-to-ras determinant -1 ras to voxel transform: -1.0000 0.0000 0.0000 127.7804 -0.0000 -0.0000 -1.0000 156.2156 -0.0000 1.0000 -0.0000 126.0971 0.0000 0.0000 0.0000 1.0000 Thank you very much, Octavian.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.
freesurfer@nmr.mgh.harvard.edu