Coregistration HOWTO

How-Tos - Coregistration

How do I...


Do coregistration in SPM?

Number of subjects: 1

Which option? Options: coregister only, reslice only, coregister & reslice.

Select coregister only. "Reslice only" will take a single image with a .mat file as input and create a new rV .img file that incorporates the transformations specified in the .mat file directly into the image, so the new rV.img doesn't have a .mat file but has had its actual voxels moved around instead. Reslicing isn't perfect, though - it introduces slight interpolation errors - so don't do it more often than necessary. You shouldn't need to re-slice your anatomical file if you're only using it to get good normalization estimates, or as a background image for displaying functional activation. "Coregister and reslice" will do both steps at once - coregister two images and reslice the source image to make a new, lined-up rV.img file.

(These following questions about modality are in SPM99 only - SPM2 coregistration is by mutual information (see CoregistrationFaq) and so the modality isn't important and it doesn't ask).

Modality of first target image?

Select EPI. The target image is the one to which you coregister. EPI is the generic option for functional MRI images - it can be selected for both echo-planar and spiral images.

Modality of first object image?

Select T1 MRI, probably. The object image is the one which is being coregistered. Select object - T1 MRI if the structural image looks dark where gray matter should be and bright where white matter should be. If the structural images has the opposite contrast (bright where gray matter should be and dark where white matter should be), it is probably object - T2 MRI, so select appropriately.

Select target image for subject 1: Select the mean image created by realignment (see RealignmentHowTos): session1/mean*V001.img, DONE

Select source image (in SPM2)/ object image (in SPM99) for subject 1: Select the the inplane anatomical image : anatomy/inplane/V001.img, DONE

Select other images for subject 1: DONE (do not select any images). If any images are selected as "other", the tranformation parameters estimated to coregister the object to the target image will also be applied to the "other" images.

The coregistration will now run, which should only take a few minutes, maybe less. This step will find the transformation that maps the anatomical inplane image into the space of the functional images (as defined by the mean image). A new anatomy/inplane/V001.mat image will be created (although it is not yet applied - no reslice image is created).

Check my coregistration in SPM?

Use the "Check Reg" button in the main SPM interface. You can use this to display up to 15 images at once and compare all their joint registration; we'll describe here using it for two images, say, immediately after you've coregistered your inplane anatomy and your mean functional image.

Select two images: session1/mean*V001.img, anatomy/inplane/V001.img, DONE.

This will display the two images, with the mean image in the top half and the implane at the bottom. The better the images' outlines coincide (check that by moving the cursor on the outlines) the better coregistered they are.

Figure out which is my "source" and which is my "target" image in SPM2?

Your "target" image is the one which holds still. It's the one that you want to coregister to. In the standard Gablab SPM preprocessing protocol, this is your mean functional image after realignment. The "source" image is what was called the "object" image in SPM99 - it's the image that is moved to line up with the target image. In the picturesque words of John Ashburner, the source/object is the one that's "jiggled about" to fit the target image. Another way of remembering this is that the "target" image is what you're trying to get to, while the source/object image is the one that has transformations applied to it.

Fix a bad coregistration?

First, a note for SPM99ers - if you have a bad coregistration with the standard defaults, try running it again by using mutual information coregistration. You can do this by first deleting any previous .mat files for your source/object image, then starting SPM, hitting "Defaults," choosing "Coregistration," and then choosing "Use Mutual Information Coregistration." Now run coregistration again.

For the rest of us...

If the automated methods fail, you may have to tweak a bad coregistration by hand. Often, if the automated coregistration fails badly, a good way to go is by getting the two images "pretty close" to in line by hand, and then re-running the coregistration program. This would fix the case where the program has bad starting estimates - they may start far apart from each other or just have something funny about how they started, and by lining them up differently before you start the automated program, you can improve the final estimates from the program. Other times, there may just be something strange about the brains in question, and the automated coregistration can fail no matter how close they start out. In that case, your best bet is to adjust by hand the whole way.

The adjusting by hand is handled by different programs in different packages - 3dNudge in AFNI, the "Display" button in SPM. The idea is the same, though, so you can use the SPM directions for reference.

Start SPM and hit the "Display" button. Choose your source image to display - the one you want to move around to fit the other one. It's often helpful to have the target image simultaneously displayed in another copy of SPM, if you can. The Display interface has a panel in the lower left where you can make translations, rotations, and zooms in all three dimensions. By hand, starting with small movements, try and adjust the numbers in there to best line up the source image with your target image. When you've made a movement you want to save, hit the "Reorient images..." button in the lower-left. Choose the source image.

This will save the movements you've made in the .mat file associated with that image. Any time you save a movement, it adds onto the current .mat file - the file isn't overwritten, even though the numbers in the movement panel may reset. When you think you have the image close, save your current movements with "Reorient images" and use SPM's "Check Reg" button to compare the source and target images side-by-side. If they're not as close as you like, go back to the "Display" function and keep tweaking.

When the images are aligned as well as you'd like, you don't have to do anything more - the movements are saved already in the .mat file. If you want to apply that .mat file to the actual .img file, you can choose "Coregister" from SPM and choose the "reslice only" option - this will create a new rV .img file that doesn't have a .mat file but will be properly aligned.


CategoryHowTos