Difference between revisions of "Projects:RegistrationLibrary:RegLib C12"

From NAMIC Wiki
Jump to: navigation, search
m (Text replacement - "http://www.slicer.org/slicerWiki/index.php/" to "https://www.slicer.org/wiki/")
 
(17 intermediate revisions by one other user not shown)
Line 3: Line 3:
 
[[Projects:RegistrationDocumentation:UseCaseInventory|Back to Registration Use-case Inventory]] <br>
 
[[Projects:RegistrationDocumentation:UseCaseInventory|Back to Registration Use-case Inventory]] <br>
  
==<small>v3.6.3</small> [[Image:Slicer3-6Announcement-v1.png‎|150px]] Slicer Registration Library Case #12:  Liver Tumor Cryoablation ==
+
==<small>updated for '''v4.1'''</small> [[Image:Slicer4_RegLibLogo.png|150px]] <br>  Slicer Registration Library Case #12:  Liver Tumor Cryoablation ==
  
 
=== Input ===
 
=== Input ===
 
{| style="color:#bbbbbb; " cellpadding="10" cellspacing="0" border="0"
 
{| style="color:#bbbbbb; " cellpadding="10" cellspacing="0" border="0"
|[[Image:RegLib_C12_LiverTumor_CTpre.png|150px|lleft|this is the intra-op CT reference image. All images are aligned into this space]]  
+
|[[Image:RegLib_C12_Thumb1.png|150px|lleft|this is a pre-op CT + contrast reference image. All images are aligned into this space]]  
 
|[[Image:RegArrow_NonRigid.png|100px|lleft]]  
 
|[[Image:RegArrow_NonRigid.png|100px|lleft]]  
|[[Image:RegLib_C12_LiverTumor_CTcontrast-pre.png|150px|lleft|this is an intermediate pre-op CT, used as reference to match the MRI]]
+
|[[Image:RegLib_C12_Thumb2.png|150px|lleft|this is the pre-op MRI we seek to align with the CT]]
|[[Image:RegArrow_NonRigid.png|100px|lleft]]
 
|[[Image:RegLib_C12_LiverTumor_MRI.png|150px|lleft|this is the pre-op MRI we seek to align with the intra-op CT]]
 
 
|-
 
|-
 
|fixed image/target
 
|fixed image/target
|
 
|intermediate ref. image
 
 
|
 
|
 
|moving image
 
|moving image
 
|}
 
|}
  
=== Modules ===
+
=== Slicer4 Modules used ===
*'''Slicer 3.6.3 recommended modules:  [http://www.slicer.org/slicerWiki/index.php/Modules:BRAINSFit BrainsFit]'''
+
* [http://wiki.slicer.org/slicerWiki/index.php/Documentation/4.1/Modules/BRAINSFit General Registration (BRAINS) module]
 +
 
 +
===Download ===
 +
*[[Media:RegLib_C12_Data.zip|'''download input image data'''  <small> (Input Data, Masks, Solution Transforms, Resampled results (NRRD images,  zip file 65 MB) </small>]]
  
 
===Objective / Background ===
 
===Objective / Background ===
We seek to align a pre-operative MRI with the intra-operative CT to enhance tumor visibility for surgical guidance.
+
We seek to align a pre-operative MRI with a contrast enhanced CT for surgical guidance.
  
 
=== Keywords ===
 
=== Keywords ===
Line 33: Line 32:
 
*moving:  intra-op MRI, 0.78 x 0.78 x 2.5 mm  axial,  
 
*moving:  intra-op MRI, 0.78 x 0.78 x 2.5 mm  axial,  
  
=== Notes / 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:
 
:#select one frame within the breathing cycle as reference frame
 
:#compute non-rigid BSpline registration of all images to the reference frame
 
:#extract the displacements of indiv. grid nodes and plot over time
 
 
=== Discussion: Registration Challenges ===
 
=== Discussion: Registration Challenges ===
 
*large differences in FOV
 
*large differences in FOV
Line 48: Line 37:
 
*contrast enhancement and pathology and treatment changes cause additional differences in image content
 
*contrast enhancement and pathology and treatment changes cause additional differences in image content
 
*we have strongly anisotropic voxel sizes with much less through-plane resolution
 
*we have strongly anisotropic voxel sizes with much less through-plane resolution
 +
 +
=== Notes / Overall Strategy ===
 +
*masking is required to focus the registration algorithm on the structure of interest
 +
*Overall strategy:
 +
:#obtain (manual) a coarse segmentation of the liver in both MRI and CT. Dilate by a few pixels to include the organ boundary
 +
:#perform a manual initial alignment of MR to CT. Use this alignment as starting point for the automated registration
 +
:#run an affine registration with above masks and intial alignment
 +
#run a non-rigid BSpline registration with above affine alignment as starting point
  
  
 
=== Procedures ===
 
=== Procedures ===
*'''Phase I: Pilot to determine optimal registration parameters'''
+
*'''Phase I: Build Masks'''
#load reference image and one moving image from the series
+
: 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).
#open Registration : ''BrainsFit'' module  
+
#open the [http://wiki.slicer.org/slicerWiki/index.php/Documentation/4.1/Modules/Editor Editor module]
##Registration Phases:
+
#select  "MRI" as the master volume ; a new "MRI_label" is created
##set "reference" fixed and "moving_??" as moving image
+
#using the Brush tool, trace the liver contour from axial slices. Also include kidneys and spleen.
###select/check ''Include BSpline registration phase''
+
#repeat the same for the CT.
 +
#you should end up with 2 label maps similar to those included in the example dataset. See snapshots in Result section below.
 +
#save the label maps as "MRI-label.nrrd" or similar
 +
#registration masks ideally extend beyond the structure boundary:
 +
#select the ''Dilate'' tool and click ''Apply'' 3-4 times to extend the mask area
 +
#repeat for both masks
 +
#In the  [https://www.slicer.org/wiki/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)
 +
*'''Phase II: MR-CTpre registration''' (Affine)
 +
#open the [http://wiki.slicer.org/slicerWiki/index.php/Documentation/4.1/Modules/BRAINSFit General Registration (BRAINS) module]
 +
##''Fixed Image Volume'': CT
 +
##''Moving Image Volume'': MRI
 
##Output Settings:  
 
##Output Settings:  
###select a new transform "Slicer BSpline Transform", rename to "Xf1_moving_??"
+
###''Slicer BSpline Transform": none
###select a new volume "Output Image Volume'', rename to "moving_??_Xf1"
+
###''Slicer Linear Transform'': create new transform, rename to "Xf1_MRI-CT_Affine"
##Registration Parameters: increase ''Number Of Samples'' to 200,000
+
###''Output Image Volume'': create new volume, rename to "MRI_Xf1" (we use this for ease of validation only)
##Registration Parameters: set  ''Number Of Grid Subdivisions'' to 5,5,5
+
##''Initialization'': select the ''useCenterOfROIAlign''
 +
##''Registration Phases'': check boxes for ''Rigid'' , ''Rigid+Scale'' and ''Affine''
 +
##''Mask Option'': select ''ROI'' button
 +
###''(ROI)Masking input fixed'': CT_mask
 +
###''(ROI)Masking input moving'': MRI_mask
 
##Leave all other settings at default
 
##Leave all other settings at default
##click: Apply; (runtime < 10 sec. on MacPro)
+
##click: Apply; runtime < 1 min (MacPro QuadCore 2.4GHz)
##adjust grid size until registration is acceptable
+
##this should generate a first alignment.
##you can see the commandline text of the registration performed by opening the ''Window/Error Log'' window and clicking on ''BRAINSfit commandline input''
+
*'''Phase III: Nonrigid Registration'''
*'''Phase II: Batch Run'''
+
#open the [http://wiki.slicer.org/slicerWiki/index.php/Documentation/4.1/Modules/BRAINSFit General Registration (BRAINS) module]
#open a terminal window
+
##''Fixed Image Volume'': CT
##via a TextEditor or prototyping/scripting software (e.g. Matlab), copy and modify the prototype line below, by changing only the moving input image:
+
##''Moving Image Volume'': MRI
  /Applications/Slicer36/Slicer3 --launch  /Applications/Slicer36/lib/Slicer3/Plugins/BRAINSFit --useBSpline --splineGridSize 5,5,5 --outputVolumePixelType short /
+
##Output Settings:
  --numberOfSamples 200000 --costMetric MMI --fixedVolume Reference/refLung_001.dcm --movingVolume Moving/Moving_001/Moving_001.dcm /
+
###''Slicer BSpline Transform": create new transform, rename to "Xf2_MRI-CT_BSpline"
  --bsplineTransform Xforms/Moving_001_XfBSpl5.tfm --outputVolume MovingResampled/Moving_001_r.nrrd >> Logs/Moving_001_RegLog.txt 2>&1
+
###''Slicer Linear Transform'': none
##'''replace "/Applications/Slicer36" with your path of 3DSlicer'''
+
###''Output Image Volume'': create new volume,  rename to "MRI_Xf2"
## create result directories '''MovingResampled''', '''Logs''', '''Xforms'''
+
##''Initialization'':
## note that because input image is DICOM, and images are 2D only, each image of the time series must be in its own directory, otherwise Slicer will read them as a volume.
+
###''Initialization Transform'': select  "Xf1_MRI-CT_Affine" created in Phase II above
##paste all commands into a terminal window, or copy into a shell script and execute.
+
###''Initialization Transform Mode'': Off
*'''Phase III: Evaluate Transform files'''
+
##''Registration Phases'': check boxes for ''BSpline'' only
##upon completion, read the transform files with an editor and extract the displacements of interest
+
##''Main Parameters'':
##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.
+
###''Number Of Samples'': 200,000
##for details on the ITK transform format see the [http://www.slicer.org/slicerWiki/index.php/Slicer-3-6-FAQ#What_is_the_Meaning_of_.27Fixed_Parameters.27_in_the_transform_file_.28.tfm.29_of_a_BSpline_registration_.3F '''FAQ''' here]
+
###''B-Spline Grid Size'': 7,7,3
##To obtain displacements at arbitrary coordinates, interpolate the transform into a deformation field, e.g. using this module (details  [http://www.slicer.org/slicerWiki/index.php/Slicer-3-6-FAQ#How_can_I_convert_a_BSpline_transform_into_a_deformation_field.3F FAQ here]):
+
##''Mask Option'': select ''ROI'' button
/Applications/Slicer3.6.3/lib/Slicer3/Plugins/BSplineToDeformationField
+
###''(ROI)Masking input fixed'': CT_mask
 +
###''(ROI)Masking input moving'': MRI_mask
 +
##Leave all other settings at default
 +
##click: Apply
  
 
=== Registration Results===
 
=== Registration Results===
 
{| style="color:#bbbbbb; " cellpadding="10" cellspacing="0" border="0"
 
{| style="color:#bbbbbb; " cellpadding="10" cellspacing="0" border="0"
|[[Image:RegLib_C46_Thumb2.gif|300px|lleft|moving input]]  
+
|[[Image:RegLib_C12_unregistered.gif|300px|left|unregistered MRI & CT]]  
|[[Image:RegLib_C46_Moving_animReg.gif|300px|lleft|moving input after registration (only frames 1-27 shown)]]
+
|unregistered MRI & CT
|[[Image:RegLib_C46_Displacements.png|300px|lleft|displacements]]
 
 
|-
 
|-
|unregistered moving series
+
|[[Image:RegLib_C12_Masks.png|300px|left|registration masks]]
|moving input after registration (only frames 1-27 shown)
+
|registration masks
|[[Media:RegLib_C46_Displacements.pdf|displacements (PDF)]]
+
|-
 +
|[[Image:RegLib_C12_Affine.gif|300px|left|affine registered MRI & CT]]
 +
|affine registered MRI & CT
 +
|-
 +
|[[Image:RegLib_C12_BSpline.gif|300px|left|nonrigid registered MRI & CT]]
 +
|nonrigid registered MRI & CT
 +
|-
 +
|[[Image:RegLib_C12_ConstrainFailure.gif|300px|left|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
 +
|-
 +
|[[Image:RegLib_C12_ColorOverlay.gif|300px|left|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
 
|}
 
|}
  
 
 
===Download ===
 
*Data
 
*[[Media:RegLib_C12_LiverTumor_DATA.zip|'''download input image data'''  <small> (Input Data, NRRD images,  zip file 42 MB) </small>]]
 
*[[Media:RegLib_C12_LiverTumorAblation1_ParameterPresets.mrml|'''download registration parameter presets file'''  <small> (.mrml  file 20 kB) </small>]]
 
*[[Media:RegLib_C12_LiverTumorAblation1_Tutorial.ppt|'''download guided tutorial'''  <small> (PowerPoint,  xx MB) </small>]]
 
*[[Media:RegLib_C12_LiverTumorAblation1_Set.zip|'''download full tutorial set'''  <small> (Input Data, presets, results, tutorial,  zip file xx MB) </small>]]
 
[[Projects:RegistrationDocumentation:ParameterPresetsTutorial|Link to User Guide: How to Load/Save Registration Parameter Presets]]
 
 
*Results
 
**[[Media:RegLib_C46_RegistrationTransforms.zip‎ ‎|'''RegLib_C46_RegistrationTransforms.zip''' : the 200 BSpline registration transforms <small> (ITK transform (text) files, zip file 274 kB) </small>]]'''
 
**[[Media:RegLib_C46_MovingResampled.zip‎ ‎|'''RegLib_C46_MovingResampled.zip''' : the 200 registered image stack <small> (NRRD image files, zip file 16MB) </small>]]'''
 
  
 
=== Acknowledgments ===
 
=== Acknowledgments ===
 
Thanks to Dr.Stuart Silverman and Dr. Nobuhiko Hata for sharing this case.
 
Thanks to Dr.Stuart Silverman and Dr. Nobuhiko Hata for sharing this case.

Latest revision as of 18:04, 10 July 2017

Home < Projects:RegistrationLibrary:RegLib C12

Back to ARRA main page
Back to Registration main page
Back to Registration Use-case Inventory

updated for v4.1 Slicer4 RegLibLogo.png
Slicer Registration Library Case #12: Liver Tumor Cryoablation

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

Slicer4 Modules used

Download

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,

Discussion: Registration Challenges

  • large differences in FOV
  • strong differences in image contrast between MRI & CT
  • contrast enhancement and pathology and treatment changes cause additional differences in image content
  • we have strongly anisotropic voxel sizes with much less through-plane resolution

Notes / Overall Strategy

  • masking is required to focus the registration algorithm on the structure of interest
  • Overall strategy:
  1. obtain (manual) a coarse segmentation of the liver in both MRI and CT. Dilate by a few pixels to include the organ boundary
  2. perform a manual initial alignment of MR to CT. Use this alignment as starting point for the automated registration
  3. run an affine registration with above masks and intial alignment
  1. run a non-rigid BSpline registration with above affine alignment as starting point


Procedures

  • 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_MRI-CT_Affine"
      3. Output Image Volume: create new volume, rename to "MRI_Xf1" (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. Mask Option: select ROI button
      1. (ROI)Masking input fixed: CT_mask
      2. (ROI)Masking input moving: MRI_mask
    7. Leave all other settings at default
    8. click: Apply; runtime < 1 min (MacPro QuadCore 2.4GHz)
    9. this should generate a first alignment.
  • Phase III: Nonrigid Registration
  1. open the General Registration (BRAINS) module
    1. Fixed Image Volume: CT
    2. Moving Image Volume: MRI
    3. Output Settings:
      1. Slicer BSpline Transform": create new transform, rename to "Xf2_MRI-CT_BSpline"
      2. Slicer Linear Transform: none
      3. Output Image Volume: create new volume, rename to "MRI_Xf2"
    4. Initialization:
      1. Initialization Transform: select "Xf1_MRI-CT_Affine" created in Phase II above
      2. Initialization Transform Mode: Off
    5. Registration Phases: check boxes for BSpline only
    6. Main Parameters:
      1. Number Of Samples: 200,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
    8. Leave all other settings at default
    9. click: Apply

Registration Results

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.