Documentation:Nightly:Registration:RegistrationLibrary:RegLib C46

From Slicer Wiki
Jump to: navigation, search
Home < Documentation:Nightly:Registration:RegistrationLibrary:RegLib C46

Back to Registration Library

Slicer Registration Library Case #46: 2D Cine MRI of Breathing Cycle


this is the fixed reference image. All images are aligned into this space lleft this is the time series of 2D images to be registered with the reference
fixed image/target moving image


We seek to study the motion of the lung during a breathing cycle by co-registering all of the images in a sequence with a reference, and then extract the motion from the registration displacement field.

Modules Used

Download (from NAMIC MIDAS)

Note that the main registration processing for this case is done in batch mode via a shell script, and not in the main GUI. The mrb file below therefore includes only 2 out of the 200 frames of the whole series to illustrate the concept. To get the full dataset including solutions and script, download the zip file.

  • RegLib_C46.mrb
    (input data, reference + 1 slice only, Slicer mrb file. 0.6 MB)
    (input data + results, zip file with original DICOM + registration script. 65 MB).


MRI, lung, 2D, time-series, cine, deformation modeling


  • Phase I: run a pilot registration to determine optimal registration parameters
  1. load reference image and one moving image from the series
  2. open the General Registration (BRAINS) module
    1. set "ref_lung" as fixed and "moving_??" as moving image
      1. Slicer BSpline Transform (create new transform, rename to: "Xf1_BSpline" or similar
      2. Output Image Volume create and rename new Volume, rename to "Moving_Xf1"
    2. Initialization transform: none
    3. Initialization transform mode: off
    4. Registration Phases: select/check BSpline only
    5. select/check Include BSpline registration phase
    6. B-Spline Grid Size: type "5,5,3" (note: even though we have a 2D image, we must select a grid size of at least 3 in the z-direction. But displacements will all be zero in that direction)
    7. Leave all other settings at default
    8. click: Apply
    9. adjust grid size until registration is acceptable
    10. you can see the commandline text of the registration performed by opening the Window/Error Log window and clicking on BRAINSfit commandline input. This will show you how the text in the script should look like to replicate the registration in batch mode
  • Phase II: Batch Run
  1. check the provided bash shell script ("")
  2. via a TextEditor, modify the script to match your parameters. The default script looks like this:
 export SLICER4CLI=/Applications/
 for aFile in "$@"
   echo "registering $1 <-- $aFile via $aMovingXForm --> $aMovingReg"
   ${SLICER4CLI}/BRAINSFit --fixedVolume $1 --movingVolume $aFile --outputVolume $aMovingReg --bsplineTransform $aMovingXForm --useBSpline --splineGridSize 5,5,3 --numberOfIterations 1500
  1. replace the SLICER4CLI variable with your path to the Slicer application (shown is typical for MacOS)
  2. This script expects as the 1st argument the reference image "ref_lung" and all the moving images as subsequent arguments. Note that because we have DICOM images as input, each slice needs to be in a separate directory to be interpreted as separate images (by default, Slicer will interpret multiple DICOM files in the same directory as slices of a single image).
  3. open a terminal window
  4. call the script via (assuming directories are called "Reference" and "Moving_001" etc. :
 ./ Reference/refLung_001.dcm Moving/*/*.dcm 
  1. the script will write result transforms and images into the same moving directories
  • Phase III: Evaluate Transform files
    1. upon completion, read the transform files with an editor or prototyping platform (e.g. Matlab) and extract the displacements of interest
    2. The ITK transform files describe displacements at the grid nodes, many of which are outside the region of interest. Because BRAINSfit pads the grid with 1 voxel, the grid returned is actually 8x8x8. We use only the plane (*,*,4) for analysis and discard the y-direction displacements, which as expected are all zero.
    3. for details on the ITK transform format see the FAQ here
    4. To obtain displacements at arbitrary coordinates, interpolate the transform into a deformation field, e.g. using this module (details FAQ here):

Registration Results

moving input moving input after registration (only frames 1-27 shown)
unregistered moving series moving input after registration (only frames 1-27 shown)
deformation shown as displacement vectors (only frames 35-60 shown) displacements
deformation shown as displacement vectors (only frames 35-60 shown) displacements (PDF)

Discussion / Overall Strategy

  • because the torso is already well registered and does not move across the sequence, a global affine/rigid registration is of no use. Instead we seek to assess the internal displacements caused across the breathing cycle. We therefore choose a low-DOF BSpline model.
  • Because the implementation of the BRAINSfit module used here expects a 3D volume, we choose a slightly larger grid and make it isotropic, although the 3rd dimension of the grid is not used. We expect the optimizer in the registration to not move outside the slice plane and simply return 0 deformations there.
  • An alternative strategy would be to register each image to its immediate previous timepoint, and then integrating the displacements. This has the advantage that nonrigid registration tends to be better for smaller differences, but it bears the risk of accumulating error and hence a lower robustness.
  • A related option to improve precision would be to initialize each registration with the result of the previous one. Unfortunately the BRAINSfit registration modules do not (yet) allow to initialize with anything other than an affine.
  • The additional information/constraint, that the displacements defined by the series of registrations should describe a smooth motion that is contiguous and differentiable, has not been exploited in this approach. This could be done a posteriori by applying a temporal filter across the transforms or fitting an appropriate model curve to each node displacement.
  • Overall strategy:
  1. select one frame within the breathing cycle as reference frame
  2. compute non-rigid BSpline registration of all images to the reference frame
  3. extract the displacements of indiv. grid nodes and plot over time


Thanks to Amir Owrangi and Dr.Grace Parraga from the Robarts Institute for sharing the registration problem and data.