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 To: Christophe Phillips 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