From Slicer Wiki
Jump to: navigation, search
Home < Modules:BRAINSFit

Return to Slicer 3.6 Documentation

Gallery of New Features

Module Name


User Interface

General Information

Module Type & Category

Type: CLI

Category: Registration

Authors, Collaborators & Contact

  • Author1: Hans Johnson, University of Iowa
  • Contributor1: Kent WIlliams, University of Iowa
  • Contact: Hans Johnson, hans-johson at

Module Description

BRAINSFit is a program for mutual information registration of brain imaging data using ITK classes. It is based on an example program included in the ITK distribution,

Insight/Examples/Registration/ImageRegistration8.cxx This program is the most functional example of multi-modal 3D rigid image registration provided with ITK. ImageRegistration8 is in the Examples directory, and also sec. 8.5.3 in the ITK manual. We have modified and extended this example in several ways:

  • defined a new ITK Transform class, based on itkScaleSkewVersor3DTransform which has 3 dimensions of scale but no skew aspect.
  • implemented a set of functions to convert between Versor Transforms and the general itk::AffineTransform and deferred converting from specific to more general representations to preserve transform information specificity as long as possible. Our Rigid transform is the narrowest, a Versor rotation plus separate translation.
  • Added a template class itkMultiModal3DMutualRegistrationHelper which is templated over the type of ITK transform generated, and the optimizer used.
  • Added image masks as an optional input to the Registration algorithm, limiting the volume considered during registration to voxels within the brain.
  • Added image mask generation as an optional input to the Registration algorithm when meaningful masks such as for whole brain are not available, allowing the fit to at least be focused on whole head tissue.
  • Added the ability to use one transform result, such as the Rigid transform, to initialize a more adaptive transform
  • Defined the command line parameters using tools from the Slicer [ 3] program, in order to conform to the Slicer3 Execution model.

Added the ability to write output images in any ITK-supported scalar image format.

  • Through extensive testing as part of the BRAINS2 application suite, determined reasonable defaults for registration algorithm parameters.


The BRAINSFit distribution contains a directory named TestData, which contains two example images. The first, test.nii.gz is a NIfTI format image volume, which is used the input for the CTest-managed regression test program. The program makexfrmedImage.cxx, included in the BRAINSFit distribution was used to generate test2.nii.gz, by scaling, rotating and translating test.nii.gz. You can see representative Sagittal slices of test.nii.gz (in this case, the fixed image, test2.nii.gz (the moving image), and the two images ’checkerboarded’ together to the right. To register test2.nii.gz to test.nii.gz, you can use the following command:

BRAINSFit --fixedVolume test.nii.gz \
--movingVolume test2.nii.gz \
--outputVolume registered.nii.gz \
--transformType Affine

A representative slice of the registered results image registered.nii.gz is to the right. You can see from the Checkerboard of the Fixed and Registered images that the fit is quite good with Affine transform-based registration. The blurring of the registered images is a consequence of the initial scaling used in generating the moving image from the fixed image, compounded by the interpolation necessitated by the transform operation.

You can see the differences in results if you re-run BRAINSFit using Rigid, ScaleVersor3D, or ScaleSkewVersor3D as the ----transformType parameter. In this case, the authors judged Affine the best method for registering these particular two images; in the BRAINS2 automated processing pipeline, Rigid usually works well for registering research scans.

Use Cases, Examples

This module is especially appropriate for these use cases:

  • Use Case 1:
  • Use Case 2:

Examples of the module in use:

  • Example 1
  • Example 2


Links to tutorials explaining how to use this module:

  • Tutorial 1
    • Data Set 1

Quick Tour of Features and Use

A list panels in the interface, their features, what they mean, and how to use them. For instance:

  • Input panel:
    • First input
    • Second input
  • Parameters panel:
    • First parameter
    • Second parameter
  • Output panel:
    • First output
    • Second output
  • Viewing panel:
User Interface


Notes from the Developer(s)

Algorithms used, library classes depended upon, use cases, etc.


Other modules or packages that are required for this module's use.


On the Dashboard, these tests verify that the module is working on various platforms:

Known bugs

Links to known bugs in the Slicer3 bug tracker

Usability issues

Follow this link to the Slicer3 bug tracker. Please select the usability issue category when browsing or contributing.

Source code & documentation

Links to the module's source code:

Source code:

Doxygen documentation:

More Information


Include funding and other support here.


Publications related to this module go here. Links to pdfs would be useful.