Difference between revisions of "Documentation:Nightly:Registration:RegistrationLibrary:RegLib C12a"

From Slicer Wiki
Jump to: navigation, search
m (Text replacement - "\[http:\/\/www\.slicer\.org\/slicerWiki\/index\.php\/([^ ]+) ([^]]+)]" to "$2")
 
(8 intermediate revisions by one other user not shown)
Line 1: Line 1:
 
[[Documentation/Nightly/Registration/RegistrationLibrary|Back to Registration Library]] <br>
 
[[Documentation/Nightly/Registration/RegistrationLibrary|Back to Registration Library]] <br>
  
= Slicer Registration Library Case #12a:  Liver Tumor Cryoablation (version 4.3.1)  =
+
= Slicer Registration Library Case #12a:  Liver Tumor Cryoablation (alternate version using nested transforms)  =
  
 
== Input ==
 
== Input ==
Line 18: Line 18:
 
'''Approach''': we seek a non-rigid registration of the MRI to the CT. Because contrast and image content are very different, we must first build masks to guide the registration process onto the structures of interest. We then obtain the registration in 2 steps: we first compute an affine registration to test stability and feasibility of our masks. Once successful we use this registration as starting point for a BSpline non-rigid transform.<br>
 
'''Approach''': we seek a non-rigid registration of the MRI to the CT. Because contrast and image content are very different, we must first build masks to guide the registration process onto the structures of interest. We then obtain the registration in 2 steps: we first compute an affine registration to test stability and feasibility of our masks. Once successful we use this registration as starting point for a BSpline non-rigid transform.<br>
  
'''[[RegistrationLibrary:RegLib_C12|Click here for newer version using dynamic visualization of nonrigid transforms]]'''
+
'''[[Documentation:Nightly:Registration:RegistrationLibrary:RegLib_C12|Click here for original version]]'''
  
 
== Modules used ==
 
== Modules used ==
Line 25: Line 25:
 
== Download (from NAMIC MIDAS) ==
 
== Download (from NAMIC MIDAS) ==
 
<small>''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. ''</small>
 
<small>''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. ''</small>
*[http://slicer.kitware.com/midas3/download/?items=103749 '''RegLib_12.mrb''': input data only, use this to run the tutorial from the start <small>(Slicer mrb file. 35 MB). </small>]
+
*[http://slicer.kitware.com/midas3/download/?items=142765 '''RegLib_C12a.mrb''': includes raw data + masks + transforms <small>(Slicer mrb file. 34 MB). </small>]
*[http://slicer.kitware.com/midas3/download/?items=103748 '''RegLib_C12_full.mrb''': includes raw data + all solutions and intermediate files, use to browse/verify <small>(Slicer mrb file. 68 MB). </small>]
 
  
 
== Video Screencasts ==
 
== Video Screencasts ==
#[[Media:RegLib_C12.mov|Movie/'''screencast showing registration Case #12''']]
+
#[[Media:RegLib_C12a_1_Registration.mov|Movie/'''screencast showing registration (affine + BSpline) for Case #12a''']]
 +
#[[Media:RegLib_C12a_2_VisualizeDeformation.mov|Movie/'''screencast showing visualization of nonrigid transform (part 1:  planar grid + 3D)''']]
 +
#[[Media:RegLib_C12a_3_VisualizeDeformation2.mov|Movie/'''screencast showing visualization of nonrigid transform (part2: 3D contour)''']]
 +
#[[Media:RegLib_C12a_4_VisualizeDeformation3.mov|Movie/'''screencast showing visualization of nonrigid transform (part 3: 3D view, grid slice only )''']]
  
 
==Objective / Background ==
 
==Objective / Background ==
Line 42: Line 44:
  
 
== Procedures ==
 
== Procedures ==
 +
Note that the approach below is different from the original version: here we want to isolate the nonrigid part of the registration from the affine portion, so that we can visualize the deformation only. See the '''[[Documentation:Nightly:Registration:RegistrationLibrary:RegLib_C12|original version]]''' if the main interest is the final aligned image.
 +
 
*'''Phase I: Build Masks'''
 
*'''Phase I: Build Masks'''
 
: Note: for illustration the example set contains 2 masks: one with only the liver and one also including spleen and kidney (Mask2).  As shown in the results below, the liver-only mask is insufficiently constraining the registration, yielding a result that at first glance looks ok for the liver, but has significant misalignment in the remaining abdominal area. Hence it is advisable to stabilize the registration further by including more structures with good contrast in both images (Spleen, Kidney).
 
: Note: for illustration the example set contains 2 masks: one with only the liver and one also including spleen and kidney (Mask2).  As shown in the results below, the liver-only mask is insufficiently constraining the registration, yielding a result that at first glance looks ok for the liver, but has significant misalignment in the remaining abdominal area. Hence it is advisable to stabilize the registration further by including more structures with good contrast in both images (Spleen, Kidney).
Line 53: Line 57:
 
#select the ''Dilate'' tool and click ''Apply'' 3-4 times to extend the mask area
 
#select the ''Dilate'' tool and click ''Apply'' 3-4 times to extend the mask area
 
#repeat for both masks
 
#repeat for both masks
#In the  [http://www.slicer.org/slicerWiki/index.php/Modules:Editor-Documentation-3.6 ''Editor'' module], use the ''Dilate'' function to expand the outline by 2-3 pixels (click on ''Apply'' button 2-3 times)
+
#In the  [[Modules:Editor-Documentation-3.6|''Editor'' module]], use the ''Dilate'' function to expand the outline by 2-3 pixels (click on ''Apply'' button 2-3 times)
 
#save dilated labelmasks under new name (e.g. CT_mask.nrrd)
 
#save dilated labelmasks under new name (e.g. CT_mask.nrrd)
 
*'''Phase II: MR-CTpre registration''' (Affine)
 
*'''Phase II: MR-CTpre registration''' (Affine)
Line 72: Line 76:
 
##click: Apply; runtime < 1 min (MacPro QuadCore 2.4GHz)
 
##click: Apply; runtime < 1 min (MacPro QuadCore 2.4GHz)
 
##this should generate a first alignment.
 
##this should generate a first alignment.
*'''Phase III: Nonrigid Registration'''
+
*'''Phase III: Prepare for Nonrigid Registration: create Affine aligned volume'''
 +
**here we want to isolate the deformation portion of the nonrigid registration. We therefore do not (as in the original) case, use the above affine registration as a starting point, but rather create a realigned version that '''includes''' this affine transform. We can do this '''without''' resampling using the ''Harden Transform'' function:
 +
#open the [[Documentation/Nightly/Modules/Data|''Data'' module]]
 +
##if not there already, drag the "MRI" volume node inside the "Xf1_Affine" transform node. You will see a "+" sign appear when dragging, at that point release the mouse to place the volume inside.
 +
##note that the views update (if you have the MRI volume selected in any of the views) immediately when the volume is placed within the transform.
 +
##right-click on the "MRI" node and from the pop-up menu select ''Harden Transform''. This will add the affine transform to the orientation info of the MRI volume and place the volume back on the main level.
 +
##Note that the original MRI volume (orientation) has been overwritten at this point. '''We recommend to immediately rename''' the volume to document that fact:  double-click on the node and add "_Xf1" or similar to the name.
 +
###We now have a volume in the affine aligned orientation. We use this volume as a starting point for the nonrigid (BSpline) registration
 +
##repeat the above for the mask: drag "MRI_mask" inside the "Xf1_Affine" transform, select ''Harden Transform'' and then rename to "MRI_mask_Xf1" or similar.
 +
*'''Phase IV: Nonrigid Registration'''
 
#open the  [[Documentation/Nightly/Modules/BRAINSFit|''General Registration (BRAINS)'' module]]
 
#open the  [[Documentation/Nightly/Modules/BRAINSFit|''General Registration (BRAINS)'' module]]
 
##''Fixed Image Volume'': CT
 
##''Fixed Image Volume'': CT
##''Moving Image Volume'': MRI
+
##''Moving Image Volume'': MRI_Xf1
 
##Output Settings:  
 
##Output Settings:  
###''Slicer BSpline Transform": create new transform, rename to "Xf2_BSpline"
+
###''Slicer BSpline Transform": create new transform, rename to "Xf2_BSplineOnly"
 
###''Slicer Linear Transform'': none
 
###''Slicer Linear Transform'': none
###''Output Image Volume'': create new volume,  rename to "MRI_Xf2"
+
###''Output Image Volume'': none (we use the new dynamic visualization of BSpline transforms to view the result)
 
##''Initialization'':  
 
##''Initialization'':  
###''Initialization Transform'': select  "Xf1_Affine" created in Phase II above
+
###''Initialization Transform'': None (remember that MRI_Xf1 is already in the affine-aligned space)
 
###''Initialization Transform Mode'': Off  
 
###''Initialization Transform Mode'': Off  
 
##''Registration Phases'': check boxes for ''BSpline'' only
 
##''Registration Phases'': check boxes for ''BSpline'' only
Line 89: Line 102:
 
##''Mask Option'': select ''ROI'' button
 
##''Mask Option'': select ''ROI'' button
 
###''(ROI)Masking input fixed'': CT_mask
 
###''(ROI)Masking input fixed'': CT_mask
###''(ROI)Masking input moving'': MRI_mask
+
###''(ROI)Masking input moving'': MRI_mask_Xf1 (remember to use the aligned mask, not the original one)
 
##Leave all other settings at default
 
##Leave all other settings at default
 
##click: Apply
 
##click: Apply
 +
*'''Phase V: Nested Transforms'''
 +
#We now have the 2 main transforms: "Xf1_Affine" and "Xf2_BSplineOnly". Together they form the full alignment.
 +
##drag the volume "MRI_Xf1" volume into the transform "Xf2_BSplineOnly". You should see the views update immediately.
 +
##to generate a resampled version, you can apply the same function as for the affine transform, i.e. right-click + ''Harden Transform''
 +
##alternatively you can use one of the Resample modules (e.g. BRAINSresample) to generate a resampled version
 +
##To nest the transforms:
 +
###reload the original volume "MRI"
 +
###place it inside the "Xf1_Affine" transform
 +
###place the entire "Xf1_Affine" struct (including the MRI volume within) onto the "Xf2_BSplineOnly" transform. Your structure should now look like the image on the right: [[Image:RegLib_C12_NestedTransforms.png|200px|right|nested transforms]]
 +
###again to resample select "Harden Transform". Note that while hardening a linear (e.g. Affine) transform can be done without resampling, the hardening of nonlinear transforms like a BSpline '''does''' require a resampling. Hence you will notice a slight delay before the "MRI" node is placed back onto the main level.
 +
###note that currently only limited combinations of Affine + BSpline nesting are supported, e.g. you cannot (yet) nest multiple BSplines together using this function.
 +
*'''Phase VI: Transform Visualizer'''
 +
#significant additions to visualize transforms have been added recently.
 +
#open the  [[Documentation/Nightly/Modules/Transforms|''Transforms'' module]]
 +
##under ''Active Transforms'', select "Xf2_BSplineOnly"
 +
##open the ''Display'' tab
 +
##check the ''Visible in Slice View'' checkbox.
 +
##under the ''Colors'' tab you can control the color coding, and under the ''Advanced'' tab you can control  size & density, range, icon etc. of the glyphs
 +
##see the demo screencasts above for examples on how to visualize the transform
 +
##note that to visualize a deformation effectively, it should not contain an linear (rigid, affine) portion, because that quickly dominates the field and makes deformations hard to see. That's the main motivation for separating the affine and BSpline transforms the way we did in the above workflow.
  
 
== Registration Results <small>(click to enlarge) </small>==
 
== Registration Results <small>(click to enlarge) </small>==

Latest revision as of 02:23, 27 November 2019

Home < Documentation:Nightly:Registration:RegistrationLibrary:RegLib C12a

Back to Registration Library

Slicer Registration Library Case #12a: Liver Tumor Cryoablation (alternate version using nested transforms)

Input

this is a pre-op CT + contrast reference image. All images are aligned into this space lleft this is the pre-op MRI we seek to align with the CT
fixed image/target moving image

Description

We have a pre-operative MRI and an intra-operative CT. We wish to align the MRI to the CT to aid in guiding the surgical intervention. Tumor visibility is much better on the MRI, hence a properly registered MRI can help locate the tumor during the intervention.
Approach: we seek a non-rigid registration of the MRI to the CT. Because contrast and image content are very different, we must first build masks to guide the registration process onto the structures of interest. We then obtain the registration in 2 steps: we first compute an affine registration to test stability and feasibility of our masks. Once successful we use this registration as starting point for a BSpline non-rigid transform.

Click here for original version

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.

Video Screencasts

  1. Movie/screencast showing registration (affine + BSpline) for Case #12a
  2. Movie/screencast showing visualization of nonrigid transform (part 1: planar grid + 3D)
  3. Movie/screencast showing visualization of nonrigid transform (part2: 3D contour)
  4. Movie/screencast showing visualization of nonrigid transform (part 3: 3D view, grid slice only )

Objective / Background

We seek to align a pre-operative MRI with a contrast enhanced CT for surgical guidance.

Keywords

MRI, CT, IGT, intra-operative, liver, cryoablation, change detection, non-rigid registration

Input Data

  • reference/fixed : pr-op CT, 0.95 x 0.95 x 5 mm voxel size
  • moving: intra-op MRI, 0.78 x 0.78 x 2.5 mm axial,

Procedures

Note that the approach below is different from the original version: here we want to isolate the nonrigid part of the registration from the affine portion, so that we can visualize the deformation only. See the original version if the main interest is the final aligned image.

  • Phase I: Build Masks
Note: for illustration the example set contains 2 masks: one with only the liver and one also including spleen and kidney (Mask2). As shown in the results below, the liver-only mask is insufficiently constraining the registration, yielding a result that at first glance looks ok for the liver, but has significant misalignment in the remaining abdominal area. Hence it is advisable to stabilize the registration further by including more structures with good contrast in both images (Spleen, Kidney).
  1. open the Editor module
  2. select "MRI" as the master volume ; a new "MRI_label" is created
  3. using the Brush tool, trace the liver contour from axial slices. Also include kidneys and spleen.
  4. repeat the same for the CT.
  5. you should end up with 2 label maps similar to those included in the example dataset. See snapshots in Result section below.
  6. save the label maps as "MRI-label.nrrd" or similar
  7. registration masks ideally extend beyond the structure boundary:
  8. select the Dilate tool and click Apply 3-4 times to extend the mask area
  9. repeat for both masks
  10. In the Editor module, use the Dilate function to expand the outline by 2-3 pixels (click on Apply button 2-3 times)
  11. save dilated labelmasks under new name (e.g. CT_mask.nrrd)
  • Phase II: MR-CTpre registration (Affine)
  1. open the General Registration (BRAINS) module
    1. Fixed Image Volume: CT
    2. Moving Image Volume: MRI
    3. Output Settings:
      1. Slicer BSpline Transform": none
      2. Slicer Linear Transform: create new transform, rename to "Xf1_Affine"
      3. Output Image Volume: create new volume, rename to "MRI_Xf1" or similar (we use this for ease of validation only)
    4. Initialization: select the useCenterOfROIAlign
    5. Registration Phases: check boxes for Rigid , Rigid+Scale and Affine
    6. Main Parameters: increase Number OF Samples to 300,000
    7. Mask Option: select ROI button
      1. (ROI)Masking input fixed: CT_mask2
      2. (ROI)Masking input moving: MRI_mask2
    8. Leave all other settings at default
    9. click: Apply; runtime < 1 min (MacPro QuadCore 2.4GHz)
    10. this should generate a first alignment.
  • Phase III: Prepare for Nonrigid Registration: create Affine aligned volume
    • here we want to isolate the deformation portion of the nonrigid registration. We therefore do not (as in the original) case, use the above affine registration as a starting point, but rather create a realigned version that includes this affine transform. We can do this without resampling using the Harden Transform function:
  1. open the Data module
    1. if not there already, drag the "MRI" volume node inside the "Xf1_Affine" transform node. You will see a "+" sign appear when dragging, at that point release the mouse to place the volume inside.
    2. note that the views update (if you have the MRI volume selected in any of the views) immediately when the volume is placed within the transform.
    3. right-click on the "MRI" node and from the pop-up menu select Harden Transform. This will add the affine transform to the orientation info of the MRI volume and place the volume back on the main level.
    4. Note that the original MRI volume (orientation) has been overwritten at this point. We recommend to immediately rename the volume to document that fact: double-click on the node and add "_Xf1" or similar to the name.
      1. We now have a volume in the affine aligned orientation. We use this volume as a starting point for the nonrigid (BSpline) registration
    5. repeat the above for the mask: drag "MRI_mask" inside the "Xf1_Affine" transform, select Harden Transform and then rename to "MRI_mask_Xf1" or similar.
  • Phase IV: Nonrigid Registration
  1. open the General Registration (BRAINS) module
    1. Fixed Image Volume: CT
    2. Moving Image Volume: MRI_Xf1
    3. Output Settings:
      1. Slicer BSpline Transform": create new transform, rename to "Xf2_BSplineOnly"
      2. Slicer Linear Transform: none
      3. Output Image Volume: none (we use the new dynamic visualization of BSpline transforms to view the result)
    4. Initialization:
      1. Initialization Transform: None (remember that MRI_Xf1 is already in the affine-aligned space)
      2. Initialization Transform Mode: Off
    5. Registration Phases: check boxes for BSpline only
    6. Main Parameters:
      1. Number Of Samples: 300,000
      2. B-Spline Grid Size: 7,7,3
    7. Mask Option: select ROI button
      1. (ROI)Masking input fixed: CT_mask
      2. (ROI)Masking input moving: MRI_mask_Xf1 (remember to use the aligned mask, not the original one)
    8. Leave all other settings at default
    9. click: Apply
  • Phase V: Nested Transforms
  1. We now have the 2 main transforms: "Xf1_Affine" and "Xf2_BSplineOnly". Together they form the full alignment.
    1. drag the volume "MRI_Xf1" volume into the transform "Xf2_BSplineOnly". You should see the views update immediately.
    2. to generate a resampled version, you can apply the same function as for the affine transform, i.e. right-click + Harden Transform
    3. alternatively you can use one of the Resample modules (e.g. BRAINSresample) to generate a resampled version
    4. To nest the transforms:
      1. reload the original volume "MRI"
      2. place it inside the "Xf1_Affine" transform
      3. place the entire "Xf1_Affine" struct (including the MRI volume within) onto the "Xf2_BSplineOnly" transform. Your structure should now look like the image on the right:
        nested transforms
      4. again to resample select "Harden Transform". Note that while hardening a linear (e.g. Affine) transform can be done without resampling, the hardening of nonlinear transforms like a BSpline does require a resampling. Hence you will notice a slight delay before the "MRI" node is placed back onto the main level.
      5. note that currently only limited combinations of Affine + BSpline nesting are supported, e.g. you cannot (yet) nest multiple BSplines together using this function.
  • Phase VI: Transform Visualizer
  1. significant additions to visualize transforms have been added recently.
  2. open the Transforms module
    1. under Active Transforms, select "Xf2_BSplineOnly"
    2. open the Display tab
    3. check the Visible in Slice View checkbox.
    4. under the Colors tab you can control the color coding, and under the Advanced tab you can control size & density, range, icon etc. of the glyphs
    5. see the demo screencasts above for examples on how to visualize the transform
    6. note that to visualize a deformation effectively, it should not contain an linear (rigid, affine) portion, because that quickly dominates the field and makes deformations hard to see. That's the main motivation for separating the affine and BSpline transforms the way we did in the above workflow.

Registration Results (click to enlarge)

unregistered MRI & CT
unregistered MRI & CT
registration masks
registration masks
affine registered MRI & CT
affine registered MRI & CT
nonrigid registered MRI & CT
nonrigid registered MRI & CT
insufficient mask: nonrigid registered with liver mask only, note the misalignment in the remaining abdomen
insufficient mask: nonrigid registered with liver mask only, note the misalignment in the remaining abdomen
Color overlay of registered MRI onto CT, illustrating the fusion: MRI soft tissue contrast shows substructures & vasculature invisible on the CT
Color overlay of registered MRI onto CT, illustrating the fusion: MRI soft tissue contrast shows substructures & vasculature invisible on the CT


Acknowledgments

Thanks to Dr.Stuart Silverman and Dr. Nobuhiko Hata for sharing this case.