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

Return to Slicer 3.6 Documentation

Gallery of New Features

Module Name


User Interface

General Information

Module Type & Category

Type: Interactive

Category: Registration

Authors, Collaborators & Contact

  • Author: Tom Vercauteren : Institut National de Recherche En Informatique Et En Automatique
  • Contributor: Hans J. Johnson : University of Iowa
  • Contributor2: Kent WIlliams : University of Iowa
  • Contact: Hans J. Johnson

Module Description

Overview of what the module does goes here.


BRAINSDemonWarp is a command line program for image registration by using different methods including Thirion and diffeomorphic demons algorithms. The function takes in a template image and a target image along with other optional parameters and registers the template image onto the target image. The resultant deformation fields and metric values can be written to a file. The program uses the Insight Toolkit ( for all the computations, and can operate on any of the image types supported by that library.

Use Cases, Examples

The inputs to the BrainDemonsWarp program are the target image, the template image and the optional parameters. These parameters define the arguments for histogram matching and multi resolution registration. The outputs are the deformation field, output image, checkerboard image of the output and the fixed image and the x,y,z displacement vectors. If we specify debug option we can get the outputs at different stages. The filter is templated over the input image type, real image type and the output image types. We implement the algorithm by parsing the input, preprocessing them and registering the processed images.

  1. Parsing - The images are initialized by the ValidationInputParser. This function reads in the arguments from the parameter file. It sets the histogram bins, match points, number of levels in the multi resolution registration, shrink factors and number of iterations at each levels. If the orientations of the images are different it sets the orientation of the moving image to that of the fixed image.
  2. PreProcessing - In the next step the DemonsPreProcessor preprocesses the images by resampling the template image to target image space. The intensity mismatch problem is solved by histogram matching the images. Histogram matching is done only if the command line option -e is set. ItkHistogramMatchingImageFilter is used to perform this function. Another important step in preprocessing is skull stripping. Skull stripping is done only if the command line option -maskProcessingMode is set to BOBF. We have written an itk filter, named itkBOBFFilter for this purpose. This filter takes in an input image and a whole brain mask and outputs a Brain Only Background Filled(BOBF) image. The non-brain parts in the image are filled with the user specified background value. All computations are performed in the precision of float data.
  3. Registration - The resulting moving Image and the fixed image are given as inputs to the demons registrator.It uses the MultiResolutionPDEDeformableRegistration filter with NN extrapolation as interpolator and implements the demons deformable algorithm by computing the deformation field which will map a moving image onto a fixed image. It is assumed that the vector elements behave like floating point scalars. Each vector in the deformation field represent the distance between a geometric point in the input space and a point in the output space. The output image is generated by warping the input image with the deformation field using the ItkWarpImageFilter. WarpImageFilter warps an existing image with respect to a given deformation field. Typically the mapped position does not correspond to an integer pixel position in the input image. Interpolation via an image function is used to compute values at non-integer positions. We have used the LinearInterpolateImageFunction for our application. To write the output image we cast the image to the user specified output pixel type.


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.