June 03, 2010

SPM2 Gem 5: Normalizing [x y z]

An off-list email reports how to find the point in an normalized image that corresponds to a given un-normalized location. See also Un-normalizing a point.

From: John Ashburner <john@fil.ion.ucl.ac.uk>
To: Christophe Phillips <c.phillips@ulg.ac.be>
Subject: Re: Coordinates transform
Date: Wed, 4 Feb 2004 17:26:21 +0000


Hi Christophe,

> I've the coordinates [x y z] of a point (actually the location of a
> fitted current dipole) in an image 'img1'. This image was normalised
> into 'w_img1'. I'd like to have the dipoles coordinates [x y z]_w in
> the normalised image...
> 
> Do you have a routine that can do that easily from the 'img1_sn.mat'
> file ? 

The deformations in the sn.mat files map from points in normalised
space, to points in un-normalised space.  You therefore need to invert
them, which is a bit messy.  You would use the Deformations toolbox
for this (from the Toolbox pulldown).  First write out the deformation
field from the sn.mat.  Then call the Deformations toolbox again, and
choose the deformations inversion option.  This will be an iy*.img
file with three volumes.  This little script can then be used.

c = [x y z]'; % co-ordinates in mm (as shown by Display)
P = spm_get(1,'iy*.img','Select inverted warp');
P = [repmat(P,3,1) [',1';',2';',3']];
V = spm_vol(P);

vx = inv(V(1).mat)*[c ; 1];  % The voxel in the deformation to sample

w_coord = [...
     spm_sample_vol(V(1),vx(1),vx(2),vx(3),1)
     spm_sample_vol(V(2),vx(1),vx(2),vx(3),1)
     spm_sample_vol(V(3),vx(1),vx(2),vx(3),1)]

I haven't tested it, so there may be things to fix.


All the best,
-John


- No comments Not publicly viewable


Add a comment

You are not allowed to comment on this entry as it has restricted commenting permissions.

Search this blog

Tags

Most recent comments

  • I love this quote: "Complete reporting of results, i.e. filing of statistical maps in public reposit… by Kevin Black on this entry
  • Taylor: I've just quickly scanned the BrainVoyager documentation, and it appears that the Cluster–Le… by Thomas Nichols on this entry
  • Cindy, I can see you didn't like my comments but I didn't get based on what you deemed them outrageo… by Yolanda on this entry
  • Thomas, Could you comment on the applicability of your findings to BrainVoyager's Cluster–Level Stat… by Taylor on this entry
  • Here is a sample of recent corrections from PNAS, collated by Mike Angstadt. Correction for Crockett… by Thomas Nichols on this entry

Blog archive

Loading…
Not signed in
Sign in

Powered by BlogBuilder
© MMXXI