Print

Print


Dear Annchen

If an image has been reoriented but not resliced you can find the applied transformationmatrix by first creating a V structure using V=spm_vol(spm_select) and select the respective image. V has two fields of interest in this context: V.mat is a matrix is a mapping from the voxel coordinate system to the current one, where as V.private.mat0 is a mapping from the  voxel coordinate system to the coordinate system the image was originally in (that is before the reorientation). The matrix you are intersted in let’s call it reorientmatrix can be found by:

reoirentmatrix=V.mat/V.private.mat0 

which corresponds to:

reoirentmatrix=V.mat*inv(V.mat0)

Now write out V.mat considering that it is a matrix that first maps from voxelspace to the original coordinate system and then to the new reoriented coordinatesystem:

reoirentmatrix=reoirentmatrix*V.mat0*inv(V.mat0)

I have attached a figure with a similar example (here the original coordinate system was the scanner coordinate system and  the reoriented space was the ACPC coordinate system).



Best
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 19/11/2014 kl. 20.20 skrev Annchen Knodt <[log in to unmask]>:
> 
> 
> Hi SPMers,
> 
> As part of my lab’s workflow, we frequently use the “Reorient images…” button in SPM’s display window to manually tweak the orientation of the brain and put the origin at the anterior commissure.  We do this by displaying the anatomical that's coplanar with our functionals and then selecting that image as well as all of our functionals for the “Images to reorient”.  Sometimes it happens that we’ll inadvertently leave out some of the functional images or for whatever reason need to use the same parameters on a large batch of images after the fact, so I’m wondering if there’s a way to get the reorientation parameters that were applied to the images that have been reoriented, ie the values for right,forward,up,pitch,roll,yaw in the Display window, so that they can be applied to other images.  I know I can get an affine matrix from those 6 parameters to use with the Reorient Images batch util, but I just can’t figure out how to get a proper matrix or those parameters from any info I can dig up from the image files (e.g. the mat field of the struct output by the spm_vol function).
> 
> Any help is appreciated, thanks!
> 
> Annchen
> 
> 
> ~~~~~~~~~~~~
> Annchen Knodt, M.S.
> Research Analyst
> Laboratory of NeuroGenetics
> 919.684.0277
> Duke University
> 
> 
> 
> 
> 
> 
> 
>