Documentation:Nightly:Registration:RegistrationLibrary:RegLib C02

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

Back to Registration Library

Slicer Registration Library Case #2: Multi contrast MRI + segmentation labelmap


this is the fixed MRI reference image. All images are aligned into this space
RegArrow Affine.png
this is the moving image, to be aligned with the reference on the left
this is a segmentation labelmap in the same space as the moving image. To be registered also
fixed image 1/target
moving image 2a
moving image 2b
segmentation labelmap


This case contains a structural T1-weighted MRI scan and a lesion segmentation obtained from another (FLAIR) scan. Goal is to align the FLAIR image and its segmentation labelmap with the structural reference T1 scan.
Approach: we first compute the registration from the T1-FLAIR pair and then apply this transform to the lesion segmentation. To follow a "non-destructive" processing philosophy we will avoid resampling the data where possible. Instead we will integrate the new orientation of the images in the image header, which does not change the image data itself.

Modules used

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, head, intra-subject, labelmap

Video Screencasts

  1. Movie/screencast showing registration for Case #02


  1. Compute Registration: open the General Registration (BRAINS) module
    1. Input Images: Fixed Image Volume: T1
    2. Input Images: Moving Image Volume: FLAIR
    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.
  2. Align Labelmap: We have now computed the registration transform. To reorient both FLAIR and its label map, we place both volumes inside the transform.
      1. Place "T1" in the background and "FLAIR" in the foreground. Select "LesionSeg" as the labelmap to display.
    1. Go to the Data module
      1. the "FLAIR" image should already be placed within the transform "Xf1_Affine", that was done by the registration module. If not, left click on the "FLAIR" node and drag it onto the "Xf1_Affine" node. You will see a "+" sign appear indicating that the image is placed within the transform.
      2. Do the same for the "LesionSeg" node, i.e. drag it into the "Xf1_Affine" transform.
  3. Apply the transforms without resampling / Save result images
    1. for linear (rigid to affine) transforms you have two options for generating a result image in the new orientation: with and without resampling. The method without resampling leaves the original image data untouched and writes the new orientation into the image header. This preserves the full original image quality and is the preferred method, provided that the software using the result image can read the spatial information in the header correctly. If you open an image with a software that does not account for this header information, the image will appear in its original orientation. The resampling method will create a new image volume by interpolating the data into the new space. This has the advantage that your registered volume will have matching size and resolution as your reference image, but it is associated with some data loss from the interpolation during resampling.
    2. Apply Transform without resampling:
    3. Go to the Data module
    4. left click on the moving image node and drag it into/onto the transform node. You should see a "+" sign appear next to the transform node indicating the volume is now placed under that transform. If the image is in either foreground or background and visible in the slice views or 3D view, you will see the image update to its new position immediately.
    5. right click on the image node and from the pop-up menu, select Harden Transform. This will apply the transform and move the image node back outside onto the main level.
    6. double click on the image node and rename it to document that this is no longer the original image but the reoriented one. Note that the image in its original position is replaced in memory and no longer accessible. There is no "undo" for this step, so if you wish to return to the original image, you must reload it from the original file. Be careful not to accidentally overwrite the original image file with the resampled one. Use a new filename when saving the image.
  4. Alternative: Apply Transform with resampling:
    1. Go to the BRAINSResample module
      1. Image To Warp: select FLAIR
      2. Reference Image: select T1
      3. Outputs:OutputImage: create & rename new, rename to "FLAIR_Xf1"
      4. Pixel Type: select short , or match the datatype of the original image.
      5. Transform File: select "Xf1_Affine"
      6. Interpolation Mode: select "WindowedSinc" (recommended for 3D MRI). For labelmaps select Nearest Neighbor
      7. Click Apply. This will generate a new volume with the same resolution as the reference image.
    2. repeat the same for the label map, but select Nearest Neighbor as the interpolation type.

Registration Results

RegLib C02 unregistered.gif baseline & T2 before registration (click to enlarge)
RegLib C02 registered.gif baseline to T2 after affine+nonrigid alignment (click to enlarge)