Documentation:Nightly:Registration:RegistrationLibrary:RegLib C41

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

Slicer Registration Library Case #41: Mouse Brain MRI


MRI baseline lleft MRI follow-up
fixed image 1/target
MRI mouse #1
moving image
MRI mouse #2

Modules used


Aim is to register the two brains of control mice to eachother. The original images have their header orientation info in a nonstandard form. As a consequence the image loads with sagittal and axial views switched. To fix we create a reorientation transformAlso the target image content is of low intensity and small compared to the surrounding tissue, making masking essential. We will first correct the orientation issue and apply intensity bias correction, then build two masks for registration, and finally co-register the two images in two steps via affine and non-rigid BSpline transforms.

Download (from NAMIC MIDAS)

Why 2 sets of files? The "input data" mrb includes only the unregistered data to try the method yourself from start to finish. The full dataset includes intermediate files and results (transforms, resampled images etc.). If you use the full dataset we recommend to choose different names for the images/results you create yourself to distinguish the old data from the new one you generated yourself.


MRI, brain, mouse, masking, non-human, non-rigid,

Input Data

  • reference/fixed MRI: 0.1 x 0.1 x 0.1 mm, 192 x 256 x 192
  • moving MRI: 0.1 x 0.1 x 0.1 mm, 192 x 256 x 192

Video Screencasts

  1. Movie/screencast showing bias correction step
  2. Movie/screencast showing reorientation to RAS standard space
  3. Movie/screencast showing building a registration mask for image 1
  4. Movie/screencast showing building a registration mask for image 2
  5. Movie/screencast showing affine+nonrigid registration step


  1. Reorient to RAS space: (Movie/screencast for this step)
    1. go to the Data module
      1. right click on the "Scene" node and select "Insert Transform" from the pulldown menu
      2. rename the new transform to "Xf0_reorient" or similar.
      3. place/drag both images inside the transform node.
    2. go to the Transforms ' module & select "Xf0_reorient" from the menu
      1. change the identity matrix as shown in the image here. To modify an entry, double-click the field, then edit and to confirm hit the ENTER key.transform to reorient volumes to RAS space
      2. switch the "1" in the 1st and last row to the last and first column, respectively. Change the sign of the "1" in the middle row to "-1"
      3. you should see the images in the position as shown in the results below, with the eyes looking up in the axial (red) and left in the sagittal (yellow) view.
    3. save intermediate results
  2. Bias Correction: Correct for local intensity inhomogeneities (Movie/screencast for this step)
    1. Open the Editor module (we first build a rough mask for better filtering results)
      1. select "mouse1" as input image, accept the default colormap settings.
      2. select the "Threshold" tool. ThresholdEffectIcon.png.
      3. drag the left side of the threshold range slider until most of the brain is included. Then click "Apply"
      4. select the "Dilate" tool. Click the "Apply" button 2-3 times until the mask encloses all of the brain and a bit beyond
      5. repeat for the "mouse2" image
    2. Open the N4ITK MRI Bias Correction module (under Filters menu)
      1. Input Image: "mouse1"
      2. Mask Image: "mouse1-label" image generated above
      3. Output Volume: create & rename new: "mouse1_N4"
      4. Number of iterations: reduce to 200,150,100
      5. leave remaining parameters at defaults
      6. Apply. This will take 1-2 minutes to process, depending on CPU
    3. repeat for the "mouse2" image. Same settings
    4. save intermediate results
  3. Build Registration Masks': we now rebuild masks for the registration. You could also use the masks generated above, but we will generate more accurate ones with relatively little effort. Note that registration masks need not be overly accurate but should include the main boundaries of the structure of interest, in this case the brain. We seek a method that will let us generate such a mask quickly and without excessive manual editing. (Movie/screencast for this step)
    1. Open the Editor module (we first build a rough mask for better filtering results)
      1. select "mouse1" as input image, accept the default colormap settings. Create a new label map (do not use the one already generated above)
      2. select the "Magic Wand" tool. MagicWandEffectIcon.png.
      3. change the default tolerance and size limits to: 800 and 8000, respectively
      4. check the "Fill Volume" checkbox to apply the effect in 3D.
      5. left click inside the brain in any of the 3 views. Wait a few seconds for the effect to run and the display to update. You will see speckled segmentation overlay being added for each click. Do not worry about the speckled nature of the result at this point, we will fix that later. What we want is points to cover largely the extent of the brain in all dimensions. Use all 3 views to place seeds. See the screencast for details. Once you have most of the brain covered, proceed with next step below.
      6. select the "Dilate" tool DilateEffectIcon.png. Click the "Apply" button 2-3 times until the mask closes the gaps and encloses all of the brain and a bit beyond
      7. repeat for the "mouse2" image: (Movie/screencast for this step)
  4. Affine Registration: open the General Registration (BRAINS) module. (Movie/screencast for this step)
    1. Input Images: Fixed Image Volume: mouse1_N4
    2. Input Images: Moving Image Volume: mouse2_N4
    3. Output Settings:
      1. Slicer Linear Transform (create new transform, rename to: "Xf1_Affine")
      2. Output Image Volume none. No resampling required for linear transforms
    4. Registration Phases: select/check Rigid , Rigid+Scale, Affine
    5. Main Parameters:
      1. increase Number Of Samples to 200,000
    6. Leave all other settings at default
    7. click: Apply; runtime < 1 min.
  5. BSpline Registration: open the General Registration (BRAINS) module
    1. Fixed Image: "mouse1_N4" , Moving Image: "mouse2_N4"
    2. Registration phases: from Initialize with previously generated transform', select the"Xf1_Affine" node created before.
    3. Registration phases: uncheck rigid,scale and affine boxes and check box for BSpline only.
    4. Output: Slicer Linear transform: select "None"
    5. Output: Slicer BSpline transform: create new, rename to "Xf2_BSpline"
    6. Output Image Volume: create new, rename to "mouse2_Xf2"; Pixel Type: "short"
    7. Registration Parameters: increase Number Of Samples to 300,000; Number of Grid Subdivisions: 5,5,5
    8. Control Of Mask Processing Tab: check ROI box, for Input Fixed Mask and Input Moving Mask select the two masks generated above
    9. Leave other settings at default
    10. click apply

Registration Results

shown are, from left to right, panels of axial, sagittal and coronal views.
original brain in non-RAS orientation original, not RAS
original brain in proper RAS orientation original,after reorientation into RAS

original unregistered brains original, not registered
affine registered brains affine registered
registered brains after 5x5x5 nonrigid BSpline alignment registered brains after 5x5x5 nonrigid BSpline alignment


Many thanks to Lili X. Cai from the Jasanoff Laboratory at MIT for sharing the Data and registration problem.