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

From Slicer Wiki
Jump to: navigation, search
(Created page with '<noinclude>{{documentation/versioncheck}}</noinclude> Back to Registration Library <br> <!-- [[Image:SRegLib_Logo2.png|…')
 
 
(17 intermediate revisions by the same user not shown)
Line 5: Line 5:
 
== Input ==
 
== Input ==
 
{| style="color:#bbbbbb; " cellpadding="10" cellspacing="0" border="0"
 
{| style="color:#bbbbbb; " cellpadding="10" cellspacing="0" border="0"
|[[Image:RegLib_C32_thumb1.png|150px|lleft|this is the fixed reference image. All images are aligned into this space]]
+
|[[Image:RegLib_C32_thumb3.png|250px|lleft|this is the fixed reference image. All images are aligned into this space]]  
|[[Image:RegArrow_Affine_Right.png|100px|lleft]]  
+
|[[Image:RegLib_C32_thumb2.png|250px|lleft|this is the fixed reference image. All images are aligned into this space]]  
|[[Image:RegLib_C32_thumb2.png|150px|lleft|this is the T2 reference image, serves as target to the DTI baseline, but is itself aligned to the SPGR]]
 
 
|[[Image:RegArrow_NonRigid.png|100px|lleft]]  
 
|[[Image:RegArrow_NonRigid.png|100px|lleft]]  
|[[Image:RegLib_C32_thumb4a.png|280px|lleft|this is the DTI tensor image, in the same orientation as the DTI Baseline]]
+
|[[Image:RegArrow_Affine.png|100px|lleft]]
 +
|[[Image:RegLib_C32_thumb1.png|150px|lleft|this is the T1 moving image]]
 
|-
 
|-
|moving image<br>T1 SPGR
+
|fixed image<br>DTI
 +
|fixed image<br>DTI baseline
 
|
 
|
|fixed image 1<br>T2
 
 
|
 
|
|moving image<br>DTI baseline+DTI tensor
+
|moving image<br>T1 SPGR
 
|}
 
|}
 +
 +
== Description ==
 +
This is an example of the inverted workflow, i.e. we seek to align the structural T1 to the DTI. <br>
 +
'''Approach''': to align the DTI and the T1 we need 2 preprocessing steps: 1. reduce the bias field inhomogeneity in the reference T1 and 2. obtain a skull-stripping / brain mask for the T1. Since the DWI is already and will not move, no resampling is required before obtaining the DTI (DTI estimation). On instructions on how to generate the DTI from the DWI see, for example [[Documentation:Nightly:Registration:RegistrationLibrary:RegLib_C29|'''Case 29''']]. As common for DTI, the T1-DTI registration will include non-rigid deformation to correct for the strong distortions from the EPI acquisition.
  
 
== Modules used ==
 
== Modules used ==
*[[Documentation/{{documentation/version}}/Modules/DiffusionWeightedVolumeMasking|''DiffusionWeightedVolumeMasking'' ]]
+
*[[Documentation/Nightly/Modules/N4ITKBiasFieldCorrection|''N4ITKBiasFieldCorrection'' ]] module
*[[Documentation/{{documentation/version}}/Modules/DiffusionTensorEstimation| ''Diffusion Tensor Estimation'']]  
+
*[[Documentation/Nightly/Modules/BRAINSFit|''General Registration (BRAINS)'' module]]
*[[Documentation/{{documentation/version}}/Modules/Editor| ''Editor (for mask generation)'']]
 
*[[Documentation/{{documentation/version}}/Modules/BRAINSFit| ''General Registration (BRAINS)'']]
 
*[[Documentation/{{documentation/version}}/Modules/ResampleDTI|''Resample DTI Volume'']]
 
  
==Objective / Background ==
 
This is a classic case of a multi-sequence MRI exam we wish to spatially align to the anatomical reference scan (T1-SPGR). The scan of interest is the DTI image to be aligned for surgical planning/reference.
 
*The DWI sequence (EPI) contains distortions we seek to correct via non-rigid alignment
 
*The DWI sequence also contains intensity inhomogeneity (coil bias)
 
*the DTI baseline is similar in contrast to a T2, albeit at much lower resolution
 
*we have different amounts of voxel-anisotropy
 
  
 
== 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=95265 '''RegLib_C32_raw.mrb'''] <small>(input data, Slicer mrb file. 71 MB). </small> <br>
+
*[http://slicer.kitware.com/midas3/download/?items=103594 '''RegLib_C32.mrb'''] <small>(input data, Slicer mrb file. 31 MB). </small> <br>
*[http://slicer.kitware.com/midas3/download/?items=95058 '''RegLib_C32_full.mrb'''] <small>(input data+results, Slicer mrb file. 124 MB). </small>
+
*[http://slicer.kitware.com/midas3/download/?items=103593 '''RegLib_C32_full.mrb'''] <small>(input data+results, Slicer mrb file. 36 MB). </small>
  
 
== Keywords ==
 
== Keywords ==
 
MRI, brain, head, intra-subject, DTI, T1, T2, non-rigid, tumor, surgical planning
 
MRI, brain, head, intra-subject, DTI, T1, T2, non-rigid, tumor, surgical planning
 
==Registration Approach ==
 
*a direct registration of the DTI_baseline to the T1 is not recommended, since the T2 is a better match in contrast to the DTI baseline. We therefore first align the DTI with the T2 and then also register the T1 to the T2.
 
*the DTI-T2 registration includes non-rigid deformation to correct for the strong distortions from the EPI acquisition. Because of the nonrigid component a mask of the brain parenchyma helps in obtaining a meaningful transform. Registration without a mask is possible but not as good as with a mask.
 
*The DTI estimation provides an automated mask for the DTI_baseline scan, but we have no mask for the T2. We obtain a T2 mask through separate segmentation.
 
*thus the suggested pipeline is:
 
:#convert the DWI to DTI and generate a mask + baseline image
 
:#build a mask for the T2
 
:#Register DTI_baseline to T2
 
:#Resample DTI with the result transform
 
:#Register T1 to T2
 
  
 
=== Video Screencasts ===
 
=== Video Screencasts ===
#[[Media:RegLib_C29_m01_DWItoDTI.mov|'''Phase 1:''' Converting DWI to a DTI image]]
+
#[[Media:RegLib_C32.mov|'''Phase 1-3:''' registering T1 to a DTI image]] (5 min, 22MB)
#[[Media:QuickMask_03_GrowCut.mov|'''Phase 2:'''Building a Mask for the T2]] (See here for a selection of [[Documentation/Nightly/RegistrationVideoTutorials#Registration_Masking:_How_do_I_quickly_generate_a_mask_for_use_in_registration.3F|'''videos showing 6 different methods to build a mask''']])
 
#[[Media:RegLib_C29_m02a_BSpline+Mask.mov|'''Phase 3:'''Register DTI baseline to T2 (with dilated mask)]]
 
##[[Media:RegLib_C29_m02_BSpline.mov|if curious how the registration looks w/o masking: Register DTI baseline to T2 (no mask)]]
 
##[[Media:RegLib_C29_m02b_BSpline+MaskUndilated.mov|if curious how the registration looks w/o dilation of the mask: Register DTI baseline to T2 (with undiluted mask)]]
 
#[[Media:RegLib_C29_m03_DTIresample.mov|'''Phase 4:'''Resample DTI into space of T2]]
 
#[[Media:RegLib_C29_m04_Coregister_T1.mov|'''Phase 5:'''Register T1 to T2]]
 
  
 
== Procedures ==
 
== Procedures ==
*'''Phase 1a: Preprocessing: Build DWI mask + baseline'''  
+
*'''Phase 1: Preprocessing: Bias Correction of T1'''  
#open the  [[Documentation/{{documentation/version}}/Modules/DiffusionWeightedVolumeMasking|''DiffusionWeightedVolumeMasking'' ]] module  
+
#open the  [[Documentation/Nightly/Modules/N4ITKBiasFieldCorrection|''N4ITKBiasFieldCorrection'' ]] module  
##''Input DWI Volume'': "DWI"
+
##''Input image'': T1
##''Output Baseline Volume'': ''Create & Rename New Volume'', rename to "DWI_baseline"
+
##''Output Volume'': create & rename new, rename to "T1_biascorr" or similar
##''Output Threshold Mask'': ''Create & Rename New Volume'', rename to "DWI_mask"
+
##Leave all other settings at defaults. Click: Apply. Processing may take 1-2 minutes based on your CPU.
##Leave other settings at default; click ''Apply'' -> You should obtain a baseline scalar image and a mask label map.
 
  
*'''Phase 1b: Preprocessing: Convert DWI -> DTI'''
+
*'''Phase 2: Affine Registration'''
#open the [[Documentation/{{documentation/version}}/Modules/DiffusionTensorEstimation|''Diffusion Tensor Estimation'' module]]
+
We first perform an affine registration for a rough alignment. Once this succeeds we continue to the nonrigid (BSpline) portion. Because Affine registration does not require resampling, there is no cost (in terms of data loss) of separating this step.
##''Input DWI Volume'': DWI
+
#open the [[Documentation/Nightly/Modules/BRAINSFit|''General Registration (BRAINS)'' module]]
##''Output DTI Volume'': create & rename new, rename to "DTI"
+
##''Fixed Image Volume'': DTI_baseline
##''Output Baseline Volume'': create & rename new, rename to "DTI_baseline"
+
##''Moving Image Volume'': T1_biascorr
##Click: Apply -> you should get a 3x3 tensor image + a baseline image with contrast similar to a T2
+
##Output Settings:
 +
###''Slicer BSpline Transform": none
 +
###''Slicer Linear Transform'': create & rename new transform, rename to "Xf1_DTI-T1"
 +
###''Output Image Volume'': create new volume, rename to T1_Xf1 (we use this only to verify the result, we can discard afterwards)
 +
##''Registration Phases'': check boxes for ''Rigid'', ''Rigid+Scale'',  ''Affine''
 +
##''Main Parameters'':
 +
###''Number Of Samples'': 200,000
 +
##Leave all other settings at default
 +
##click: Apply.
 +
##upon completion: place T1_Xf1 and DTI_baseline into foreground and background, respectively, and fade back and forth to verify alignment. Areas of DTI distortions need not match up exactly, but the overall parenchyma should be well aligned.
  
*'''Phase 2: build a T2 mask'''
+
*'''Phase 3: BSpline Registration'''
See here for a selection of [[Documentation/Nightly/RegistrationVideoTutorials#Registration_Masking:_How_do_I_quickly_generate_a_mask_for_use_in_registration.3F|'''videos showing 6 different methods to build a mask''']]. Below is one of those, using the "GrowCut" tool in the Editor
+
We now proceed to the nonrigid (BSpline) portion, using the above Affine transform as a starting point. This creates a new transform that includes '''both''' the affine and the BSpline portion. Because nonrigid transforms cannot be visualized directly, a resampled volume is required for this step.
#Open the  [[Documentation/{{documentation/version}}/Modules/Editor| "Editor" module]] , select the T2 as master volume and create a new label map.
+
#open the [[Documentation/Nightly/Modules/BRAINSFit|''General Registration (BRAINS)'' module]]
#select the brush tool, set the label to 2 and the brush size to 80 mm or larger (filling almost entire FOV)
+
##''Fixed Image Volume'': DTI_baseline
#on 4 or 5 slices select the entire head and a good portion of the background
+
##''Moving Image Volume'': T1_biascorr ('''not''' the T1_Xf1)
#switch to the ''Level Tracing'' effect/tool. Switch the label to 1.
 
#On the same slices as before, place the cursor near the brain surface until the yellow outline shows a good enclosure of the brain at that slice. Click the left mouse to fill.
 
#you should now have a handful of slices, even distributed, where label 1 describes the brain parenchyma and label 2 everything else.
 
#switch to the ''GrowCutEffect'' and click Apply.
 
#Apply some Dilation filtering: we want the mask to include the brain surface. Select the Dilation Effect and apply 3-4 times to grow the edge of the mask outward.
 
#'''Also dilate the DWI mask:'''' switch to the DWI_mask image and also apply 3-4 steps of dilation
 
 
 
*'''Phase 3:  Register DTI (masked)'''
 
#open the [[Documentation/{{documentation/version}}/Modules/BRAINSFit|''General Registration (BRAINS)'' module]]
 
##''Fixed Image Volume'': T2
 
##''Moving Image Volume'': DTI_baseline
 
 
##Output Settings:  
 
##Output Settings:  
###''Slicer BSpline Transform": create & rename new transform, rename to "Xf1_DTI-T1"
+
###''Slicer BSpline Transform": create & rename new transform, rename to "Xf2_BSpline"
 
###''Slicer Linear Transform'': none
 
###''Slicer Linear Transform'': none
###''Output Image Volume'': create new volume,  rename to DTI_baseline_Xf1
+
###''Output Image Volume'': create & rename new volume,  rename to T1_Xf2
##''Registration Phases'': check boxes for ''Rigid'', ''Rigid+Scale'',  ''Affine'' and ''BSpline''
+
##''Registration Phases'': '''un'''check boxes for ''Rigid'', ''Rigid+Scale'',  ''Affine'' , check box for ''BSpline''
 
##''Main Parameters'':
 
##''Main Parameters'':
###''Number Of Samples'': 500,000
+
###''Number Of Samples'': increase to 300,000 (or more)
###''B-Spline Grid Size'': 7,7,5
+
###''B-Spline Grid Size'': 3,3,3
 
##''Mask Option'': select ''ROI'' button
 
##''Mask Option'': select ''ROI'' button
###''(ROI) masking input fixed'': DWI_mask
 
###''(ROI) masking input  moving'': T2_mask
 
 
##Leave all other settings at default
 
##Leave all other settings at default
##click: Apply. This may take several minutes depending on your CPU.
+
##click: Apply. This may take 1-2 minutes depending on your CPU.
+
##as above, verify by fading between DTI_baseline and T1_Xf2
*'''Phase 4: Resample DTI'''
+
##you can also examine the deformation portion only by placing T1_Xf1 and T1_Xf2 into fore- and background and fading between them.
#Open the [[Documentation/{{documentation/version}}/Modules/ResampleDTI|''Resample DTI Volume'' module]  (under ''All Modules'' menu; note this is distinct from the ResampleScalarVectorDWIVolume used above)]]
 
##''Input Volume'': DTI
 
##''Output Volume'': create new DTI Volume, rename to ''DTI_Xf2''
 
##''Reference Volume'': T2_Xf1
 
##''Transform Node'': select "Xf2_DTI-T1" created above
 
##check box: ''displacement''
 
#leave all other settings at defaults
 
#Click Apply; runtime ~ 3 min.
 
#set T1 or FLAIR as background and the new  ''DTI_Xf2'' volume as foreground
 
#Move fade slider to see DTI overlay onto the structural image
 
 
 
*'''Phase 5: register T2 to T1'''
 
#open the  [[Documentation/{{documentation/version}}/Modules/BRAINSFit| General Registration (BRAINS) module]]
 
##''Fixed Image Volume'': T1
 
##''Moving Image Volume'': T2
 
##Output Settings:
 
###''Slicer BSpline Transform": none
 
###''Slicer Linear Transform'': create & rename new transform, rename to "Xf3_T1-T2"
 
###''Output Image Volume'': none ('''since this is an affine transform we need not resample to see the result''')
 
##''Registration Phases'': check boxes for ''Rigid'' and ''Affine''
 
##''Main Parameters : Number Of Samples'': 200,000
 
##Leave all other settings at default
 
##click: Apply; runtime < 10 sec (MacPro QuadCore 2.4GHz) -> This only generates the transform. We still need to apply it to the image
 
##Go to the ''Data'' module. Find the nodes/entries for the T1 and the Xf3_T1-T2 transform. Drag the T1 node onto/into the transform Xf3_T2-T1 node. You should see the T2 now being listed nested within the transform.
 
##right-click on the T1 image and from the pop-up menu, select ''Harden Transform''. This will apply the transform and move the new T1 back out onto the main level
 
##double click on the T1 node and rename it to "T1_Xf3" or similar to make a record that this is no longer the original T1. '''Note that when you save your result, the save dialog may still display the name of the original T1. Make sure to change that before saving to prevent overwriting the original. '''Note that this way of applying the transform avoids resampling the data, it merely places the new orientation as a matrix in the image header'''.
 
 
##Save results.
 
##Save results.
  
 
== Registration Results==
 
== Registration Results==
 
{|cellpadding="10" cellspacing="0" border="0"
 
{|cellpadding="10" cellspacing="0" border="0"
|[[Image:RegLib_C29_registered.gif|400px]] ||original and registered pair of T1 and DTI (click to enlarge)
+
|[[Image:RegLib_C32_unregistered.png|400px]] ||unregistered pair of T1 and DTI (click to enlarge)<br>
 +
|-
 +
|[[Image:RegLib_C32_RegisteredAffine.gif|400px]] || T1 registered to DTI baseline : Affine only(click to enlarge)
 +
|-
 +
|[[Image:RegLib_C32_registered.gif|400px]] || T1 registered to DTI  Affine + BSpline (click to enlarge)
 
|}
 
|}

Latest revision as of 13:46, 3 September 2013

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


For the latest Slicer documentation, visit the read-the-docs.


Back to Registration Library

Slicer Registration Library Case #29: Intra-subject Brain DTI

Input

this is the fixed reference image. All images are aligned into this space this is the fixed reference image. All images are aligned into this space lleft lleft this is the T1 moving image
fixed image
DTI
fixed image
DTI baseline
moving image
T1 SPGR

Description

This is an example of the inverted workflow, i.e. we seek to align the structural T1 to the DTI.
Approach: to align the DTI and the T1 we need 2 preprocessing steps: 1. reduce the bias field inhomogeneity in the reference T1 and 2. obtain a skull-stripping / brain mask for the T1. Since the DWI is already and will not move, no resampling is required before obtaining the DTI (DTI estimation). On instructions on how to generate the DTI from the DWI see, for example Case 29. As common for DTI, the T1-DTI registration will include non-rigid deformation to correct for the strong distortions from the EPI acquisition.

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.

Keywords

MRI, brain, head, intra-subject, DTI, T1, T2, non-rigid, tumor, surgical planning

Video Screencasts

  1. Phase 1-3: registering T1 to a DTI image (5 min, 22MB)

Procedures

  • Phase 1: Preprocessing: Bias Correction of T1
  1. open the N4ITKBiasFieldCorrection module
    1. Input image: T1
    2. Output Volume: create & rename new, rename to "T1_biascorr" or similar
    3. Leave all other settings at defaults. Click: Apply. Processing may take 1-2 minutes based on your CPU.
  • Phase 2: Affine Registration

We first perform an affine registration for a rough alignment. Once this succeeds we continue to the nonrigid (BSpline) portion. Because Affine registration does not require resampling, there is no cost (in terms of data loss) of separating this step.

  1. open the General Registration (BRAINS) module
    1. Fixed Image Volume: DTI_baseline
    2. Moving Image Volume: T1_biascorr
    3. Output Settings:
      1. Slicer BSpline Transform": none
      2. Slicer Linear Transform: create & rename new transform, rename to "Xf1_DTI-T1"
      3. Output Image Volume: create new volume, rename to T1_Xf1 (we use this only to verify the result, we can discard afterwards)
    4. Registration Phases: check boxes for Rigid, Rigid+Scale, Affine
    5. Main Parameters:
      1. Number Of Samples: 200,000
    6. Leave all other settings at default
    7. click: Apply.
    8. upon completion: place T1_Xf1 and DTI_baseline into foreground and background, respectively, and fade back and forth to verify alignment. Areas of DTI distortions need not match up exactly, but the overall parenchyma should be well aligned.
  • Phase 3: BSpline Registration

We now proceed to the nonrigid (BSpline) portion, using the above Affine transform as a starting point. This creates a new transform that includes both the affine and the BSpline portion. Because nonrigid transforms cannot be visualized directly, a resampled volume is required for this step.

  1. open the General Registration (BRAINS) module
    1. Fixed Image Volume: DTI_baseline
    2. Moving Image Volume: T1_biascorr (not the T1_Xf1)
    3. Output Settings:
      1. Slicer BSpline Transform": create & rename new transform, rename to "Xf2_BSpline"
      2. Slicer Linear Transform: none
      3. Output Image Volume: create & rename new volume, rename to T1_Xf2
    4. Registration Phases: uncheck boxes for Rigid, Rigid+Scale, Affine , check box for BSpline
    5. Main Parameters:
      1. Number Of Samples: increase to 300,000 (or more)
      2. B-Spline Grid Size: 3,3,3
    6. Mask Option: select ROI button
    7. Leave all other settings at default
    8. click: Apply. This may take 1-2 minutes depending on your CPU.
    9. as above, verify by fading between DTI_baseline and T1_Xf2
    10. you can also examine the deformation portion only by placing T1_Xf1 and T1_Xf2 into fore- and background and fading between them.
    11. Save results.

Registration Results

RegLib C32 unregistered.png unregistered pair of T1 and DTI (click to enlarge)
RegLib C32 RegisteredAffine.gif T1 registered to DTI baseline : Affine only(click to enlarge)
RegLib C32 registered.gif T1 registered to DTI Affine + BSpline (click to enlarge)