SPM99 Gem 7: Reorienting images

Subject: Re: AC-PC positions
From: John Ashburner 
Date: Fri, 27 Oct 2000 15:00:05 +0100 (BST)
To: spm@mailbase.ac.uk, spm@fil.ion.ucl.ac.uk


The best that I can suggest is you try manually reorienting your
images via the <Display&gt button.  Try different rotations and
translations until the image is displayed how you want it.  The
attached Matlab function can then be used for reslicing the image(s)
in the transverse orientation, with 1mm isotropic resolution.

Best regards,

Attached file: .reorient.m~
Error in c matrix fixed, June 6, 2001 -TEN

Subsequently, John offered modifications to use the native voxel size, which have been incorporated…

See also SPM5 Gem2 & Gem3

Subject: Re: reorient.m
From: John Ashburner 
Date: Thu, 14 Dec 2000 17:04:38 +0000

| I would like to reorient some images in two ways,
| using the usefull function reorient() of John Ashburner.
|   - first is to keep the voxel size intact,
| but still reorienting in the transverse plane

Without testing the code, and without too much thought, I think
the modification to do this is involves something like changing from:
        mat = spm_matrix([mn-1]);
        dim = (mat\[mx 1]')';
to something like:
        vox = spm_imatrix(V.mat);
        vox = vox(7:9);
        mat = spm_matrix([0 0 0  0 0 0  vox])*spm_matrix([mn-1]);
        dim = (mat\[mx 1]')';

|   - second is to reorient in the coronal plane,
|     with 1x1x1 mm resol.

I think this is involves something like changing from:
        mat = spm_matrix([mn-1]);
to something like:
        mat = spm_matrix([0 0 0 pi/2])*spm_matrix([mn-1]);
or maybe:
        mat = spm_matrix([0 0 0 -pi/2])*spm_matrix([mn-1]);

| In the two cases, the final image should have no .mat file
| and be resliced using sinc ...

To reslice using sinc interpolation, you change from:
                img = spm_slice_vol(V,M,dim(1:2),1);
to something like:
                img = spm_slice_vol(V,M,dim(1:2),-6);

I hopehese suggestions work.
Best regards,

If you want to set arbitrary voxel size, just setvoxas desired in the fix above, but then be sure to forcedimto be an integer.

For example, I wanted to increase the resolution of my images by a factor of three, so I did

        vox = spm_imatrix(V.mat);
        vox = vox(7:9)/3;
        mat = spm_matrix([0 0 0  0 0 0  vox])*spm_matrix([mn-1]);
        dim = ceil(mat\[mx 1]')');

One thought on “SPM99 Gem 7: Reorienting images

  1. Pingback: SPM5 Gem 2: Reslicing images | NISOx Blog

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s