Print

Print


I was able to answer my own questions. Changing the warping regularization to a value below 1 allows a lot of displacement, on the order of 2.5mm. Second, when I lowered the regularization value, I was able to see that the y_ images actually contain some information! The first few times I looked at the file, all I could see were smooth gradients, and I couldn't understand how the displacement could come out of the file, but now I see how it does.
-Greg

On 8/6/2010 2:16 PM, John Ashburner wrote:
        Is it possible to calculate the change that occurs when warping
        one volume to another using HDW? Specifically, if I know the
        position of 1 voxel in the template image, is it possible to
        determine where that voxel *was* in the target image before
        warping? Or is this kind of information better found using
        DARTEL.

Both DARTEL and HDW produce deformation fields (y_*.img/nii), which
encode the mapping from one image to the other.

        I'm attempting to interpret the output from high dimensional
        warping. If I warp image B to fit image A and it then writes out
        y_ and jy_ files for image B. My question is if B' is the warped
        image (consisting of y_ and jy_ files) and B is the unwarped
        image... if I have a point (x,y,z) in image B', how can I find
        the location of the unwarped point in B?

When you do this, you have a mapping from A to B, because generating a
warped version of B requires the values of B to be sampled at the
appropriate place.  This mapping is encoded by the y_* file.

This y_*.img/nii file has dimensions xdim x ydim x zdim x 1 x 3, which
means that only the first of the three volumes in the file can be easily
viewed using the Display button.  The dimensions and orientation of the
file correspond to those of image A.  If you want to know where voxel
i,j,k of A correspons to, then you can do it by:

Ny=nifti('y_blah.nii');
mm = squeeze(Ny.dat(i,j,k,1,:))

The answer it gives is in a mm coordinate system.  To figure out which
voxel indices of B this actually corresponds with, you need to use the
matrix in the header of B.

Nb = nifti('B.nii');
Mb = inv(Nb.mat);

vox_b = Mb(1:3,:)*[mm; 1]


The reason that it is done this way is that another image (say C) may be
coregistered with B, but may be stored in different orientations or have
different voxel sizes etc.  Providing B is well aligned with the other
image, then you can derive the appropriate voxel in it using a similar
scheme.

Nc = nifti('C.nii');
Mc = inv(Nc.mat);

vox_c = Mc(1:3,:)*[mm; 1]


Best regards,
-John