Affine Image Registration

Set up for affine registration by selecting the Affine tab:

Selecting affine registration

Setting the Degrees of Freedom

The setting of the "degrees of freedom" (DoF) determines the what types of change (distortion) may be made to the registered images to make them align with the fixed image. There are are four basic types of distortion that can be applied to the images:

  • Translation. You can permit or disallow separate translations (shifts) in the x (horizontal), y (vertical) and z (through-plane) directions.

  • Rotation. You can permit or disallow separate rotations about the x, y and z axes.

  • Scale. You can permit or disallow enlargement (scale > 1) or shrinkage (scale < 1) of the images in the x, y and z directions. A negative scale will cause the image to flip about an axis.

  • Shear. This causes a "trapezoidal" distortion of the image. For example, an xy shear causes a horizontal shift in the image that depends on the y-location. This is illustrated in the picture, where the an xy shear has been applied, and the original image is shown in green underneath.

    xyshear

To allow a particular degree of freedom, select the button next to that DoF. For example, to allow scaling in the y-direction, select:

dof_scale_y

The number to the right of the DoF (in this case, 1) is the initial setting for that degree of freedom: when the registration is performed, the search procedure starts looking for the best registration parameters using the values you set in here. If you have not allowed the DoF, then the number cannot be changed, and is ignored.

To reset any changes back to the Identity transform (no distortion), click on the reset_transform_button button.

Above the Degrees of Freedom are the "Presets" buttons, that set up to allow particular types of distortion. Click one of these buttons to allow:

  • translation_only_button For intra-subject registration where there are no rotational differences between the scans.
  • rotation_only_button For intra-subject registration where there are no translational differences between the scans (not generally useful).
  • rigid_body_button For intra-subject registration where there are translational and rotational differences that need to be corrected. No shape distorting changes are allowed.
  • rigid_body_scale_button For inter-subject registration where the quality of data does not allow full Affine registration to be used robustly. Size changes are allowed.
  • full_affine_button For inter-subject registration with the full range of linear distortions allowed.

Remember, the more types of distortion (degrees of freedom) are allowed, the slower will be the registration process and the more chances there are for the registration procedure to go wrong and produce unexpected results when trying to register "difficult" images. Only use as many degrees of freedom as are demanded by the problem.

Other Settings

There are several user settings for registration:

  • Select to initialise the registration by matching centres-of-gravity Select this if you want to initialise any translation component of the registration by aligning the centre-of-gravity of the moving image to that of the fixed image. If selected, any initial values you set for the translation components are ignored.

  • Select to initialise the registration by matching principal axes Select this if you want to initialise any rotation component of the registration by aligning the principal axes of the moving image to those of the fixed image. If selected, any initial values you set for the rotation components are ignored.

  • Select to rescale the registered image intensities to match the fixed image Select this option if you want the intensities of the registered image to match, as closely as possible, those of the fixed image after registration. If selected, a simple linear rescaling of intensities is performed.

  • Select to set limits on the degrees-of-freedom Clicking this button brings up a dialog to set limits on the magnitude of the distortions allowed during the registration procedure:

    Dialog to set limits in the magnitude of the registration distortions

    To place limits on a particular degree-of-freedom, select the appropriate check-box and then set the maximum allowed distortion. For example, setting Limiting the range of x-translations for registration will (soft) limit the x-translation to be within 10% of the field-of-view. This can be useful if you know that the images to be registered are already in fairly good alignment, or you set the initial transform to bring them fairly close to alignment. Then, there is less chance of the registration algorithm going badly wrong, and resulting in a bad registration.

    When you have set or removed limits, press the OK button button.

    Note: when limits are in effect, the button to set the limits changes to look like this: Select to set limits on the degrees-of-freedom - when limits are in place.

    Note: these limits will apply to all future affine registrations until they are changed.

  • Cost function. You can choose:

    • Normalised correlation. This is the cross-correlation of the fixed image and registered image, normalised by dividing by the RMS intensities of both images. This cost function works best for aligning images that have very similar tissue intensity signatures, for example images acquired using the same modality/pulse sequence of the same subject at different times.
    • Correlation ratio. The correlation ratio should work well for multi-modal image registration, or MR images acquired with different pulse sequences.
    • RMS difference. The root mean square difference between the fixed image and registered image is minimised. This option works best when the two images are collected with the same modality, and have similar contrast and intensity ranges.
    • Mutual information. The "mutual information" of the joint 2-D histogram of image intensities is maximised. This option is the best choice when the two images are collected with different modalities, or have different contrasts.
  • Create half-way co-registered image. When selected, registered versions of both the moving image and the fixed image are created at the mid-point between the two. The names of the two half-way images will have the prefix "hw" prepended to their original names.

  • Fixed image mask. The standard masking options are available to select pixels in the fixed image that are used to compute the cost function. This can be useful for removing background noise, or removing portions of the image where alignment is not important (such as soft tissue, when registering brains).

  • register_multi_resolution If this option is selected, the fixed and registered images are sub-sampled to rapidly estimate an approximate registration at low resolution, before successively increasing the resolution to obtain more accurate registration. This option is strongly recommended unless you already know that the two images are in reasonably good alignment.

  • Fractional tolerance. The fractional tolerance for convergence: when fractional changes in the cost function are less than the tolerance, then the iterative registration will be deemed to have converged. If registration is taking inordinately long, try increasing this value. If registration stops before the images are accurately registered, try reducing this value.

  • Do a final registration set using linear interpolation to get sub-pixel accuracy When this option is selected, a final registration is done using linear interpolation. Normally, nearest-neighbour interpolation is used since it is considerably quicker. However, to get sub-pixel accuracy, you need to select this option.

  • Final interpolation. Select the type of interpolation to be used when producing the (registered) output images. Choosing Sinc will result in improved image quality, but at the expense of slightly longer processing time for this last processing step. Resampling a large image with sinc interpolation may take a few seconds.

Select the fixed image by clicking on the open icon, or by typing in the folder (directory) and file name of the image, or by pressing the right mouse button and selecting from the menu of recently-used images.

Selecting the fixed image

Next, select the images that you want to register to the fixed image by clicking on the select_images_button button. This will bring up a file chooser. Select one or more images to register in the file chooser, and press the Select button. You can add more images to this list by pressing the add_images_button button. Ensure that the images are in the order in which you want them to be processed. If they are not in the right order, select one or more images in the displayed list to move, and the click either the move_up_button button or move_down_button button to get them in the right order.

You can remove all the images from the list by clicking the remove_all_button button, or remove just some of the images by first selecting them, and then clicking the remove_selected_button button.

Now click on the Button to do the registration button to perform the registration. Registration will take several minutes for each of the images, during which time various progress indicators will pop up, allowing you to cancel the registration at any stage. If registration completes, the registered images will be produced.

The registered images have the same numbers of rows, columns and slices as the fixed image, but will have pixel intensity values taken from the registered images after they have been re-aligned to match the position of the fixed image. The registered image are automatically given a name which is the same as the input images, but with the letter "r" prepended to the name. For example, if you chose an image to be registered with a name MyImage, the registered image will be given the name rMyImage.

Viewing the Result

If you want to check on the quality of the registration, the best way is to load the fixed image into Jim's main display window. Then, load the registered image as an overlay image. You can automatically get Jim to load the registered image to the overlay by selecting the Load result button load_save. With this selected, as each registered image is produced, it is overlaid onto the image in Jim's main display.

Note: you must have the fixed image loaded into Jim's main display for this feature to work.