Print

Print


Dear John

For teaching purposes I would like an easy way of visualising the deformation field. I find it useful look at the y_*.nii image using spm_check_registration and look at the Y value as a function of the coordinate, but out of the box this only works for the x dimension. Is there a way to access the fifth dimension via spm_select, spm_vol, spm_vol_nifti or spm_read_vols, or can the values only be accessed via the nifti function?

Best regards
Torben 






Torben Ellegaard Lund
Associate Professor, PhD
Center of Functionally Integrative Neuroscience (CFIN)
Aarhus University
Aarhus University Hospital
Building 10G, 5th floor, room 31
Noerrebrogade 44
8000 Aarhus C
Denmark
Phone: +45 7846 4380
Fax: +45 7846 4400
http://www.cfin.au.dk
[log in to unmask]
[log in to unmask]



> Den 10/07/2015 kl. 19.29 skrev John Ashburner <[log in to unmask]>:
> 
> The segmentation/spatial normalisation in SPM12 uses a different format for writing out deformation fields. They are now saved as vector fields, represented by a 5D image (where the 4th dimension has 1 element - as this dimension is really supposed to encode time - and the 5 th dimension has 3 elements).
> If you have the deformation field as a y_*.nii, you can read the vector of 3 values at the spatial coordinate of interest. This gives coordinates in mm, which can then be converted to voxel indices by multiplying with the inverse of the voxel to world mapping from the image header.
> Best regards,
> John
> 
> 
> Rita Elena Loiotile <[log in to unmask]> wrote:
> Hi,
> 
> I have played around with this function a bit and have a more directed question that hopefully someone can answer.
> 
> spm_get_orig_coord.m seems to use the following variables from subject_seg_sn.mat: VG, Affine, Tr, and VF.  For the new "Segment" implemented in SPM12, subject_seg8.mat has the following roughly analogous looking variables: tpm, Affine, Twarp, image.  
> However, when I rewrite spm_get_orig_coord.m to take the subject_seg8.mat, substituting the variables, it produces an output that's definitely incorrect.  Does anyone know of the relevant variables in subject_seg8.mat that would allow me to make the correct substitutions?
> 
> Alternatively, I could do the following to get the voxel coords from an MNI-normed VOI: make the inverse transformation matrix in Segment, apply the inverse transform to the VOI.nii, find the center of mass of the transformed wVOI.nii, preferably in voxel coords (not sure how to do this last step in SPM).
> 
> Thanks in advance.  Apologies for the multiple emails about this but I'm a bit stuck.  
> 
> On Wed, Jun 24, 2015 at 6:29 PM, Rita Elena Loiotile <[log in to unmask] <mailto:[log in to unmask]>> wrote:
> As suggested in Kiebel et al., I'm trying to use this to get the original z-coordinates for my warped images, so that I can calculate the VOI-timing differences for DCM analysis. 
> However, spm_get_orig_coord.m requires a forward deformation *sn.mat file. I am using SPM12 Segment which only produces a y*.nii and a *seg8.mat.  I looked into the latter file in hopes that I could write a wrapper script, but I can't figure out whether the information I need is stored there.  (I know the lack of a *sn.mat file is a somewhat frequent question in the archives, but I couldn't find any email that explained how I could extract the info i need from either the y*.nii or *seg8.mat.) 
> 
> Does anyone have any suggestions?
> 
> Thanks,
> Rita 
>