Print

Print


> I'm using DARTEL to normalize my functional images. For that purpose,
> I transform the results to MNI space.
>
> Now I have a peak activation in my group results and would like to
> know approximately where the coordinate lies in individual functional
> space. This was quite simple in unified segmentation, but it seems to
> involve too many transformations to carry this out in a good way using
> DARTEL.

Projecting MNI-space results back on to the original subject's scan
seems to be getting popular.  I'll try to make this much easier to do
in the next SPM release.


>
> I used affine transformation to transform the coordinate from MNI to
> template space, then I was planning to continue to create an image
> with that one point and transform that back, but now I realize how
> many transformations it would be:
> MNI -> Template -> individual anatomical (size like template) ->
> individual anatomical -> functional.

It should be a bit simpler than this.  The way that deformation fields
are stored (as y_*.nii files) involves a mapping from voxels in one
image (eg the template) to mm coordinates (eg in the subject).  To get
from mm to voxels in some image, you just need to multiply these
coordinates by the inverse of the voxel-to-world mapping in the header
of that image.  This mapping should work for all (accurately)
coregistered images from a particular subject.  This eliminates the
"individual anatomical -> functional" part of the chain.

 The "individual anatomical (size like template) -> individual
anatomical" part should automatically be dealt with by the software.
This can be achieved because the "imported" data (size like template)
also encodes how to map to individual space.

This just leaves "MNI -> Template -> functional".

Obtaining a mapping from "Template -> functional" may be achieved by
generating a deformation field from the Dartel flow field.  This can
be done via the Deformations Utility:

Composition
. DARTEL flow
. . Flow Field      select the u_*.nii file
. . Forward/Backward    Backward
. . Time Steps     64
Save as      whatever you'd like to call it.
Apply to      nothing needed
etc


The rest will need a bit of MATLAB code....


mni = [x y z]; % Your MNI coordinate

P = ['y_blah.nii,1,1'; 'y_blah.nii,1,2'; 'y_blah.nii,1,3']; % The deformation
V = spm_vol(P);

% I'll assume that you have a Template_6_2mni.mat, which you should have
% if you used the normalise to MNI space option of a recent update of SPM8.

tmp = load('Template_6_2mni.mat');
M1 = tmp.mni.affine; % Mapping from voxels in Template to MNI space
vox = M1\[tal'; 1];

mm = [...
        spm_sample_vol(V(1),vox(1),vox(2),vox(3),1)...
        spm_sample_vol(V(2),vox(1),vox(2),vox(3),1)...
        spm_sample_vol(V(3),vox(1),vox(2),vox(3),1)]



You can use Display, and move the cursor to this mm coordinate to
figure out the appropriate location.


>
> Is there any good way to do this transformation more directly, without
> using the step of creating an image in between? Maybe some code
> snippets I could use or a hint which lines of code carry out the
> inverse warping?

I hope the stuff above works OK for you.  As I haven't thoroughly
tested it, I'd suggest checking it with a few coordinates to make sure
its OK.  The entire risk as
to the quality and performance of the code snippets is with you
(trying to cover my back in case anyone intends to use the snippet for
pre-surgical planning etc).

Best regards,
-John