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

From NAMIC Wiki
Jump to: navigation, search
m (Text replacement - "http://www.slicer.org/slicerWiki/index.php/" to "https://www.slicer.org/wiki/")
 
(23 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.1</small> [[Image:Slicer3-6Announcement-v1.png‎|150px]]  Slicer Registration Library Case xx: TBI  =
+
= <small>v3.6.1</small> [[Image:Slicer3-6Announcement-v1.png‎|150px]]  Slicer Registration Library Case 31: TBI  =
 +
 
 
=== Input ===
 
=== Input ===
 +
{| style="color:#bbbbbb; " cellpadding="2" cellspacing="0" border="0"
 +
|[[Image:RegLib_C31_Thumb1.png|100px]]
 +
|[[Image:RegArrow_Affine.png|70px|lleft]]
 +
|[[Image:RegLib_C31_Thumb2.png|100px]]
 +
|[[Image:RegLib_C31_Thumb3.png|100px]]
 +
|[[Image:RegLib_C31_Thumb4.png|100px]]
 +
|[[Image:RegArrow_Affine.png|70px|lleft]]
 +
|[[Image:RegLib_C31_Thumb5.png|100px]]
 +
|-
 +
|exam 1: T1
 +
|
 +
|exam 1: FLAIR
 +
|exam 1: GRE
 +
|exam 1: PD
 +
|
 +
|exam 1: DWI
 +
|-
 +
|[[Image:RegArrow_NonRigidVert.png|70px|lleft]]
 +
|
 +
|
 +
|
 +
|-
 +
|[[Image:RegLib_C31_Thumb6.png|100px]]
 +
|[[Image:RegArrow_Affine.png|70px|lleft]]
 +
|[[Image:RegLib_C31_Thumb7.png|100px]]
 +
|[[Image:RegLib_C31_Thumb8.png|100px]]
 +
|[[Image:RegLib_C31_Thumb9.png|100px]]
 +
|[[Image:RegArrow_Affine.png|70px]]
 +
|[[Image:RegLib_C31_Thumb10.png|100px]]
 +
|-
 +
|exam 2: T1
 +
|
 +
|exam 2: FLAIR
 +
|exam 2: GRE
 +
|exam 2: PD
 +
|
 +
|exam 2: DWI
 +
|}
 +
 +
=== Modules ===
 +
*'''Slicer 3.6.1 recommended modules:  [https://www.slicer.org/wiki/Modules:BRAINSFit BrainsFit]'''
 +
 +
=== Download ===
 +
*DATA
 +
**[[Media:RegLib_C31.zip‎|'''TBI case: registered, but not applied/resampled''' <small> (Data & Solution Xforms, zip file 123 MB) </small>]]
 +
**[[Media:RegLib_C31_RegApplied.zip|'''TBI case: registered and resampled''' <small> (image volumes, zip file 100 MB) </small>]]
  
 
=== Modules ===
 
=== Modules ===
*'''Slicer 3.6.1 recommended modules:  [http://www.slicer.org/slicerWiki/index.php/Modules:BRAINSFit BrainsFit], [http://www.slicer.org/slicerWiki/index.php/Modules:RegisterImages-Documentation-3.6 Expert Automated Registration]
+
*'''Slicer 3.6.1 recommended modules:  [https://www.slicer.org/wiki/Modules:BRAINSFit BrainsFit]
  
 
===Objective / Background ===
 
===Objective / Background ===
Line 26: Line 73:
 
*second we register the follow-up T1 scan to the baseline T1
 
*second we register the follow-up T1 scan to the baseline T1
 
*we then nest the first alignment within the second
 
*we then nest the first alignment within the second
 +
 +
=== Procedure Overview ===
 +
*Scene1_NotApplied: contains all the nested registration transforms, but no resampling has been performed. In the slice view all images will show as registered. To apply the actual resampling in that position, first select/highlight each image volume in the MRML tree (left click) and then select ''Harden Transforms'' from the ''Data'' module (right click).
 +
** [[Image:RegLib_C31_MRML-tree.png|MRML tree hierarchy. The T1_e1 image is the main reference. T1_e2 is the intermediate reference for exam 2]]
 +
*Scene2_Unregistered: as scene 1, but all images have been moved '''outside''' the transforms, i.e. in original position.
 +
**[[Image:RegLib_C31_MRML-tree2.png|MRML tree hierarchy with images moved outside the transforms, i.e. in original position. ]]
  
 
=== Procedure ===
 
=== Procedure ===
Line 37: Line 90:
 
*'''Align Exam 2 to Exam 1: T1''' 1st pass: unmasked
 
*'''Align Exam 2 to Exam 1: T1''' 1st pass: unmasked
 
#Open ''Registration / BRAINSFit'' module
 
#Open ''Registration / BRAINSFit'' module
##To set all parameters from presets, from the ''ParameterSet'' menu, select "Xf1_e1_FLAIR-T1_unmasked", else choose settings below:
+
##Fixed Image: T1_e1, moving image: T1_e2
##Fixed Image: e1_T1, moving image: e1_FLAIR
 
 
##Registration Phases: select "Initialize with CenterOfHeadAlign",  ''Include Rigid'', "IncludeScaleVersor3D" and ''Include Affine''
 
##Registration Phases: select "Initialize with CenterOfHeadAlign",  ''Include Rigid'', "IncludeScaleVersor3D" and ''Include Affine''
##Output Settings: under SlicerLinear Transform, select "Create New Linear Transform'', then select ''Rename" and rename it to ''Xf1_e1_FLAIR-T1''
+
##Output Settings: under SlicerLinear Transform, select "Create New Linear Transform'', then select ''Rename" and rename it to ''Xf1_e2-e1_Affine''
 
##Registration Parameters: increase the ''Number of Samples'' field to 200,000
 
##Registration Parameters: increase the ''Number of Samples'' field to 200,000
 
##Leave all other settings at defaults & Click:  ''Apply''. Registration should complete within ~ 30 seconds
 
##Leave all other settings at defaults & Click:  ''Apply''. Registration should complete within ~ 30 seconds
##Go back to the ''Data'' module: you should see the e1_FLAIR image moved under the newly created transform
+
##Go back to the ''Data'' module: you should see the T1_e2 image moved under the newly created transform
##Select "E1_T1" as background and ''e1_FLAIR'' as new foreground, toggle to see alignment
+
##Select "T1_e1" as background and ''T2_e2'' as new foreground, toggle to see alignment
##you will notice a small but distinct residual translational misalignment, apparent on axial and sagittal slices. This likely arises from dominant edges of the skull. We rerun a 2nd pass with masks
+
##due to the strong deformations an affine alignment alone does not achieve a perfect match. We can extend the DOF to non-rigid BSpline transforms, but must be aware that doing so might remove differences of interest:
*'''Align Exam 1: FLAIR''' 2nd pass: masked
+
*'''Align Exam 2:''' 2nd pass: nonrigid
#we obtain a mask for the moving image (e1_FLAIR) by sending the mask for the fixed image (e1_ICC) through the inverse of the above transform
 
##From File menu, select ''Add Data'' & reload a second copy of the above transform  ''Xf1_e1_FLAIR-T1'' and the labelmap "e1_ICC.nrrd"
 
##rename Xform to " ''Xf1i_e1_T1-FLAIR'' and the mask to "e1_FLAIR_mask"
 
##go to the ''Transforms'' module, select the ''Xf1i_e1_T1-FLAIR'' transform and then click on the ''Invert'' button
 
##go to the ''Data'' module and drag the node for "e1_FLAIR_mask" inside the transform node ''Xf1i_e1_T1-FLAIR''
 
##right click on the ''Xf1i_e1_T1-FLAIR'' node and select ''Harden Transform''. We now have an approximate mask for the moving FLAIR image.
 
 
#Open ''Registration / BRAINSFit'' module
 
#Open ''Registration / BRAINSFit'' module
##To set all parameters from presets, from the ''ParameterSet'' menu, select "Xf1c_e1_FLAIR-T1_masked", else choose settings below:
+
##Fixed Image: T1_e1, moving image: T1_e2
##Fixed Image: e1_T1, moving image: e1_FLAIR
+
##From "Initialize with previously generated transform" & select the above affine ''Xf1_e2-e1_Affine''
##Registration Phases: select ''Include Rigid'', "IncludeScaleVersor3D" and ''Include Affine''. Make sure ''no'' initialization phases are selected.
+
##Registration Phases: select only ''Include BSpline''.  
##Output Settings: under SlicerLinear Transform, select "Create New Linear Transform'', then select ''Rename" and rename it to ''Xf1c_e1_FLAIR-T1_masked''
+
##Output Settings: under SlicerBSpline Transform, select "Create New BSpline Transform'', then select ''Rename" and rename it to ''Xf2_e2-e1_BSpl''
##Registration Parameters: increase the ''Number of Samples'' field to 200,000
+
*'''Align Within Exams:'''
##Control of Mask Processing tab: check "ROI" box,
+
#Select ''Load Volume...'' and open the GRE, FLAIR and DWI images, respectively
###Input Fixed Mask, select "e1_ICC", 
 
###Input Moving Mask, select "e1_FLAIR_mask"
 
##Leave all other settings at defaults & Click: ''Apply''. Registration should complete within ~ 40 seconds
 
##You should see the earlier residual misalignment mostly gone.
 
*'''Align Exam 1: T2'''  
 
#The T2 image is not far in pose from the T1 and also does not have the same skull-contrast issue as the FLAIR, we register directly to the T1 w/o masking
 
 
#Open ''Registration / BRAINSFit'' module
 
#Open ''Registration / BRAINSFit'' module
##To set all parameters from presets, from the ''ParameterSet'' menu, select "Xf2_e1_T2-T1_unmasked", else choose settings below:
+
#Select the presets Xf3... to Xf9... or use settings below:
##Fixed Image: e1_T1, moving image: e1_T2
+
##Registration phases: select ''Initialize with Center of Head Align'', ''include rigid'', ''include ScaleVersor3D'' and ''include Affine''
##Registration Phases: select ''Include Rigid'', "IncludeScaleVersor3D" and ''Include Affine''.
+
##increase ''Number of Samples'' in ''Registration Parameters'' to 200,000
##Output Settings: under SlicerLinear Transform, select "Create New Linear Transform'', then select ''Rename" and rename it to ''Xf2_e1_T2-T1''
+
##Leave all other settings at defaults & Click:  ''Apply''. Registration should complete within 1 minute.
##Registration Parameters: increase the ''Number of Samples'' field to 200,000
+
##choose a reference fixed image most similar in contrast to the moving image:
##Leave all other settings at defaults & Click:  ''Apply''. Registration should complete within ~ 30 seconds
+
###for GRE,PD and FLAIR: use T1 as fixed directly
*'''Align Exam 2:'''
+
###for DWI: use PD as intermediate target, then nest the transforms: note that when registration finishes it places the moving image inside the newly created transform and the result becomes visible immediately. For the DWI-PD registration you must first drag the entire construct of the new transform and the DWI image inside it into the transform that holds the PD, otherwise you will not see the actual alignment.
**repeat the above steps for exam 2, i.e. align e2_FLAIR and e2_T2 with e2_T1
+
*'''Fix Axis orientation:'''
**the above issue with the FLAIR-T1 residual does not arise for the follow-up exam, hence direct registration (unmasked) is possible
+
#the PD dual echo and DWI images have flipped y-axis orientation, i.e. AP is read as PA. to fix this
**Registration presets: BRAINSFit see Xf3_ and Xf4_ for FLAIR and T2, respectively
+
##write the volume back out as ''NHDR'' format under a different name
[[Image:RegLib_C18_RegHierarchy.png|200px|right| the MRML node tree shows the hierarchy of multiple transfoms]] the MRML node tree shows the hierarchy of multiple transfoms.
+
##open the '.nhdr' file with a text editor and place a minus sign in front of the number of the second triplet indicating the y-axis in the ''space directions'' field:
*'''Align Exam 2-1:'''  
+
  space directions: (0.47,0,0) (0,0.47,0) (0,0,3)
#finally we align the T1 references of exam 1 and 2, i.e. we align e2_T1 with e1_T1:
+
:becomes
#Registration presets: BRAINSFit see Xf5_
+
  space directions: (0.47,0,0) (0,-0.47,0) (0,0,3)
#parameters: defaults except increase sample rate to 200,000.
+
##then save & close; and reopen in Slicer. Orientation should now be correct. Note that loading the images with the 'ignore file orientation'' box checked (Add Volume dialog) will produce the correct y-axis but a flipped x-axis.
#here we have genuine masks for both images: ''Control of Mask Processing Tab'':
+
 
##Control of Mask Processing tab: check "ROI" box,
+
=== Resampling ===
##Input Fixed Mask, select "e1_ICC",
+
*use the ''Resample Scalar/Vector/DWI'' module (under Filtering) for all resampling
##Input Moving Mask, select "e2_ICC"
+
*the T1_e2 exam has 1 (affine or affine+BSpline) transform applied, all other images from the second exam have '''2''' transforms, first an affine to the original position of T1_e2 and then to T1_e1.
##Leave all other settings at defaults & Click''Apply''. Registration should complete within ~ 20 seconds
+
*if the e2-e1 transform is an affine also, we can combine all transforms beforehand (via the ''Harden Transforms'' option in the ''Data'' module)
*'''Combine Transforms:'''
+
*if the e2-e1 transform contains a BSpline, then we must resample twice, or venture into editing the transform file manually with a text editor. Resampling twice introduces some additional blurring from interpolation, but for most (qualitative) analyses the amount is negligible.
#to align all images in a common space, we combine a hierarchy of transforms, i.e. the e2_FLAIR undergoes both the Xf3_e2_FLAIR-T1 and the Xf4_e2-e1: See image on the right for what the final hierarchy should look like.
 
#right-click on the nested transforms and select ''Harden Transforms'' from the pulldown menu.  Rename the hardened transforms to indicate the direct alignment with e1_T1.
 
*''Resample''
 
#resample all images with their respective transforms, using the ''Filtering ->  Resample Scalar/Vector/DWI Volume'' module.
 
#within the module, select "ws" as interpolation type
 
*''Nonrigid extension''
 
#there is some residual distortion in the alignment of e2_T1 to e1_T1. Optionally one can address this via another separate nonrigid BSpline registration. However combining the Affine with the BSpline is not straightforward (as of v.3.6.1), to do this follow this outline:
 
##resample e2_T1 according to Xf5 : e2_T1_Xf5
 
##Perform a BSpline ''only'' alignment : Xf6_e2-e1_BSpline that aligns e2_T1_Xf5 with e1_T1. Grid size 3-5.
 
##Save resulting Xform
 
##Open Xform file and other saved affine transforms in Text Editor
 
##Paste the affine portion at the bottom of the BSpline and save under new name.
 
  
 
=== Registration Results===
 
=== Registration Results===
Line 106: Line 134:
 
[[Image:RegLib_TBI_RegResult_BSpl1_pre-post.gif|300px|Exam 2 aligned to Exam 1]] Exam 2 aligned to Exam 1 (affine+BSpline) <br>
 
[[Image:RegLib_TBI_RegResult_BSpl1_pre-post.gif|300px|Exam 2 aligned to Exam 1]] Exam 2 aligned to Exam 1 (affine+BSpline) <br>
 
[[Image:RegLib_TBI_RegResult_BSpl1_deform.gif|300px|Exam 2 aligned to Exam 1]] BSpline deformation only of Exam 2<br>
 
[[Image:RegLib_TBI_RegResult_BSpl1_deform.gif|300px|Exam 2 aligned to Exam 1]] BSpline deformation only of Exam 2<br>
 +
 +
----
 +
Within Exam:
 +
 +
[[Image:RegLib_TBI_e1_PD-T1.gif|300px|Exam 1 PD aligned to T1]] Exam 1 PD aligned to T1<br>
 +
[[Image:RegLib_TBI_e1_GRE-T1.gif|300px|Exam 1 GRE aligned to T1]] Exam 1 GRE aligned to T1<br>
 +
[[Image:RegLib_TBI_e1_DWI-T1.gif|300px|Exam 1 DWI aligned to T1]] Exam 1 DWI aligned to T1<br>

Latest revision as of 18:07, 10 July 2017

Home < Projects:RegistrationLibrary:RegLib C31

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

v3.6.1 Slicer3-6Announcement-v1.png Slicer Registration Library Case 31: TBI

Input

RegLib C31 Thumb1.png lleft RegLib C31 Thumb2.png RegLib C31 Thumb3.png RegLib C31 Thumb4.png lleft RegLib C31 Thumb5.png
exam 1: T1 exam 1: FLAIR exam 1: GRE exam 1: PD exam 1: DWI
lleft
RegLib C31 Thumb6.png lleft RegLib C31 Thumb7.png RegLib C31 Thumb8.png RegLib C31 Thumb9.png RegArrow Affine.png RegLib C31 Thumb10.png
exam 2: T1 exam 2: FLAIR exam 2: GRE exam 2: PD exam 2: DWI

Modules

Download

Modules

Objective / Background

We seek to align two exams (acute baseline and follow-up) as well as all series within exams into a common space for direct evaluation of regional change.

Input Data

  • inter-exam
    • reference/fixed : T1_e1 baseline exam of acute TBI , 512 x 512 x 160 ; 0.5 x 0.5 x 1 mm voxel size, axial acquisition, RAS orientation.
    • moving:T1_e2 follow-up exam of acute TBI , 512 x 512 x 160 ; 0.5 x 0.5 x 1 mm voxel size, axial acquisition, RAS orientation.
  • intra-exam

Registration Challenges

  • we have multiple nested transforms: each exam is co-registered within itself, and then the exams are aligned to eachother
  • strong pathology (hemorrhage?) present at different amounts in the two exams

Key Strategies

  • we first register the scans within each exam to the T1
  • second we register the follow-up T1 scan to the baseline T1
  • we then nest the first alignment within the second

Procedure Overview

  • Scene1_NotApplied: contains all the nested registration transforms, but no resampling has been performed. In the slice view all images will show as registered. To apply the actual resampling in that position, first select/highlight each image volume in the MRML tree (left click) and then select Harden Transforms from the Data module (right click).
    • MRML tree hierarchy. The T1_e1 image is the main reference. T1_e2 is the intermediate reference for exam 2
  • Scene2_Unregistered: as scene 1, but all images have been moved outside the transforms, i.e. in original position.
    • MRML tree hierarchy with images moved outside the transforms, i.e. in original position.

Procedure

  • Load & Center
  1. Load T1 MPRAGE datasets via Load Volume...
  2. volumes are note well centered, i.e. their physical origin defined in the image header differs; we therefore first center both images:
    1. Go to Volumes module, open Info tab
    2. From Active Volume menu, select each image in turn, then click the Center Image button
    3. note how Image origin changes for T1_e1 from 121,-97,-97 to 128,-128,-80 and for T1_e2 from 129,-106,-66 to 128,-128,-80
    4. now that both images have same center their initial misalignment can be seen by placing T1_e1 in the background and T1_e in the foreground and using the toggle-switch
  • Align Exam 2 to Exam 1: T1 1st pass: unmasked
  1. Open Registration / BRAINSFit module
    1. Fixed Image: T1_e1, moving image: T1_e2
    2. Registration Phases: select "Initialize with CenterOfHeadAlign", Include Rigid, "IncludeScaleVersor3D" and Include Affine
    3. Output Settings: under SlicerLinear Transform, select "Create New Linear Transform, then select Rename" and rename it to Xf1_e2-e1_Affine
    4. Registration Parameters: increase the Number of Samples field to 200,000
    5. Leave all other settings at defaults & Click: Apply. Registration should complete within ~ 30 seconds
    6. Go back to the Data module: you should see the T1_e2 image moved under the newly created transform
    7. Select "T1_e1" as background and T2_e2 as new foreground, toggle to see alignment
    8. due to the strong deformations an affine alignment alone does not achieve a perfect match. We can extend the DOF to non-rigid BSpline transforms, but must be aware that doing so might remove differences of interest:
  • Align Exam 2: 2nd pass: nonrigid
  1. Open Registration / BRAINSFit module
    1. Fixed Image: T1_e1, moving image: T1_e2
    2. From "Initialize with previously generated transform" & select the above affine Xf1_e2-e1_Affine
    3. Registration Phases: select only Include BSpline.
    4. Output Settings: under SlicerBSpline Transform, select "Create New BSpline Transform, then select Rename" and rename it to Xf2_e2-e1_BSpl
  • Align Within Exams:
  1. Select Load Volume... and open the GRE, FLAIR and DWI images, respectively
  2. Open Registration / BRAINSFit module
  3. Select the presets Xf3... to Xf9... or use settings below:
    1. Registration phases: select Initialize with Center of Head Align, include rigid, include ScaleVersor3D and include Affine
    2. increase Number of Samples in Registration Parameters to 200,000
    3. Leave all other settings at defaults & Click: Apply. Registration should complete within 1 minute.
    4. choose a reference fixed image most similar in contrast to the moving image:
      1. for GRE,PD and FLAIR: use T1 as fixed directly
      2. for DWI: use PD as intermediate target, then nest the transforms: note that when registration finishes it places the moving image inside the newly created transform and the result becomes visible immediately. For the DWI-PD registration you must first drag the entire construct of the new transform and the DWI image inside it into the transform that holds the PD, otherwise you will not see the actual alignment.
  • Fix Axis orientation:
  1. the PD dual echo and DWI images have flipped y-axis orientation, i.e. AP is read as PA. to fix this
    1. write the volume back out as NHDR format under a different name
    2. open the '.nhdr' file with a text editor and place a minus sign in front of the number of the second triplet indicating the y-axis in the space directions field:
 space directions: (0.47,0,0) (0,0.47,0) (0,0,3)
becomes
space directions: (0.47,0,0) (0,-0.47,0) (0,0,3)
    1. then save & close; and reopen in Slicer. Orientation should now be correct. Note that loading the images with the 'ignore file orientation box checked (Add Volume dialog) will produce the correct y-axis but a flipped x-axis.

Resampling

  • use the Resample Scalar/Vector/DWI module (under Filtering) for all resampling
  • the T1_e2 exam has 1 (affine or affine+BSpline) transform applied, all other images from the second exam have 2 transforms, first an affine to the original position of T1_e2 and then to T1_e1.
  • if the e2-e1 transform is an affine also, we can combine all transforms beforehand (via the Harden Transforms option in the Data module)
  • if the e2-e1 transform contains a BSpline, then we must resample twice, or venture into editing the transform file manually with a text editor. Resampling twice introduces some additional blurring from interpolation, but for most (qualitative) analyses the amount is negligible.

Registration Results

Exam 1 co-registered unregistered exam 1 & 2
Exam 2 co-registered Exam 2 aligned to Exam 1 (affine only)
Exam 2 aligned to Exam 1 Exam 2 aligned to Exam 1 (affine+BSpline)
Exam 2 aligned to Exam 1 BSpline deformation only of Exam 2


Within Exam:

Exam 1 PD aligned to T1 Exam 1 PD aligned to T1
Exam 1 GRE aligned to T1 Exam 1 GRE aligned to T1
Exam 1 DWI aligned to T1 Exam 1 DWI aligned to T1