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

From NAMIC Wiki
Jump to: navigation, search
(Created page with 'Back to ARRA main page <br> Back to Registration main page <br> [[Projects:RegistrationDocumentation:UseCaseInv…')
 
m (Text replacement - "http://www.slicer.org/slicerWiki/index.php/" to "https://www.slicer.org/wiki/")
 
(13 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 #07: Prostate MRI follow-up ==
+
== <small>updated for '''v4.1'''</small> [[Image:Slicer4_RegLibLogo.png|150px]] Slicer Registration Library Case #07: Prostate MRI follow-up ==
  
 
=== Input ===
 
=== Input ===
Line 9: Line 9:
 
|[[Image:RegLib_C07_Thumb1.png|150px|lleft|this is the fixed reference image. All images are aligned into this space]]  
 
|[[Image:RegLib_C07_Thumb1.png|150px|lleft|this is the fixed reference image. All images are aligned into this space]]  
 
|[[Image:RegArrow_NonRigid.png|100px|lleft]]  
 
|[[Image:RegArrow_NonRigid.png|100px|lleft]]  
|[[Image:RegLib_C07_Thumb2.gif|150px|lleft|this is the time series of 2D images to be registered with the reference]]
+
|[[Image:RegLib_C07_Thumb2.png|150px|lleft|this is the time series of 2D images to be registered with the reference]]
 
|-
 
|-
 
|fixed:prostate MRI<br>day 1
 
|fixed:prostate MRI<br>day 1
Line 17: Line 17:
  
 
=== Modules ===
 
=== Modules ===
*'''Slicer 3.6.1 recommended modules:  [http://www.slicer.org/slicerWiki/index.php/Modules:BRAINSFit BrainsFit]'''
+
*'''Slicer 3.6.1 recommended modules:   
 +
**[https://www.slicer.org/wiki/Modules:BRAINSFit BrainsFit]'''
 +
**[https://www.slicer.org/wiki/Modules:N4ITKBiasFieldCorrection-Documentation-3.6 N4ITKBiasFieldCorrection module]
 +
**[https://www.slicer.org/wiki/Modules:CropVolume-Documentation-3.6 Crop Volume module]
  
 
===Objective / Background ===
 
===Objective / Background ===
Line 27: Line 30:
 
*reference/fixed : axial MRI 256x256x36 ,0.7 x 0.7 x 4mm voxel size
 
*reference/fixed : axial MRI 256x256x36 ,0.7 x 0.7 x 4mm voxel size
 
*moving: axial MRI 256x256x20 ,0.8 x 0.8 x 5mm voxel size
 
*moving: axial MRI 256x256x20 ,0.8 x 0.8 x 5mm voxel size
 +
 +
===Download ===
 +
*Data
 +
**[[Media:RegLib_C07_Data.zip‎ ‎|'''RegLib_C07_Data''' : original image series, result transforms and images, presets, Slicer Scene  <small> (zip file 18 MB) </small>]]'''
 +
**Slicer 3.6 only: [[Media:RegLib_C07_Presets.mrml ‎|'''Parameter Presets''  <small> (.mrml text  file 20 kB file 20 kB) </small>]]'''
 +
[[Projects:RegistrationDocumentation:ParameterPresetsTutorial|Link to User Guide: How to Load/Save Registration Parameter Presets]]
  
 
=== Notes / Overall Strategy ===
 
=== Notes / Overall Strategy ===
Line 44: Line 53:
 
*'''Phase I: Bias field correction'''
 
*'''Phase I: Bias field correction'''
 
#load reference image and one moving image from the series
 
#load reference image and one moving image from the series
#open [http://www.slicer.org/slicerWiki/index.php/Modules:N4ITKBiasFieldCorrection-Documentation-3.6 N4ITKBiasFieldCorrection module]
+
#open [http://wiki.slicer.org/slicerWiki/index.php/Documentation/4.1/Modules/N4ITKBiasFieldCorrection N4ITKBiasFieldCorrection module]
##optional: select presets ("N4_Day1_axial" ) for module parameters from ''Parameter Set'' menu, or:
 
 
##select "Day01_axial" as input image, create new "Day1_axial_N4" output image
 
##select "Day01_axial" as input image, create new "Day1_axial_N4" output image
 
##set ''Iterations'' to 90,60,40
 
##set ''Iterations'' to 90,60,40
Line 53: Line 61:
 
#repeat above for the other image: "Day42_axial"
 
#repeat above for the other image: "Day42_axial"
 
*'''Phase II:  Affine Alignment'''
 
*'''Phase II:  Affine Alignment'''
#go to [http://www.slicer.org/slicerWiki/index.php/Modules:BRAINSFit BRAINSfit module]
+
#go to the [http://wiki.slicer.org/slicerWiki/index.php/Documentation/4.1/Modules/BRAINSFit BRAINSfit module]
 
##Select  ''Fixed Image'' = Day01_axial_n4 and ''Moving Image'' as "Day42_axial_n4"
 
##Select  ''Fixed Image'' = Day01_axial_n4 and ''Moving Image'' as "Day42_axial_n4"
##check boxes to include "rigid","scale", "skew" and "affine" registration phases
+
##Output Settings: ''Slicer Linear Transform'': create new linear transform , then rename to "Xf1_Affine" or similar
 
+
##Registration Phases: check boxes to include "rigid","scale", "skew" and "affine" registration phases (all except last box for BSpline)
 
+
##''Main Parameters'': increase ''Number Of Samples'' to 300,000
 
+
##leave rest at defaults and click ''Apply''
###select/check ''Include BSpline registration phase''
+
##compare results with those shown below
##Output Settings:  
+
*'''Phase II:  BSpline Alignment Level 1'''
###select a new transform "Slicer BSpline Transform", rename to "Xf1_moving_??"
+
#go to the [http://wiki.slicer.org/slicerWiki/index.php/Documentation/4.1/Modules/BRAINSFit BRAINSfit module]
###select a new volume "Output Image Volume'', rename to "moving_??_Xf1"
+
##Select  ''Fixed Image'' = Day01_axial_n4 and ''Moving Image'' as "Day42_axial_n4"
##Registration Parameters: increase ''Number Of Samples'' to 200,000
+
##Initialization Transform: select "Xf1_Affine" (generated above) from the dropdown menu
##Registration Parameters: set  ''Number Of Grid Subdivisions'' to 5,5,5
+
##Registration Phases: uncheck all boxes and turn on "BSpline" only
##Leave all other settings at default
+
##Output Settings:
##click: Apply; (runtime < 10 sec. on MacPro)
+
###''Slicer BSpline Transform'' : create new transform, then rename to "Xf2_BSpline" or similar
##adjust grid size until registration is acceptable
+
### ''Output Image Volume'' : create new output volume, then rename to "Day42_n4_Xf2_BSpline" or similar
##you can see the commandline text of the registration performed by opening the ''Window/Error Log'' window and clicking on ''BRAINSfit commandline input''
+
##Main Parameters:  
*'''Phase IIBatch Run'''
+
###increase''Number Of Samples'' to 300,000
#open a terminal window
+
###set BSpline Grid size: ''Number of Grid Subdivisions" to 5,5,3
##via a TextEditor or prototyping/scripting software (e.g. Matlab), copy and modify the prototype line below, by changing only the moving input image:
+
##click ''Apply''
  /Applications/Slicer36/Slicer3 --launch  /Applications/Slicer36/lib/Slicer3/Plugins/BRAINSFit --useBSpline --splineGridSize 5,5,5 --outputVolumePixelType short /
+
##compare results with those shown below
  --numberOfSamples 200000 --costMetric MMI --fixedVolume Reference/refLung_001.dcm --movingVolume Moving/Moving_001/Moving_001.dcm /
+
##Note that it is possible to do Phase I & II in a single step by also checking the "BSpline" phase box right away. However for pilot cases it is recommended to do them separately. If a combined registration fails it can be difficult to detect whether failure already occurred at the affine stage.
  --bsplineTransform Xforms/Moving_001_XfBSpl5.tfm --outputVolume MovingResampled/Moving_001_r.nrrd >> Logs/Moving_001_RegLog.txt 2>&1
+
*'''Phase IIICropping'''
##'''replace "/Applications/Slicer36" with your path of 3DSlicer'''
+
#for a more refined alignment of the prostate only we first crop both images to the ROI only
## create result directories '''MovingResampled''', '''Logs''', '''Xforms'''
+
#go to the [http://wiki.slicer.org/slicerWiki/index.php/Documentation/4.1/Modules/Crop_Volume Crop Volume module]
## 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.
+
##''Input Volume'', select "Day_01_axial_n4"
##paste all commands into a terminal window, or copy into a shell script and execute.
+
##''ROI'': select "New ROI"
*'''Phase IIIEvaluate Transform files'''
+
##''Output Volume'': select "Create New Volume"
##upon completion, read the transform files with an editor and extract the displacements of interest
+
##You should see a blue box overlay in all 3 slice views. Click near the edges of the box to expand or contract it. In all 3 views place the box to enclose the prostate. Compare with results shown below.
##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.
+
##check the ''isotropic voxel size for output volume box''
##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]
+
##click on ''Do ROI resample''
##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]):
+
##go to the ''Data'' module and rename the resampled output file to "Day_01_crop" or similar
/Applications/Slicer3.6.3/lib/Slicer3/Plugins/BSplineToDeformationField
+
#repeat above steps for "Day42_axial_n4"
 +
#save your work
 +
*'''Phase IVBSpline Alignment Level 2'''
 +
#you can now perform a second refined alignment on the cropped volumes only
 +
#first resample the cropped volume with the initial BSpline above. Go to the [http://wiki.slicer.org/slicerWiki/index.php/Documentation/4.1/Modules/ResampleScalarVectorDWIVolume ResampleScalarVectorDWIVolume module]
 +
##Select your ""Day42_cropped" volume as input volume and the above "Xf2_BSpline" as input transform
 +
##select "Day01_cropped" as reference
 +
##create new volume "Day42_crop_Xf2" as output volume
 +
##check ''output-to-input'' box, if not selected already
 +
##click ''Apply''
 +
##compare alignment of cropped volumes with results shown below
 +
#go back to the  [http://wiki.slicer.org/slicerWiki/index.php/Documentation/4.1/Modules/BRAINSFit BRAINSfit module]
 +
##you can now run a second BSpline with "Day01_cropped" as fixed and "Day42_cropped_Xf2" as moving volume
 +
##set BSpline grid to 5,5,5
 +
##leave other settings as for Phase II above.
 +
##click ''Apply''
 +
#compare alignment of cropped volumes with results shown below
 +
#save your work
  
 
=== 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_C07_unregistered.gif|300px|left|unregistered]]  
|[[Image:RegLib_C46_Moving_animReg.gif|300px|lleft|moving input after registration (only frames 1-27 shown)]]  
+
|unregistered
|[[Image:RegLib_C46_Displacements.png|300px|lleft|displacements]]
+
|-
 +
|[[Image:RegLib_C07_registered_Xf1.gif|300px|left|registered Xf1: Affine only]]
 +
|registered Xf1: Affine only
 +
|-
 +
|[[Image:RegLib_C07_registered_Xf2.gif|300px|left|registered Xf2: Affine+BSpline]]  
 +
|registered Xf2: Affine+BSpline
 +
|-
 +
|[[Image:RegLib_C07_crop.png|300px|left|cropping of prostate ROI]]  
 +
|cropping of prostate ROI
 
|-
 
|-
|unregistered moving series
+
|[[Image:RegLib_C07_registered_Xf3.gif|300px|left|registered Xf3: Second Level BSpline on cropped and resampled images]]  
|moving input after registration (only frames 1-27 shown)
+
|registered Xf3: Second Level BSpline on cropped and resampled images
|[[Media:RegLib_C46_Displacements.pdf|displacements (PDF)]]
 
 
|}
 
|}
  
 
 
===Download ===
 
*Data
 
**[[Media:RegLib_C46_Data.zip‎ ‎|'''RegLib_C46_Data''' : DICOM 2D series  <small> (DICOM files, zip file 18 MB) </small>]]'''
 
*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 Amir Owrangi and [http://www.imaging.robarts.ca/~gep Dr.Grace Parraga] from the [http://www.robarts.ca Robarts Institute] for sharing the registration problem and data.
+
Images from the [http://prostatemrimagedatabase.com Prostate MR Image Database] (patient 1, exam 1).

Latest revision as of 17:44, 10 July 2017

Home < Projects:RegistrationLibrary:RegLib C07

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 #07: Prostate MRI follow-up

Input

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:prostate MRI
day 1
moving:prostate MRI
day 42

Modules

Objective / Background

Evaluate changes

Keywords

MRI, prostate, follow-up

Input Data

  • reference/fixed : axial MRI 256x256x36 ,0.7 x 0.7 x 4mm voxel size
  • moving: axial MRI 256x256x20 ,0.8 x 0.8 x 5mm voxel size

Download

Link to User Guide: How to Load/Save Registration Parameter Presets

Notes / Overall Strategy

  • voxel size differs between the two images, also anisotropy is high: for the fine tuning a resampling to isotropic voxels for both volumes is recommended
  • the large FOV includes a lot of additional image content that can be useful in constraining the alignment but also limits precision on the region of interest. Ev. cropping or masking to an ROI containing the prostate only is likely to improve the quality of the final registration
  • the surface coils cause strong field inhomogeneity artifacts, apparent as strong intensity bias in both images. Bias correcion is recommended as preprocessing step.
  • Overall strategy:
  1. Bias correction of both images
  2. Affine automated registration of Day42->Day1
  3. Low-level BSpline registration (5x5x3) on global image, using above affine as starting point
  4. Crop both images to prostate region only, resample to isotropic sizes
  5. and apply above registration to cropped version of Day42
  6. BSpline registration of cropped images only
  7. Reapply final transform to entire (uncropped image)

Procedures

  • Phase I: Bias field correction
  1. load reference image and one moving image from the series
  2. open N4ITKBiasFieldCorrection module
    1. select "Day01_axial" as input image, create new "Day1_axial_N4" output image
    2. set Iterations to 90,60,40
    3. set BSpline grid resolution to 2,2,1
    4. set Shrink factor to 3
    5. click Apply
  3. repeat above for the other image: "Day42_axial"
  • Phase II: Affine Alignment
  1. go to the BRAINSfit module
    1. Select Fixed Image = Day01_axial_n4 and Moving Image as "Day42_axial_n4"
    2. Output Settings: Slicer Linear Transform: create new linear transform , then rename to "Xf1_Affine" or similar
    3. Registration Phases: check boxes to include "rigid","scale", "skew" and "affine" registration phases (all except last box for BSpline)
    4. Main Parameters: increase Number Of Samples to 300,000
    5. leave rest at defaults and click Apply
    6. compare results with those shown below
  • Phase II: BSpline Alignment Level 1
  1. go to the BRAINSfit module
    1. Select Fixed Image = Day01_axial_n4 and Moving Image as "Day42_axial_n4"
    2. Initialization Transform: select "Xf1_Affine" (generated above) from the dropdown menu
    3. Registration Phases: uncheck all boxes and turn on "BSpline" only
    4. Output Settings:
      1. Slicer BSpline Transform : create new transform, then rename to "Xf2_BSpline" or similar
      2. Output Image Volume : create new output volume, then rename to "Day42_n4_Xf2_BSpline" or similar
    5. Main Parameters:
      1. increaseNumber Of Samples to 300,000
      2. set BSpline Grid size: Number of Grid Subdivisions" to 5,5,3
    6. click Apply
    7. compare results with those shown below
    8. Note that it is possible to do Phase I & II in a single step by also checking the "BSpline" phase box right away. However for pilot cases it is recommended to do them separately. If a combined registration fails it can be difficult to detect whether failure already occurred at the affine stage.
  • Phase III: Cropping
  1. for a more refined alignment of the prostate only we first crop both images to the ROI only
  2. go to the Crop Volume module
    1. Input Volume, select "Day_01_axial_n4"
    2. ROI: select "New ROI"
    3. Output Volume: select "Create New Volume"
    4. You should see a blue box overlay in all 3 slice views. Click near the edges of the box to expand or contract it. In all 3 views place the box to enclose the prostate. Compare with results shown below.
    5. check the isotropic voxel size for output volume box
    6. click on Do ROI resample
    7. go to the Data module and rename the resampled output file to "Day_01_crop" or similar
  3. repeat above steps for "Day42_axial_n4"
  4. save your work
  • Phase IV: BSpline Alignment Level 2
  1. you can now perform a second refined alignment on the cropped volumes only
  2. first resample the cropped volume with the initial BSpline above. Go to the ResampleScalarVectorDWIVolume module
    1. Select your ""Day42_cropped" volume as input volume and the above "Xf2_BSpline" as input transform
    2. select "Day01_cropped" as reference
    3. create new volume "Day42_crop_Xf2" as output volume
    4. check output-to-input box, if not selected already
    5. click Apply
    6. compare alignment of cropped volumes with results shown below
  3. go back to the BRAINSfit module
    1. you can now run a second BSpline with "Day01_cropped" as fixed and "Day42_cropped_Xf2" as moving volume
    2. set BSpline grid to 5,5,5
    3. leave other settings as for Phase II above.
    4. click Apply
  4. compare alignment of cropped volumes with results shown below
  5. save your work

Registration Results

unregistered
unregistered
registered Xf1: Affine only
registered Xf1: Affine only
registered Xf2: Affine+BSpline
registered Xf2: Affine+BSpline
cropping of prostate ROI
cropping of prostate ROI
registered Xf3: Second Level BSpline on cropped and resampled images
registered Xf3: Second Level BSpline on cropped and resampled images


Acknowledgments

Images from the Prostate MR Image Database (patient 1, exam 1).