|
Documentation.TsaAdvanced History
Hide minor edits - Show changes to output
Changed line 44 from:
TVAnisotropy -in tensor.nii.gz. This will output tensor_fa.nii.gz
to:
TVtool -in tensor.nii.gz -fa. This will output tensor_fa.nii.gz
Changed line 159 from:
The main factor here is the pruning factor ''p''. If ''p''=0, there is no pruning at all and the skeleton is very rough. The point when it starts making a difference is when $p=1$. For the thinnest structures, it is advised to choose ''p''=1.3 or 1.4. For the structures that contains less detail, ''p''=1.8 to ''p''=2 might be a good estimate. Modifying $p$ gives reasonable results for most of the tracts, however, some issues might happen when the tracts are at the limit of being sheet-like. At this point, you can also tweak the parameter ''e'' that is the minimal number of mesh edges separating two generator points of a VD face for it to be considered. The last parameter, ''q'' is the number of bins in each dimension. It defines the speed with which the program runs. A good value is ''q''=20-50. Reducing ''q'' reduces the number of vertices in the skeleton. For more information on each of the parameters and additional ones, you can type the command cmrep_vskel on the command line.
to:
The main factor here is the pruning factor ''p''. If ''p''=0, there is no pruning at all and the skeleton is very rough. The value of $p=1$ is the point, where you can notice pruning. For thinnest structures, it is advised to choose ''p''=1.3 or 1.4. For the structures that contains less detail, ''p''=1.8 to ''p''=2 might be a good estimate. Modifying $p$ gives reasonable results for most of the tracts, however, some issues might happen when the tracts are at the limit of being sheet-like. At this point, you can also tweak the parameter ''e'' that is the minimal number of mesh edges separating two generator points of a VD face for it to be considered (''e'' = 3, otherwise) . The last parameter, ''q'' is the number of bins in each dimension (''q'' has a default value, so you don't need to specify it). It defines the speed with which the program runs. A good value is ''q''=20-50. Reducing ''q'' reduces the number of vertices in the skeleton. For more information on each of the parameters and additional ones, you can type the command cmrep_vskel on the command line.
Changed lines 111-112 from:
The main goal is to obtain a levelset image from the grey level segmentation. As stated in [[http://www.itksnap.org/pmwiki/pmwiki.php?n=Convert3D.Documentation|section''levelset n_iter'']], creating a levelset segmentation requires a speed function and an initialization function. The adapted commands are as follows (the recommended parameters are indicated here)
to:
The main goal is to obtain a levelset image from the grey level segmentation. As stated in [[http://www.itksnap.org/pmwiki/pmwiki.php?n=Convert3D.Documentation|section ''levelset n_iter'']], creating a levelset segmentation requires a speed function and an initialization function. The adapted commands are as follows (the recommended parameters are indicated here)
Changed lines 167-168 from:
The very last step of this process uses the function cmrep\_fit from the cm-rep package that we previously installed. Its inputs consist of the medialtemlate.cmrep files obtained above, the binary image as well as a parameter file and the output directory. The main command is
to:
The very last step of this process uses the function cmrep_fit from the cm-rep package that we previously installed. Its inputs consist of the medialtemlate.cmrep files obtained above, the binary image as well as a parameter file and the output directory. The main command is
Changed line 159 from:
The main factor here is the pruning factor ''p''. If ''p''=0, there is no pruning at all and the skeleton is very rough. The point when it starts making a difference is when $p=1$. For the thinnest structures, it is advice to choose ''p''=1.3 or 1.4. For the structures that contains less detail, ''p''=1.8 to ''p''=2 might be a good estimate. Modifying $p$ gives reasonable results for most of the tracts, however, some issues might happen when the tracts are at the limit of being sheet-like. At this point, you can also tweak the parameter ''e'' that is the minimal number of mesh edges separating two generator points of a VD face for it to be considered. The last parameter, ''q'' is the number of bins in each dimension. It defines the speed with which the program runs. A good value is ''q''=20-50. Reducing ''q'' reduces the number of vertices in the skeleton. For more information on each of the parameters and additional ones, you can type the command cmrep_vskel on the command line.
to:
The main factor here is the pruning factor ''p''. If ''p''=0, there is no pruning at all and the skeleton is very rough. The point when it starts making a difference is when $p=1$. For the thinnest structures, it is advised to choose ''p''=1.3 or 1.4. For the structures that contains less detail, ''p''=1.8 to ''p''=2 might be a good estimate. Modifying $p$ gives reasonable results for most of the tracts, however, some issues might happen when the tracts are at the limit of being sheet-like. At this point, you can also tweak the parameter ''e'' that is the minimal number of mesh edges separating two generator points of a VD face for it to be considered. The last parameter, ''q'' is the number of bins in each dimension. It defines the speed with which the program runs. A good value is ''q''=20-50. Reducing ''q'' reduces the number of vertices in the skeleton. For more information on each of the parameters and additional ones, you can type the command cmrep_vskel on the command line.
Changed lines 6-7 from:
Creating a tract specific white matter atlas is the result of the combination of three main open-source software developed in PICSL. The first main part relies on DTI-TK. The last steps rely on the continuous medial representation model (cm-rep) (see [[http://www.itksnap.org/pmwiki/pmwiki.php n=CMREP.Documentation| url]] for installation and documentation). Another companion tool that will be needed here is convert3D (see [[http://www.itksnap.org/pmwiki/pmwiki.php?n=Convert3D.Documentation|here]]).
to:
Creating a tract specific white matter atlas is the result of the combination of three main open-source software developed in PICSL. The first main part relies on DTI-TK. The last steps rely on the continuous medial representation model (cm-rep) (see [[http://sourceforge.net/projects/cmrep/| this page]] for installation and [[ http://www.itksnap.org/pmwiki/pmwiki.php?n=CMREP.Documentation| this page]] for documentation). Another companion tool that will be needed here is convert3D (see [[http://www.itksnap.org/pmwiki/pmwiki.php?n=Convert3D.Documentation|here]]).
Changed line 125 from:
->[@ c3d tract\_binary.nii.gz -threshold 0.25 inf -0.5 0.5 -o tract_init.nii.gz
to:
->[@ c3d tract_binary.nii.gz -threshold 0.25 inf -0.5 0.5 -o tract_init.nii.gz
Changed line 50 from:
BinaryThresholdImageFilter tensor\_fa.nii.gz wm.nii.gz 0 0.2 0 1
to:
BinaryThresholdImageFilter tensor_fa.nii.gz wm.nii.gz 0 0.2 0 1
Deleted lines 86-87:
Changed lines 106-109 from:
From there, if you notice that your fiber tract is not correct, you can refine the process by creating more exclusion ROIs (see the First step) and re-creating your output (see Second Step). An example of what you can achieve for the CST is given in the example directory. >>>>>>>>>>>>>>>>>>>>>
to:
From there, if you notice that your fiber tract is not correct, you can refine the process by creating more exclusion ROIs (see the First step) and re-creating your output (see Second Step). An example of what you can achieve for the CST is given in the example directory.
Deleted line 65:
Changed lines 87-96 from:
>>>>>>>>>>>>>>>>>>>>>
!!!Third Step: From the fiber tracts to the medial rep The model behind this representation relies on [[Publications.Publications|Yushkevich et al., 2008]], which focuses on white matter tracts that are thin sheet-like structures. After segmentation of these tracts, the cm-rep model is fitted to them that describes the skeleton and the boundary of geometrical objects as parametric digital surfaces with predefined topology. This step relies on the continuous medial representation tool developed by Yushkevich et al. The main documentation and binaries can be found [[http://www.itksnap.org/pmwiki/pmwiki.php?n=CMREP.Documentation|here]]. It also utilizes the convert3D tools that you can find and download [[http://www.itksnap.org/pmwiki/pmwiki.php n=Convert3D.Documentation|here]]. Now you have your segmentations ready (they are grey-level images called, let's say, tract_greylevel.nii.gz), a few preprocessing steps are needed before building the cm-rep. These use convert3D. The main goal is to obtain a levelset image from the grey level segmentation. As stated in [[http://www.itksnap.org/pmwiki/pmwiki.php?n=Convert3D.Documentation|section''levelset n_iter'']], creating a levelset segmentation requires a speed function and an initialization function. The adapted commands are as follows (the recommended parameters are indicated here) ->1. Convert the grey level segmentation into a binary image: ->[@ c3d tract_greylevel.nii.gz -threshold 0.5 inf 1.0 0.0 -o tract_binary.nii.gz
to:
>>>>>>>>>>>>>>>>>>>>>>> ->1. Filter the whole brain tractography with your inclusion ROIs: -> [@ TractTool -in tensor.vtk -filter filtered_tract1.vtk -roi ROI_inclusion1.nii.gz -label label_for_roi1
Changed lines 93-95 from:
(see note at the bottom of this paragraph) ->2. Generate the speed function
to:
(this step is repeated for all the inclusion ROIs. ''-label'' is not required is the value of the label used in ITK-SNAP is 1) ->2. Filter the whole brain tractography with your exclusion ROIs/ exclude the erroneous tract:
Changed lines 98-99 from:
c3d tract_binary.nii.gz -shift -0.1 -o tract_speed.nii.gz
to:
TractTool -in filtered_tract1.vtk -filter filtered_tract2.vtk -roi ROI_inclusion2.nii.gz -label label_for_exclusion_roi -inclusion 0
Changed lines 102-103 from:
->3. Generate the initialization function ->[@ c3d tract\_binary.nii.gz -threshold 0.25 inf -0.5 0.5 -o tract_init.nii.gz
to:
->3. Transform the *.vtk into a grey level *.nii: Once the tract has been correctly filtered, the general output (here called filtered_tract2.vtk) is transformed into a nii file with ->[@ TractTool -in filtered_tract2.vtk -nifti output.nii.gz -target target.nii.gz
Changed lines 106-117 from:
->4. Produce the levelset function
to:
The output ''output.nii.gz'' will have the same dimensions as ''-target'', which can be a volume of your choice. From there, if you notice that your fiber tract is not correct, you can refine the process by creating more exclusion ROIs (see the First step) and re-creating your output (see Second Step). An example of what you can achieve for the CST is given in the example directory. >>>>>>>>>>>>>>>>>>>>> !!!Third Step: From the fiber tracts to the medial rep The model behind this representation relies on [[Publications.Publications|Yushkevich et al., 2008]], which focuses on white matter tracts that are thin sheet-like structures. After segmentation of these tracts, the cm-rep model is fitted to them that describes the skeleton and the boundary of geometrical objects as parametric digital surfaces with predefined topology. This step relies on the continuous medial representation tool developed by Yushkevich et al. The main documentation and binaries can be found [[http://www.itksnap.org/pmwiki/pmwiki.php?n=CMREP.Documentation|here]]. It also utilizes the convert3D tools that you can find and download [[http://www.itksnap.org/pmwiki/pmwiki.php n=Convert3D.Documentation|here]]. Now you have your segmentations ready (they are grey-level images called, let's say, tract_greylevel.nii.gz), a few preprocessing steps are needed before building the cm-rep. These use convert3D. The main goal is to obtain a levelset image from the grey level segmentation. As stated in [[http://www.itksnap.org/pmwiki/pmwiki.php?n=Convert3D.Documentation|section''levelset n_iter'']], creating a levelset segmentation requires a speed function and an initialization function. The adapted commands are as follows (the recommended parameters are indicated here) ->1. Convert the grey level segmentation into a binary image:
Changed line 119 from:
c3d tract_speed.nii.gz tract_init.nii.gz -levelset-curvature 0.02 -levelset 100 -o tract_levelset.nii.gz
to:
c3d tract_greylevel.nii.gz -threshold 0.5 inf 1.0 0.0 -o tract_binary.nii.gz
Changed lines 121-136 from:
to:
(see note at the bottom of this paragraph) ->2. Generate the speed function ->[@ c3d tract_binary.nii.gz -shift -0.1 -o tract_speed.nii.gz @] ->3. Generate the initialization function ->[@ c3d tract\_binary.nii.gz -threshold 0.25 inf -0.5 0.5 -o tract_init.nii.gz @] ->4. Produce the levelset function ->[@ c3d tract_speed.nii.gz tract_init.nii.gz -levelset-curvature 0.02 -levelset 100 -o tract_levelset.nii.gz @]
Changed lines 87-89 from:
->1. Filter the whole brain tractography with your inclusion ROIs: -> [@
TractTool -in tensor.vtk -filter filtered_tract1.vtk -roi ROI_inclusion1.nii.gz -label label_for_roi1
to:
>>>>>>>>>>>>>>>>>>>>> !!!Third Step: From the fiber tracts to the medial rep The model behind this representation relies on [[Publications.Publications|Yushkevich et al., 2008]], which focuses on white matter tracts that are thin sheet-like structures. After segmentation of these tracts, the cm-rep model is fitted to them that describes the skeleton and the boundary of geometrical objects as parametric digital surfaces with predefined topology. This step relies on the continuous medial representation tool developed by Yushkevich et al. The main documentation and binaries can be found [[http://www.itksnap.org/pmwiki/pmwiki.php?n=CMREP.Documentation|here]]. It also utilizes the convert3D tools that you can find and download [[http://www.itksnap.org/pmwiki/pmwiki.php n=Convert3D.Documentation|here]]. Now you have your segmentations ready (they are grey-level images called, let's say, tract_greylevel.nii.gz), a few preprocessing steps are needed before building the cm-rep. These use convert3D. The main goal is to obtain a levelset image from the grey level segmentation. As stated in [[http://www.itksnap.org/pmwiki/pmwiki.php?n=Convert3D.Documentation|section''levelset n_iter'']], creating a levelset segmentation requires a speed function and an initialization function. The adapted commands are as follows (the recommended parameters are indicated here) ->1. Convert the grey level segmentation into a binary image: ->[@ c3d tract_greylevel.nii.gz -threshold 0.5 inf 1.0 0.0 -o tract_binary.nii.gz
Changed lines 99-103 from:
(this step is repeated for all the inclusion ROIs. ''-label'' is not required is the value of the label used in ITK-SNAP is 1) ->2. Filter the whole brain tractography with your exclusion ROIs/ exclude the erroneous tract:
to:
(see note at the bottom of this paragraph) ->2. Generate the speed function
Changed line 103 from:
TractTool -in filtered_tract1.vtk -filter filtered_tract2.vtk -roi ROI_inclusion2.nii.gz -label label_for_exclusion_roi -inclusion 0
to:
c3d tract_binary.nii.gz -shift -0.1 -o tract_speed.nii.gz
Changed lines 106-108 from:
->3. Transform the *.vtk into a grey level *.nii: Once the tract has been correctly filtered, the general output (here called filtered_tract2.vtk) is transformed into a nii file with ->[@ TractTool -in filtered_tract2.vtk -nifti output.nii.gz -target target.nii.gz
to:
->3. Generate the initialization function ->[@ c3d tract\_binary.nii.gz -threshold 0.25 inf -0.5 0.5 -o tract_init.nii.gz
Changed lines 109-119 from:
The output `output.nii.gz' will have the same dimensions as `-target', which can be a volume of your choice. From there, if you notice that your fiber tract is not correct, you can refine the process by creating more exclusion ROIs (see \ref{first_step}) and re-creating your output (see \ref{second_step}). An example of what you can achieve for the CST is given in the example directory. >>>>>>>>>>>>>>>>>>>>> !!!Third Step: From the fiber tracts to the medial rep The model behind this representation relies on [[Publications.Publications|Yushkevich et al., 2008]], which focuses on white matter tracts that are thin sheet-like structures. After segmentation of these tracts, the cm-rep model is fitted to them that describes the skeleton and the boundary of geometrical objects as parametric digital surfaces with predefined topology. This step relies on the continuous medial representation tool developed by Yushkevich et al. The main documentation and binaries can be found [[http://www.itksnap.org/pmwiki/pmwiki.php?n=CMREP.Documentation|here]]. It also utilizes the convert3D tools that you can find and download [[http://www.itksnap.org/pmwiki/pmwiki.php n=Convert3D.Documentation|here]]. Now you have your segmentations ready (they are grey-level images called, let's say, tract_greylevel.nii.gz), a few preprocessing steps are needed before building the cm-rep. These use convert3D. The main goal is to obtain a levelset image from the grey level segmentation. As stated in [[http://www.itksnap.org/pmwiki/pmwiki.php?n=Convert3D.Documentation|section''levelset n_iter'']], creating a levelset segmentation requires a speed function and an initialization function. The adapted commands are as follows (the recommended parameters are indicated here) ->1. Convert the grey level segmentation into a binary image:
to:
->4. Produce the levelset function
Changed line 112 from:
c3d tract_greylevel.nii.gz -threshold 0.5 inf 1.0 0.0 -o tract_binary.nii.gz
to:
c3d tract_speed.nii.gz tract_init.nii.gz -levelset-curvature 0.02 -levelset 100 -o tract_levelset.nii.gz
Changed lines 114-129 from:
(see note at the bottom of this paragraph) ->2. Generate the speed function ->[@ c3d tract_binary.nii.gz -shift -0.1 -o tract_speed.nii.gz @] ->3. Generate the initialization function ->[@ c3d tract\_binary.nii.gz -threshold 0.25 inf -0.5 0.5 -o tract_init.nii.gz @] ->4. Produce the levelset function ->[@ c3d tract_speed.nii.gz tract_init.nii.gz -levelset-curvature 0.02 -levelset 100 -o tract_levelset.nii.gz @]
to:
Changed lines 67-77 from:
>>>>>>>>>>>>>>>>>>>>> !!!Third Step: From the fiber tracts to the medial rep The model behind this representation relies on [[Publications.Publications|Yushkevich et al., 2008]], which focuses on white matter tracts that are thin sheet-like structures. After segmentation of these tracts, the cm-rep model is fitted to them that describes the skeleton and the boundary of geometrical objects as parametric digital surfaces with predefined topology. This step relies on the continuous medial representation tool developed by Yushkevich et al. The main documentation and binaries can be found [[http://www.itksnap.org/pmwiki/pmwiki.php?n=CMREP.Documentation|here]]. It also utilizes the convert3D tools that you can find and download [[http://www.itksnap.org/pmwiki/pmwiki.php n=Convert3D.Documentation|here]]. Now you have your segmentations ready (they are grey-level images called, let's say, tract_greylevel.nii.gz), a few preprocessing steps are needed before building the cm-rep. These use convert3D. The main goal is to obtain a levelset image from the grey level segmentation. As stated in [[http://www.itksnap.org/pmwiki/pmwiki.php?n=Convert3D.Documentation|section''levelset n_iter'']], creating a levelset segmentation requires a speed function and an initialization function. The adapted commands are as follows (the recommended parameters are indicated here)
->1. Convert the grey level segmentation into a binary image: ->[@ c3d tract_greylevel.nii.gz -threshold 0.5 inf 1.0 0.0 -o tract_binary.nii.gz
to:
!!!First Step: delineating the fibers corresponding to each tract If you are not familiar with brain white matter tracts in general, you can gather some information in [[Publications.Publications|Mori et al., 2002]]. This paper has been revealed to be particularly helpful to delineate the aforementioned structures. Other resources can be helpful, such as [[Publications.Publications| Wakana et al., 2003 and Mori et al., 2002]]. The current aim is to delineate each tract. This might be the most important step because everything else results from this. # In ITK-Snap, open the FA image (figure 2) # Open the white matter mask as an overlay (figure 2) # Use the polygon tool to manually trace the ROIs through which the specific tract you are focusing on is passing # Once you are satisfied, go to Segmentation -> Save as Image -> Save your ROI as a *.nii.gz # To remember to which tract each ROI corresponds, you can use the label editor and name each ROI, then save the label descriptions -> Segmentation -> Save Label Descriptions # You will realize very frequently (ok, all the time!) that you not only have to draw ROIs through which the fibers are supposed to go through, but you also have to draw ROIs to exclude some fibers. An example of inclusion ROIs is given for the corpus callosum in figure 2. An example of exclusion ROI is given in figure 3. %center%%width=400px%Attach:FA_mask_ROI.jpg %center%Figure 2: An example with the aging atlas. ''Top left'': FA - ''Top right'': FA with white matter mask ''Bottom'': ROIs delineating the corpus callosum %center%%width=400px%Attach:ROI_exclusion.jpg %center%Figure 3: Exclusion ROIs for the corpus callosum !!!Second Step: Defining each tract For each tract, you should have drawn a few ROIs through which you expect the fibers to go (the inclusion ROIs) and a few (the exclusion ROIs) through which you expect your fibers not to go, which are here to get rid of the ''extra'' annoying fibers. The main tool that is used to generate each tract is called ''Tracttool''. ''Tracttool'' will be used to 1/filter the tracts, i.e., create one .vtk file per fiber tract -2/ convert the *.vtk into a .nii file (grey level image of the tract). Obtaining each fiber tract is an iterative procedure. The whole brain tractography (called tensor.vtk see paragraph first step) is filtered again and again until a reasonable fiber tract is obtained. Here is the way to do it: ->1. Filter the whole brain tractography with your inclusion ROIs: -> [@ TractTool -in tensor.vtk -filter filtered_tract1.vtk -roi ROI_inclusion1.nii.gz -label label_for_roi1
Changed lines 91-93 from:
(see note at the bottom of this paragraph) ->2. Generate the speed function
to:
(this step is repeated for all the inclusion ROIs. ''-label'' is not required is the value of the label used in ITK-SNAP is 1) ->2. Filter the whole brain tractography with your exclusion ROIs/ exclude the erroneous tract:
Changed line 97 from:
c3d tract_binary.nii.gz -shift -0.1 -o tract_speed.nii.gz
to:
TractTool -in filtered_tract1.vtk -filter filtered_tract2.vtk -roi ROI_inclusion2.nii.gz -label label_for_exclusion_roi -inclusion 0
Changed lines 100-101 from:
->3. Generate the initialization function ->[@ c3d tract\_binary.nii.gz -threshold 0.25 inf -0.5 0.5 -o tract_init.nii.gz
to:
->3. Transform the *.vtk into a grey level *.nii: Once the tract has been correctly filtered, the general output (here called filtered_tract2.vtk) is transformed into a nii file with ->[@ TractTool -in filtered_tract2.vtk -nifti output.nii.gz -target target.nii.gz
Changed lines 104-105 from:
->4. Produce the levelset function
to:
The output `output.nii.gz' will have the same dimensions as `-target', which can be a volume of your choice. From there, if you notice that your fiber tract is not correct, you can refine the process by creating more exclusion ROIs (see \ref{first_step}) and re-creating your output (see \ref{second_step}). An example of what you can achieve for the CST is given in the example directory. >>>>>>>>>>>>>>>>>>>>> !!!Third Step: From the fiber tracts to the medial rep The model behind this representation relies on [[Publications.Publications|Yushkevich et al., 2008]], which focuses on white matter tracts that are thin sheet-like structures. After segmentation of these tracts, the cm-rep model is fitted to them that describes the skeleton and the boundary of geometrical objects as parametric digital surfaces with predefined topology. This step relies on the continuous medial representation tool developed by Yushkevich et al. The main documentation and binaries can be found [[http://www.itksnap.org/pmwiki/pmwiki.php?n=CMREP.Documentation|here]]. It also utilizes the convert3D tools that you can find and download [[http://www.itksnap.org/pmwiki/pmwiki.php n=Convert3D.Documentation|here]]. Now you have your segmentations ready (they are grey-level images called, let's say, tract_greylevel.nii.gz), a few preprocessing steps are needed before building the cm-rep. These use convert3D. The main goal is to obtain a levelset image from the grey level segmentation. As stated in [[http://www.itksnap.org/pmwiki/pmwiki.php?n=Convert3D.Documentation|section''levelset n_iter'']], creating a levelset segmentation requires a speed function and an initialization function. The adapted commands are as follows (the recommended parameters are indicated here) ->1. Convert the grey level segmentation into a binary image:
Changed line 116 from:
c3d tract_speed.nii.gz tract_init.nii.gz -levelset-curvature 0.02 -levelset 100 -o tract_levelset.nii.gz
to:
c3d tract_greylevel.nii.gz -threshold 0.5 inf 1.0 0.0 -o tract_binary.nii.gz
Changed lines 118-133 from:
to:
(see note at the bottom of this paragraph) ->2. Generate the speed function ->[@ c3d tract_binary.nii.gz -shift -0.1 -o tract_speed.nii.gz @] ->3. Generate the initialization function ->[@ c3d tract\_binary.nii.gz -threshold 0.25 inf -0.5 0.5 -o tract_init.nii.gz @] ->4. Produce the levelset function ->[@ c3d tract_speed.nii.gz tract_init.nii.gz -levelset-curvature 0.02 -levelset 100 -o tract_levelset.nii.gz @]
Changed lines 66-90 from:
!!!First Step: delineating the fibers corresponding to each tract If you are not familiar with brain white matter tracts in general, you can gather some information in [[Publications.Publications|Mori et al., 2002]]. This paper has been revealed to be particularly helpful to delineate the aforementioned structures. Other resources can be helpful, such as [[Publications.Publications| Wakana et al., 2003 and Mori et al., 2002]]. The current aim is to delineate each tract. This might be the most important step because everything else results from this. # In ITK-Snap, open the FA image (figure 2) # Open the white matter mask as an overlay (figure 2) # Use the polygon tool to manually trace the ROIs through which the specific tract you are focusing on is passing # Once you are satisfied, go to Segmentation -> Save as Image -> Save your ROI as a *.nii.gz # To remember to which tract each ROI corresponds, you can use the label editor and name each ROI, then save the label descriptions -> Segmentation -> Save Label Descriptions
# You will realize very frequently (ok, all the time!) that you not only have to draw ROIs through which the fibers are supposed to go through, but you also have to draw ROIs to exclude some fibers. An example of inclusion ROIs is given for the corpus callosum in figure 2. An example of exclusion ROI is given in figure 3. %center%%width=400px%Attach:FA_mask_ROI.jpg %center%Figure 2: An example with the aging atlas. ''Top left'': FA - ''Top right'': FA with white matter mask ''Bottom'': ROIs delineating the corpus callosum %center%%width=400px%Attach:ROI_exclusion.jpg %center%Figure 3: Exclusion ROIs for the corpus callosum !!!Second Step: Defining each tract For each tract, you should have drawn a few ROIs through which you expect the fibers to go (the inclusion ROIs) and a few (the exclusion ROIs) through which you expect your fibers not to go, which are here to get rid of the ''extra'' annoying fibers. The main tool that is used to generate each tract is called ''Tracttool''. ''Tracttool'' will be used to 1/filter the tracts, i.e., create one .vtk file per fiber tract - 2/convert the *.vtk into a .nii file (grey level image of the tract). Obtaining each fiber tract is an iterative procedure. The whole brain tractography (called tensor.vtk see paragraph first step) is filtered again and again until a reasonable fiber tract is obtained. Here is the way to do it: ->1. Filter the whole brain tractography with your inclusion ROIs: -> [@ TractTool -in tensor.vtk -filter filtered_tract1.vtk -roi ROI_inclusion1.nii.gz -label label_for_roi1
to:
>>>>>>>>>>>>>>>>>>>>>>> >>>>>>>>>>>>>>>>>>>>> !!!Third Step: From the fiber tracts to the medial rep The model behind this representation relies on [[Publications.Publications|Yushkevich et al., 2008]], which focuses on white matter tracts that are thin sheet-like structures. After segmentation of these tracts, the cm-rep model is fitted to them that describes the skeleton and the boundary of geometrical objects as parametric digital surfaces with predefined topology. This step relies on the continuous medial representation tool developed by Yushkevich et al. The main documentation and binaries can be found [[http://www.itksnap.org/pmwiki/pmwiki.php?n=CMREP.Documentation|here]]. It also utilizes the convert3D tools that you can find and download [[http://www.itksnap.org/pmwiki/pmwiki.php n=Convert3D.Documentation|here]]. Now you have your segmentations ready (they are grey-level images called, let's say, tract_greylevel.nii.gz), a few preprocessing steps are needed before building the cm-rep. These use convert3D. The main goal is to obtain a levelset image from the grey level segmentation. As stated in [[http://www.itksnap.org/pmwiki/pmwiki.php?n=Convert3D.Documentation|section''levelset n_iter'']], creating a levelset segmentation requires a speed function and an initialization function. The adapted commands are as follows (the recommended parameters are indicated here) ->1. Convert the grey level segmentation into a binary image: ->[@ c3d tract_greylevel.nii.gz -threshold 0.5 inf 1.0 0.0 -o tract_binary.nii.gz
Changed lines 79-82 from:
(this step is repeated for all the inclusion ROIs. ''-label'' is not required is the value of the label used in ITK-SNAP is 1) ->2. Filter the whole brain tractography with your exclusion ROIs/ exclude the erroneous tract:
to:
(see note at the bottom of this paragraph) ->2. Generate the speed function
Changed lines 83-87 from:
TractTool -in filtered_tract1.vtk -filter filtered_tract2.vtk -roi ROI_inclusion2.nii.gz -label label_for_exclusion_roi -inclusion 0 @] ->3. Transform the *.vtk into a grey level *.nii: Once the tract has been correctly filtered, the general output (here called filtered_tract2.vtk) is transformed into a nii file with ->[@ TractTool -in filtered_tract2.vtk -nifti output.nii.gz -target target.nii.gz
to:
c3d tract_binary.nii.gz -shift -0.1 -o tract_speed.nii.gz
Changed lines 85-102 from:
The output `output.nii.gz' will have the same dimensions as `-target', which can be a volume of your choice.
From there, if you notice that your fiber tract is not correct, you can refine the process by creating more exclusion ROIs (see \ref{first_step}) and re-creating your output (see \ref{second_step}). An example of what you can achieve for the CST is given in the example directory. >>>>>>>>>>>>>>>>>>>>> >>>>>>>>>>>>>>>>>>>>>>> !!Creating the Surface Representation- 2nd part- the Continuous medial representation} We are going to switch to and focus on the cmp-rep model properly speaking, and use the [[http://www.itksnap.org/pmwiki/pmwiki.php?n=CMREP.Documentation|continuous medical rep]] tools only. The principle is to build the boundary and the corresponding skeleton for each tract. %center%%width=600px%Attach:boun_skel.jpg %center%Figure 5: ''Left'': An example of initial boundary for the corpus callosum - ''Right'': the corresponding skeleton !!!Building the initial template -1 In order to initiate the cmrep model, you need a primary template. The construction of this initial template starts with the generation of a skeleton and boundary from the previous levelset file. ->1. [@ vtklevelset tract_levelset.nii.gz tract_boundary.vtk 0.0
to:
->3. Generate the initialization function ->[@ c3d tract\_binary.nii.gz -threshold 0.25 inf -0.5 0.5 -o tract_init.nii.gz
Changed lines 90-92 from:
The last and only parameter is the threshold value. The higher the value, the slimmer the boundary. ->2. [@ cmrep_vskel -Q /PATH_TO_QVORONOI/qvoronoi -p ''p'' -e ''e'' -q ''q'' tract_boundary.vtk tract_skel.vtk
to:
->4. Produce the levelset function ->[@ c3d tract_speed.nii.gz tract_init.nii.gz -levelset-curvature 0.02 -levelset 100 -o tract_levelset.nii.gz
Added lines 95-120:
Congratulations! You have made it through the first part. There is still quite a way to go, but we are almost there.
''Note'': In some cases, especially for the CST, the filtering step is not enough to delineate the portion of the structure that is sheet-like. Consequently, I strongly suggest to act on the binary structure once it is created in the first step (i.e., step that converts the grey level segmentation into a binary image). At this point, you can open the binary image in ITK-SNAP (opening it as the image and as the segmentation is fine). Go to the 3D window -> click update mesh -> click 3D scalpel tool in the 3D Toolbox -> Change the label number to clear label in the Segmentation options and cut the stem of the CST -> Accept and update mesh. Save the new segmentation.
Figure 4 gives you an example.
%center%%width=700px%Attach:img_binary.jpg %center%Figure 4: An example of initial binary files for the cortico-spinal tract. In the bottom image, the stem was cut. The middle and right column illustrate how these two binaries are transformed into skeletons and boundaries during the next steps (see paragraph Building the initial template -1). Modeling the stem using the cmrep model would not be adapted.
!!Creating the Surface Representation- 2nd part- the Continuous medial representation} We are going to switch to and focus on the cmp-rep model properly speaking, and use the [[http://www.itksnap.org/pmwiki/pmwiki.php?n=CMREP.Documentation|continuous medical rep]] tools only. The principle is to build the boundary and the corresponding skeleton for each tract.
%center%%width=600px%Attach:boun_skel.jpg %center%Figure 5: ''Left'': An example of initial boundary for the corpus callosum - ''Right'': the corresponding skeleton
!!!Building the initial template -1 In order to initiate the cmrep model, you need a primary template. The construction of this initial template starts with the generation of a skeleton and boundary from the previous levelset file.
->1. [@ vtklevelset tract_levelset.nii.gz tract_boundary.vtk 0.0 @]
The last and only parameter is the threshold value. The higher the value, the slimmer the boundary.
->2. [@ cmrep_vskel -Q /PATH_TO_QVORONOI/qvoronoi -p ''p'' -e ''e'' -q ''q'' tract_boundary.vtk tract_skel.vtk @]
Changed lines 107-114 from:
!!!Third Step: From the fiber tracts to the medial rep The model behind this representation relies on [[Publications.Publications|Yushkevich et al., 2008]], which focuses on white matter tracts that are thin sheet-like structures. After segmentation of these tracts, the cm-rep model is fitted to them that describes the skeleton and the boundary of geometrical objects as parametric digital surfaces with predefined topology. This step relies on the continuous medial representation tool developed by Yushkevich et al. The main documentation and binaries can be found [[http://www.itksnap.org/pmwiki/pmwiki.php?n=CMREP.Documentation|here]]. It also utilizes the convert3D tools that you can find and download [[http://www.itksnap.org/pmwiki/pmwiki.php n=Convert3D.Documentation|here]]. Now you have your segmentations ready (they are grey-level images called, let's say, tract_greylevel.nii.gz), a few preprocessing steps are needed before building the cm-rep. These use convert3D. The main goal is to obtain a levelset image from the grey level segmentation. As stated in [[http://www.itksnap.org/pmwiki/pmwiki.php?n=Convert3D.Documentation|section''levelset n_iter'']], creating a levelset segmentation requires a speed function and an initialization function. The adapted commands are as follows (the recommended parameters are indicated here) ->1. Convert the grey level segmentation into a binary image: ->[@ c3d tract_greylevel.nii.gz -threshold 0.5 inf 1.0 0.0 -o tract_binary.nii.gz
to:
>>>>>>>>>>>>>>>>>>>>> >>>>>>>>>>>>>>>>>>>>>>> !!Creating the Surface Representation- 2nd part- the Continuous medial representation} We are going to switch to and focus on the cmp-rep model properly speaking, and use the [[http://www.itksnap.org/pmwiki/pmwiki.php?n=CMREP.Documentation|continuous medical rep]] tools only. The principle is to build the boundary and the corresponding skeleton for each tract. %center%%width=600px%Attach:boun_skel.jpg %center%Figure 5: ''Left'': An example of initial boundary for the corpus callosum - ''Right'': the corresponding skeleton !!!Building the initial template -1 In order to initiate the cmrep model, you need a primary template. The construction of this initial template starts with the generation of a skeleton and boundary from the previous levelset file. ->1. [@ vtklevelset tract_levelset.nii.gz tract_boundary.vtk 0.0
Changed lines 122-126 from:
(see note at the bottom of this paragraph) ->2. Generate the speed function ->[@ c3d tract_binary.nii.gz -shift -0.1 -o tract_speed.nii.gz
to:
The last and only parameter is the threshold value. The higher the value, the slimmer the boundary. ->2. [@ cmrep_vskel -Q /PATH_TO_QVORONOI/qvoronoi -p ''p'' -e ''e'' -q ''q'' tract_boundary.vtk tract_skel.vtk
Changed lines 128-129 from:
->3. Generate the initialization function ->[@ c3d tract\_binary.nii.gz -threshold 0.25 inf -0.5 0.5 -o tract_init.nii.gz
to:
The main factor here is the pruning factor ''p''. If ''p''=0, there is no pruning at all and the skeleton is very rough. The point when it starts making a difference is when $p=1$. For the thinnest structures, it is advice to choose ''p''=1.3 or 1.4. For the structures that contains less detail, ''p''=1.8 to ''p''=2 might be a good estimate. Modifying $p$ gives reasonable results for most of the tracts, however, some issues might happen when the tracts are at the limit of being sheet-like. At this point, you can also tweak the parameter ''e'' that is the minimal number of mesh edges separating two generator points of a VD face for it to be considered. The last parameter, ''q'' is the number of bins in each dimension. It defines the speed with which the program runs. A good value is ''q''=20-50. Reducing ''q'' reduces the number of vertices in the skeleton. For more information on each of the parameters and additional ones, you can type the command cmrep_vskel on the command line. The results should look like the ones of Figure 5 for the corpus callosum or of Figure 4 bottom line for the corticospinal tract. !!!Building the initial template -2 The next action is to build the true initial template, the one that will serve as an input in the final optimization. This is done with a matlab function, called tempinit.m. This function calls a few other ones, such as vtk_polydata_read.m, vtk_get_point_data.m as well as a package written by Kilian Weinberger that you can find [[http://www.cse.wustl.edu/~kilian/code/code.html|here]]. tempinit uses this maximum variable unfolding (MVU) algorithm, the general purpose of which is to reduce dimensionality. This function also depends on a library called Csdp, which you can download [[https://projects.coin-or.org/Csdp/|here]]. This library contains an executable (found in /bin/csdp), a copy of which should be put in the user's bin directory of the machine where you are running tempinit. The same applies to the c function called [[http://www.cs.cmu.edu/~quake/triangle.html|triangle]]. Once compiled, the executable should similarly go to your local bin directory. For more information about the different parameters of this matlab function, you can have a look at the .m file located in the example directory, where defaults and explanations are given for each of them. This program should output two files: medialtemplate.cmrep and medialtemplate.vtk, which are be the starting point for the very last step. !!!Building the initial template -3 The very last step of this process uses the function cmrep\_fit from the cm-rep package that we previously installed. Its inputs consist of the medialtemlate.cmrep files obtained above, the binary image as well as a parameter file and the output directory. The main command is ->[@ cmrep_fit param.txt medialtemplate.cmrep tract_binary.nii.gz cmrep_output
Changed lines 142-144 from:
->4. Produce the levelset function ->[@ c3d tract_speed.nii.gz tract_init.nii.gz -levelset-curvature 0.02 -levelset 100 -o tract_levelset.nii.gz
to:
The explanation for most of the parameters can be found on this [[http://www.itksnap.org/pmwiki/pmwiki.php?n=CMREP.Documentation|page]]. The first part of this parameter file contains the default parameters that control the values that you will see appearing on your terminal after launching this command (see Figure 6 and the param_output.txt in the demo folder provided with this tutorial). A few important facts should be retained. During the different iterations you should control that the TOTAL (see Figure 6) is decreasing. Each of the values VOLOV to BNDTRI contribute to this TOTAL and are driven by the default parameters. So you can adjust them by modifying the term weights of the parameter file.
#VOLOV translates the overlap between the model that is iteratively made and the binary #BNDJAC is driven by DefaultParameters.BoundaryJacobianEnergyTerm.Weight #DefaultParameters.BoundaryJacobianEnergyTerm.PenaltyA and #DefaultParameters.BoundaryJacobianEnergyTerm.PenaltyB #GRAD-R corresponds to DefaultParameters.BoundaryGradRPenaltyTerm.Weight #RADIUS to DefaultParameters.RadiusPenaltyTerm.Weight #LOOPTN to DefaultParameters.LoopTangentSchemeValidityPenaltyTerm.Weight #MEDTRI and BNDTRI express the quality of the triangulation, hence how much your model deform
%center%%width=600px%Attach:default_iteration.png %center%Figure 6: Example of output after submitting the cmrep_fit command. The total value decreases and each of the terms VOLOV to BNDTRI contribute to this decrease.
The second part of the parameter file controls each step of the run, from the alignment stage (translation and rotation) to the deformation stage (fitting of the model). All the parameters are straightforward to understand and thus to modify. One comment could be done about the blurring parameter, which can be tuned down if there are some finer structures to be preserved in the tract.
The output of this final step will be located in the cmrep_output directory, under three subdirectories, called cmrep, image and mesh. The optimized structure are in cmrep_output/mesh/, and called def3.med.vtk (the medial representation) and def3.bnd.vtk (boundary). An example can be found in Figure 7.
%center%%width=700px%Attach:work_flow.jpg %center%Figure 7: Pipeline illustrated on the CST
Congratulations, you have obtained your first white matter tract medial representation!
!!!Checking your template In order to check the accuracy of the template, it is worth comparing it to the original binary file, through a Dice overlap for instance. cmrep can be used to generate a binary file from the def3.med.vtk
->[@cmrep_fillmesh def3.med.vtk ref.nii.gz def3.nii.gz
Changed lines 172-180 from:
Congratulations! You have made it through the first part. There is still quite a way to go, but we are almost there. ''Note'': In some cases, especially for the CST, the filtering step is not enough to delineate the portion of the structure that is sheet-like. Consequently, I strongly suggest to act on the binary structure once it is created in the first step (i.e., step that converts the grey level segmentation into a binary image). At this point, you can open the binary image in ITK-SNAP (opening it as the image and as the segmentation is fine). Go to the 3D window -> click update mesh -> click 3D scalpel tool in the 3D Toolbox -> Change the label number to clear label in the Segmentation options and cut the stem of the CST -> Accept and update mesh. Save the new segmentation. Figure 4 gives you an example. %center%%width=700px%Attach:img_binary.jpg %center%Figure 4: An example of initial binary files for the cortico-spinal tract. In the bottom image, the stem was cut. The middle and right column illustrate how these two binaries are transformed into skeletons and boundaries during the next steps (see paragraph Building the initial template -1). Modeling the stem using the cmrep model would not be adapted.
to:
*ref.nii.gz can be the binary image itself. *The binary def3.nii.gz obtained from the information of the medial representation is then compared to the initial binary model through c3d -verbose def3.nii.gz tract_binary.nii.gz -overlap 1 (if the foreground of the binary image is 1). This command results in the computation of the Dice overlap. A value of 0.88 is satisfying.
Added lines 66-140:
!!!First Step: delineating the fibers corresponding to each tract If you are not familiar with brain white matter tracts in general, you can gather some information in [[Publications.Publications|Mori et al., 2002]]. This paper has been revealed to be particularly helpful to delineate the aforementioned structures. Other resources can be helpful, such as [[Publications.Publications| Wakana et al., 2003 and Mori et al., 2002]].
The current aim is to delineate each tract. This might be the most important step because everything else results from this.
# In ITK-Snap, open the FA image (figure 2) # Open the white matter mask as an overlay (figure 2) # Use the polygon tool to manually trace the ROIs through which the specific tract you are focusing on is passing # Once you are satisfied, go to Segmentation -> Save as Image -> Save your ROI as a *.nii.gz # To remember to which tract each ROI corresponds, you can use the label editor and name each ROI, then save the label descriptions -> Segmentation -> Save Label Descriptions # You will realize very frequently (ok, all the time!) that you not only have to draw ROIs through which the fibers are supposed to go through, but you also have to draw ROIs to exclude some fibers. An example of inclusion ROIs is given for the corpus callosum in figure 2. An example of exclusion ROI is given in figure 3.
%center%%width=400px%Attach:FA_mask_ROI.jpg %center%Figure 2: An example with the aging atlas. ''Top left'': FA - ''Top right'': FA with white matter mask ''Bottom'': ROIs delineating the corpus callosum
%center%%width=400px%Attach:ROI_exclusion.jpg %center%Figure 3: Exclusion ROIs for the corpus callosum
!!!Second Step: Defining each tract For each tract, you should have drawn a few ROIs through which you expect the fibers to go (the inclusion ROIs) and a few (the exclusion ROIs) through which you expect your fibers not to go, which are here to get rid of the ''extra'' annoying fibers. The main tool that is used to generate each tract is called ''Tracttool''. ''Tracttool'' will be used to 1/filter the tracts, i.e., create one .vtk file per fiber tract - 2/convert the *.vtk into a .nii file (grey level image of the tract). Obtaining each fiber tract is an iterative procedure. The whole brain tractography (called tensor.vtk see paragraph first step) is filtered again and again until a reasonable fiber tract is obtained. Here is the way to do it:
->1. Filter the whole brain tractography with your inclusion ROIs: -> [@ TractTool -in tensor.vtk -filter filtered_tract1.vtk -roi ROI_inclusion1.nii.gz -label label_for_roi1 @]
(this step is repeated for all the inclusion ROIs. ''-label'' is not required is the value of the label used in ITK-SNAP is 1) ->2. Filter the whole brain tractography with your exclusion ROIs/ exclude the erroneous tract:
->[@ TractTool -in filtered_tract1.vtk -filter filtered_tract2.vtk -roi ROI_inclusion2.nii.gz -label label_for_exclusion_roi -inclusion 0 @]
->3. Transform the *.vtk into a grey level *.nii: Once the tract has been correctly filtered, the general output (here called filtered_tract2.vtk) is transformed into a nii file with
->[@ TractTool -in filtered_tract2.vtk -nifti output.nii.gz -target target.nii.gz @] The output `output.nii.gz' will have the same dimensions as `-target', which can be a volume of your choice.
From there, if you notice that your fiber tract is not correct, you can refine the process by creating more exclusion ROIs (see \ref{first_step}) and re-creating your output (see \ref{second_step}). An example of what you can achieve for the CST is given in the example directory.
!!!Third Step: From the fiber tracts to the medial rep The model behind this representation relies on [[Publications.Publications|Yushkevich et al., 2008]], which focuses on white matter tracts that are thin sheet-like structures. After segmentation of these tracts, the cm-rep model is fitted to them that describes the skeleton and the boundary of geometrical objects as parametric digital surfaces with predefined topology. This step relies on the continuous medial representation tool developed by Yushkevich et al. The main documentation and binaries can be found [[http://www.itksnap.org/pmwiki/pmwiki.php?n=CMREP.Documentation|here]]. It also utilizes the convert3D tools that you can find and download [[http://www.itksnap.org/pmwiki/pmwiki.php n=Convert3D.Documentation|here]]. Now you have your segmentations ready (they are grey-level images called, let's say, tract_greylevel.nii.gz), a few preprocessing steps are needed before building the cm-rep. These use convert3D. The main goal is to obtain a levelset image from the grey level segmentation. As stated in [[http://www.itksnap.org/pmwiki/pmwiki.php?n=Convert3D.Documentation|section''levelset n_iter'']], creating a levelset segmentation requires a speed function and an initialization function. The adapted commands are as follows (the recommended parameters are indicated here)
->1. Convert the grey level segmentation into a binary image: ->[@ c3d tract_greylevel.nii.gz -threshold 0.5 inf 1.0 0.0 -o tract_binary.nii.gz @] (see note at the bottom of this paragraph)
->2. Generate the speed function ->[@ c3d tract_binary.nii.gz -shift -0.1 -o tract_speed.nii.gz @]
->3. Generate the initialization function ->[@ c3d tract\_binary.nii.gz -threshold 0.25 inf -0.5 0.5 -o tract_init.nii.gz @]
->4. Produce the levelset function ->[@ c3d tract_speed.nii.gz tract_init.nii.gz -levelset-curvature 0.02 -levelset 100 -o tract_levelset.nii.gz @]
Congratulations! You have made it through the first part. There is still quite a way to go, but we are almost there.
''Note'': In some cases, especially for the CST, the filtering step is not enough to delineate the portion of the structure that is sheet-like. Consequently, I strongly suggest to act on the binary structure once it is created in the first step (i.e., step that converts the grey level segmentation into a binary image). At this point, you can open the binary image in ITK-SNAP (opening it as the image and as the segmentation is fine). Go to the 3D window -> click update mesh -> click 3D scalpel tool in the 3D Toolbox -> Change the label number to clear label in the Segmentation options and cut the stem of the CST -> Accept and update mesh. Save the new segmentation.
Figure 4 gives you an example.
%center%%width=700px%Attach:img_binary.jpg %center%Figure 4: An example of initial binary files for the cortico-spinal tract. In the bottom image, the stem was cut. The middle and right column illustrate how these two binaries are transformed into skeletons and boundaries during the next steps (see paragraph Building the initial template -1). Modeling the stem using the cmrep model would not be adapted.
Added lines 12-65:
!!!Building the whole brain white matter Atlas using DTITK The first task is to build a whole brain white matter atlas (see [[Documentation.HomePage|tutorial page]]. If you are already familiar with DTI-TK, you can skip the first points of the tutorial and directly go to [[Documentation.Registration|''Registration and Spatial normalization of DTI volumes'']]. At the end of his, you will have created a white matter template (see Figure 1), which is necessary to build the tract specific template.
%center%%width=400px%Attach:atlas_example.png %center%Figure 1
!!!Main Goal Now the whole brain DT atlas has been created from your population, the main point is to delineate the tracts of interest and then create a medial (surface-based) representation for each one. As of December 2010, these tracts of interest that have been considered so far are *the corpus callosum (CC) *the inferior longitudinal fasciculus (ILF) *the uncinate fasciculus (UNC) *the superior longitudinal fasciculus (SLF) *the cortico-spinal tract (CST) *the inferior fronto-occipital fasciculus (IFO)
Such an atlas was already created using an aging population (65-83 yo) obtained from the ixi database (see in the example folder). This study was published in \cite{zhang2009}. Another one is in the process of being created. The underlying database is the same but we selected subjects belonging to an adult population from age 18 to 60.
Following the generation of this template, several applications are possible, such as the detection of white matter differences between two populations in these particular tracts (an example is in the aforementioned Zhang paper, where WM changes are identified between ALS and healthy subjects, based on the fractional anisotropy measure) or such as longitudinal studies.
!!Creating the Surface Representation- 1st part- starting with DTI-TK !!!What to start with? The preliminary steps consist of creating an FA images, a white matter mask as well as a whole brain tractography from the DT image.
->1. If the size of your atlas is too small, you might have problems to draw the detailed ROIs that will be needed in the next step. So, you might want to increase its size for the delineation to be more convenient. For this, you can use, the command TVResample. (e.g.: If the initial size of the atlas, tensor.nii.gz is 128x128x64 and its voxel space is 1.75x1.75x2.25, it can easily become 224x224x144 and 1x1x1, using the command ->[@ TVResample -in tensor.nii.gz -xs 224 -ys 224 -zs 144 -xv 1 -yv 1 -zv 1}) @]
->2. It is necessary to create a fractional anisotropy image from your atlas ->[@ TVAnisotropy -in tensor.nii.gz. This will output tensor_fa.nii.gz @]
->3. In addition, you also want to create a white matter mask, by thresholding the FA image (we suggest to threshold it to 0.2). In order to do that you can use the following command:
->[@ BinaryThresholdImageFilter tensor\_fa.nii.gz wm.nii.gz 0 0.2 0 1 @]
A whole brain tractography will be needed throughout this specific tract atlas construction. To do so, use
->[@ SingleTensorFT -in tensor.nii.gz -seed wm.nii.gz -out tensor.vtk @]
Other factors can be added, such as *''-label'' (default 1) - to be modified if the label of the seed (i.e., the white matter mask) is not 1 *''-minFA'' (default: 0.15) and `-maxAngle' (default: 45) which are stopping criteria *''-stepSize'' (default: 0.5 mm) *''-upsample'' (default 1). This number can be changed when using DTIs with very low resolution. To get denser tracts, the value can be set to 2 (or other puissance of 2). It inserts additional point within a voxel.
Deleted lines 11-158:
!!!Building the whole brain white matter Atlas using DTITK The first task is to build a whole brain white matter atlas (see [[Documentation.HomePage|tutorial page]]. If you are already familiar with DTI-TK, you can skip the first points of the tutorial and directly go to [[Documentation.Registration|''Registration and Spatial normalization of DTI volumes'']]. At the end of his, you will have created a white matter template (see Figure 1), which is necessary to build the tract specific template.
%center%%width=400px%Attach:atlas_example.png %center%Figure 1
!!!Main Goal Now the whole brain DT atlas has been created from your population, the main point is to delineate the tracts of interest and then create a medial (surface-based) representation for each one. As of December 2010, these tracts of interest that have been considered so far are *the corpus callosum (CC) *the inferior longitudinal fasciculus (ILF) *the uncinate fasciculus (UNC) *the superior longitudinal fasciculus (SLF) *the cortico-spinal tract (CST) *the inferior fronto-occipital fasciculus (IFO)
Such an atlas was already created using an aging population (65-83 yo) obtained from the ixi database (see in the example folder). This study was published in \cite{zhang2009}. Another one is in the process of being created. The underlying database is the same but we selected subjects belonging to an adult population from age 18 to 60.
Following the generation of this template, several applications are possible, such as the detection of white matter differences between two populations in these particular tracts (an example is in the aforementioned Zhang paper, where WM changes are identified between ALS and healthy subjects, based on the fractional anisotropy measure) or such as longitudinal studies.
!!Creating the Surface Representation- 1st part- starting with DTI-TK !!!What to start with? The preliminary steps consist of creating an FA images, a white matter mask as well as a whole brain tractography from the DT image.
->1. If the size of your atlas is too small, you might have problems to draw the detailed ROIs that will be needed in the next step. So, you might want to increase its size for the delineation to be more convenient. For this, you can use, the command TVResample. (e.g.: If the initial size of the atlas, tensor.nii.gz is 128x128x64 and its voxel space is 1.75x1.75x2.25, it can easily become 224x224x144 and 1x1x1, using the command ->[@ TVResample -in tensor.nii.gz -xs 224 -ys 224 -zs 144 -xv 1 -yv 1 -zv 1}) @]
->2. It is necessary to create a fractional anisotropy image from your atlas ->[@ TVAnisotropy -in tensor.nii.gz. This will output tensor_fa.nii.gz @]
->3. In addition, you also want to create a white matter mask, by thresholding the FA image (we suggest to threshold it to 0.2). In order to do that you can use the following command:
->[@ BinaryThresholdImageFilter tensor\_fa.nii.gz wm.nii.gz 0 0.2 0 1 @]
A whole brain tractography will be needed throughout this specific tract atlas construction. To do so, use
->[@ SingleTensorFT -in tensor.nii.gz -seed wm.nii.gz -out tensor.vtk @]
Other factors can be added, such as *''-label'' (default 1) - to be modified if the label of the seed (i.e., the white matter mask) is not 1 *''-minFA'' (default: 0.15) and `-maxAngle' (default: 45) which are stopping criteria *''-stepSize'' (default: 0.5 mm) *''-upsample'' (default 1). This number can be changed when using DTIs with very low resolution. To get denser tracts, the value can be set to 2 (or other puissance of 2). It inserts additional point within a voxel.
!!!First Step: delineating the fibers corresponding to each tract If you are not familiar with brain white matter tracts in general, you can gather some information in [[Publications.Publications|Mori et al., 2002]]. This paper has been revealed to be particularly helpful to delineate the aforementioned structures. Other resources can be helpful, such as [[Publications.Publications| Wakana et al., 2003 and Mori et al., 2002]].
The current aim is to delineate each tract. This might be the most important step because everything else results from this.
# In ITK-Snap, open the FA image (figure 2) # Open the white matter mask as an overlay (figure 2) # Use the polygon tool to manually trace the ROIs through which the specific tract you are focusing on is passing # Once you are satisfied, go to Segmentation -> Save as Image -> Save your ROI as a *.nii.gz # To remember to which tract each ROI corresponds, you can use the label editor and name each ROI, then save the label descriptions -> Segmentation -> Save Label Descriptions # You will realize very frequently (ok, all the time!) that you not only have to draw ROIs through which the fibers are supposed to go through, but you also have to draw ROIs to exclude some fibers. An example of inclusion ROIs is given for the corpus callosum in figure 2. An example of exclusion ROI is given in figure 3.
%center%%width=400px%Attach:FA_mask_ROI.jpg %center%Figure 2: An example with the aging atlas. ''Top left'': FA - ''Top right'': FA with white matter mask ''Bottom'': ROIs delineating the corpus callosum
%center%%width=400px%Attach:ROI_exclusion.jpg %center%Figure 3: Exclusion ROIs for the corpus callosum
!!!Second Step: Defining each tract For each tract, you should have drawn a few ROIs through which you expect the fibers to go (the inclusion ROIs) and a few (the exclusion ROIs) through which you expect your fibers not to go, which are here to get rid of the ''extra'' annoying fibers. The main tool that is used to generate each tract is called ''Tracttool''. ''Tracttool'' will be used to 1/filter the tracts, i.e., create one .vtk file per fiber tract - 2/convert the *.vtk into a .nii file (grey level image of the tract). Obtaining each fiber tract is an iterative procedure. The whole brain tractography (called tensor.vtk see paragraph first step) is filtered again and again until a reasonable fiber tract is obtained. Here is the way to do it:
->1. Filter the whole brain tractography with your inclusion ROIs: -> [@ TractTool -in tensor.vtk -filter filtered_tract1.vtk -roi ROI_inclusion1.nii.gz -label label_for_roi1 @]
(this step is repeated for all the inclusion ROIs. ''-label'' is not required is the value of the label used in ITK-SNAP is 1) ->2. Filter the whole brain tractography with your exclusion ROIs/ exclude the erroneous tract:
->[@ TractTool -in filtered_tract1.vtk -filter filtered_tract2.vtk -roi ROI_inclusion2.nii.gz -label label_for_exclusion_roi -inclusion 0 @]
->3. Transform the *.vtk into a grey level *.nii: Once the tract has been correctly filtered, the general output (here called filtered_tract2.vtk) is transformed into a nii file with
->[@ TractTool -in filtered_tract2.vtk -nifti output.nii.gz -target target.nii.gz @] The output `output.nii.gz' will have the same dimensions as `-target', which can be a volume of your choice.
From there, if you notice that your fiber tract is not correct, you can refine the process by creating more exclusion ROIs (see \ref{first_step}) and re-creating your output (see \ref{second_step}). An example of what you can achieve for the CST is given in the example directory.
!!!Third Step: From the fiber tracts to the medial rep The model behind this representation relies on [[Publications.Publications|Yushkevich et al., 2008]], which focuses on white matter tracts that are thin sheet-like structures. After segmentation of these tracts, the cm-rep model is fitted to them that describes the skeleton and the boundary of geometrical objects as parametric digital surfaces with predefined topology. This step relies on the continuous medial representation tool developed by Yushkevich et al. The main documentation and binaries can be found [[http://www.itksnap.org/pmwiki/pmwiki.php?n=CMREP.Documentation|here]]. It also utilizes the convert3D tools that you can find and download [[http://www.itksnap.org/pmwiki/pmwiki.php n=Convert3D.Documentation|here]]. Now you have your segmentations ready (they are grey-level images called, let's say, tract_greylevel.nii.gz), a few preprocessing steps are needed before building the cm-rep. These use convert3D. The main goal is to obtain a levelset image from the grey level segmentation. As stated in [[http://www.itksnap.org/pmwiki/pmwiki.php?n=Convert3D.Documentation|section''levelset n_iter'']], creating a levelset segmentation requires a speed function and an initialization function. The adapted commands are as follows (the recommended parameters are indicated here)
->1. Convert the grey level segmentation into a binary image: ->[@ c3d tract_greylevel.nii.gz -threshold 0.5 inf 1.0 0.0 -o tract_binary.nii.gz @] (see note at the bottom of this paragraph)
->2. Generate the speed function ->[@ c3d tract_binary.nii.gz -shift -0.1 -o tract_speed.nii.gz @]
->3. Generate the initialization function ->[@ c3d tract\_binary.nii.gz -threshold 0.25 inf -0.5 0.5 -o tract_init.nii.gz @]
->4. Produce the levelset function ->[@ c3d tract_speed.nii.gz tract_init.nii.gz -levelset-curvature 0.02 -levelset 100 -o tract_levelset.nii.gz @]
Congratulations! You have made it through the first part. There is still quite a way to go, but we are almost there.
''Note'': In some cases, especially for the CST, the filtering step is not enough to delineate the portion of the structure that is sheet-like. Consequently, I strongly suggest to act on the binary structure once it is created in the first step (i.e., step that converts the grey level segmentation into a binary image). At this point, you can open the binary image in ITK-SNAP (opening it as the image and as the segmentation is fine). Go to the 3D window -> click update mesh -> click 3D scalpel tool in the 3D Toolbox -> Change the label number to clear label in the Segmentation options and cut the stem of the CST -> Accept and update mesh. Save the new segmentation.
Figure 4 gives you an example.
%center%%width=700px%Attach:img_binary.jpg %center%Figure 4: An example of initial binary files for the cortico-spinal tract. In the bottom image, the stem was cut. The middle and right column illustrate how these two binaries are transformed into skeletons and boundaries during the next steps (see paragraph Building the initial template -1). Modeling the stem using the cmrep model would not be adapted.
!!Creating the Surface Representation- 2nd part- the Continuous medial representation} We are going to switch to and focus on the cmp-rep model properly speaking, and use the [[http://www.itksnap.org/pmwiki/pmwiki.php?n=CMREP.Documentation|continuous medical rep]] tools only. The principle is to build the boundary and the corresponding skeleton for each tract.
%center%%width=600px%Attach:boun_skel.jpg %center%Figure 5: ''Left'': An example of initial boundary for the corpus callosum - ''Right'': the corresponding skeleton
!!!Building the initial template -1 In order to initiate the cmrep model, you need a primary template. The construction of this initial template starts with the generation of a skeleton and boundary from the previous levelset file.
->1. [@ vtklevelset tract_levelset.nii.gz tract_boundary.vtk 0.0 @]
The last and only parameter is the threshold value. The higher the value, the slimmer the boundary.
->2. [@ cmrep_vskel -Q /PATH_TO_QVORONOI/qvoronoi -p ''p'' -e ''e'' -q ''q'' tract_boundary.vtk tract_skel.vtk @]
The main factor here is the pruning factor ''p''. If ''p''=0, there is no pruning at all and the skeleton is very rough. The point when it starts making a difference is when $p=1$. For the thinnest structures, it is advice to choose ''p''=1.3 or 1.4. For the structures that contains less detail, ''p''=1.8 to ''p''=2 might be a good estimate. Modifying $p$ gives reasonable results for most of the tracts, however, some issues might happen when the tracts are at the limit of being sheet-like. At this point, you can also tweak the parameter ''e'' that is the minimal number of mesh edges separating two generator points of a VD face for it to be considered. The last parameter, ''q'' is the number of bins in each dimension. It defines the speed with which the program runs. A good value is ''q''=20-50. Reducing ''q'' reduces the number of vertices in the skeleton. For more information on each of the parameters and additional ones, you can type the command cmrep_vskel on the command line. The results should look like the ones of Figure 5 for the corpus callosum or of Figure 4 bottom line for the corticospinal tract.
Deleted lines 159-201:
!!!Building the initial template -2 The next action is to build the true initial template, the one that will serve as an input in the final optimization. This is done with a matlab function, called tempinit.m. This function calls a few other ones, such as vtk_polydata_read.m, vtk_get_point_data.m as well as a package written by Kilian Weinberger that you can find [[http://www.cse.wustl.edu/~kilian/code/code.html|here]]. tempinit uses this maximum variable unfolding (MVU) algorithm, the general purpose of which is to reduce dimensionality. This function also depends on a library called Csdp, which you can download [[https://projects.coin-or.org/Csdp/|here]]. This library contains an executable (found in /bin/csdp), a copy of which should be put in the user's bin directory of the machine where you are running tempinit. The same applies to the c function called [[http://www.cs.cmu.edu/~quake/triangle.html|triangle]]. Once compiled, the executable should similarly go to your local bin directory. For more information about the different parameters of this matlab function, you can have a look at the .m file located in the example directory, where defaults and explanations are given for each of them. This program should output two files: medialtemplate.cmrep and medialtemplate.vtk, which are be the starting point for the very last step.
!!!Building the initial template -3 The very last step of this process uses the function cmrep\_fit from the cm-rep package that we previously installed. Its inputs consist of the medialtemlate.cmrep files obtained above, the binary image as well as a parameter file and the output directory. The main command is
->[@ cmrep_fit param.txt medialtemplate.cmrep tract_binary.nii.gz cmrep_output @]
The explanation for most of the parameters can be found on this [[http://www.itksnap.org/pmwiki/pmwiki.php?n=CMREP.Documentation|page]]. The first part of this parameter file contains the default parameters that control the values that you will see appearing on your terminal after launching this command (see Figure 6 and the param_output.txt in the demo folder provided with this tutorial). A few important facts should be retained. During the different iterations you should control that the TOTAL (see Figure 6) is decreasing. Each of the values VOLOV to BNDTRI contribute to this TOTAL and are driven by the default parameters. So you can adjust them by modifying the term weights of the parameter file.
#VOLOV translates the overlap between the model that is iteratively made and the binary #BNDJAC is driven by DefaultParameters.BoundaryJacobianEnergyTerm.Weight #DefaultParameters.BoundaryJacobianEnergyTerm.PenaltyA and #DefaultParameters.BoundaryJacobianEnergyTerm.PenaltyB #GRAD-R corresponds to DefaultParameters.BoundaryGradRPenaltyTerm.Weight #RADIUS to DefaultParameters.RadiusPenaltyTerm.Weight #LOOPTN to DefaultParameters.LoopTangentSchemeValidityPenaltyTerm.Weight #MEDTRI and BNDTRI express the quality of the triangulation, hence how much your model deform
%center%%width=600px%Attach:default_iteration.png %center%Figure 6: Example of output after submitting the cmrep_fit command. The total value decreases and each of the terms VOLOV to BNDTRI contribute to this decrease.
The second part of the parameter file controls each step of the run, from the alignment stage (translation and rotation) to the deformation stage (fitting of the model). All the parameters are straightforward to understand and thus to modify. One comment could be done about the blurring parameter, which can be tuned down if there are some finer structures to be preserved in the tract.
The output of this final step will be located in the cmrep_output directory, under three subdirectories, called cmrep, image and mesh. The optimized structure are in cmrep_output/mesh/, and called def3.med.vtk (the medial representation) and def3.bnd.vtk (boundary). An example can be found in Figure 7.
%center%%width=700px%Attach:work_flow.jpg %center%Figure 7: Pipeline illustrated on the CST
Congratulations, you have obtained your first white matter tract medial representation!
!!!Checking your template In order to check the accuracy of the template, it is worth comparing it to the original binary file, through a Dice overlap for instance. cmrep can be used to generate a binary file from the def3.med.vtk
->[@cmrep_fillmesh def3.med.vtk ref.nii.gz def3.nii.gz @]
*ref.nii.gz can be the binary image itself. *The binary def3.nii.gz obtained from the information of the medial representation is then compared to the initial binary model through c3d -verbose def3.nii.gz tract_binary.nii.gz -overlap 1 (if the foreground of the binary image is 1). This command results in the computation of the Dice overlap. A value of 0.88 is satisfying.
Changed line 65 from:
!!First Step: delineating the fibers corresponding to each tract
to:
!!!First Step: delineating the fibers corresponding to each tract
Changed line 83 from:
!!Second Step: Defining each tract
to:
!!!Second Step: Defining each tract
Changed line 106 from:
!!Third Step: From the fiber tracts to the medial rep
to:
!!!Third Step: From the fiber tracts to the medial rep
Changed line 164 from:
!!Building the initial template -3
to:
!!!Building the initial template -3
Changed line 146 from:
!!Building the initial template -1
to:
!!!Building the initial template -1
Changed line 160 from:
!!Building the initial template -2
to:
!!!Building the initial template -2
Changed line 195 from:
to:
!!!Checking your template
Changed line 13 from:
!!Building the whole brain white matter Atlas using DTITK
to:
!!!Building the whole brain white matter Atlas using DTITK
Changed line 19 from:
to:
Changed lines 6-8 from:
Creating a tract specific white matter atlas is the result of the combination of three main open-source software developed in PICSL. The first main part relies on DTI-TK. The last steps rely on the continuous medial representation model (cm-rep) (see [[http://www.itksnap.org/pmwiki/pmwiki.php?n=CMREP.Documentation| url]] for installation and documentation). Another companion tool that will be needed here is convert3D (see [[http://www.itksnap.org/pmwiki/pmwiki.php?n=Convert3D.Documentation|here]]).
to:
Creating a tract specific white matter atlas is the result of the combination of three main open-source software developed in PICSL. The first main part relies on DTI-TK. The last steps rely on the continuous medial representation model (cm-rep) (see [[http://www.itksnap.org/pmwiki/pmwiki.php n=CMREP.Documentation| url]] for installation and documentation). Another companion tool that will be needed here is convert3D (see [[http://www.itksnap.org/pmwiki/pmwiki.php?n=Convert3D.Documentation|here]]).
Changed line 147 from:
!!Building the initial template 1
to:
!!Building the initial template -1
Added line 149:
Changed lines 153-154 from:
The last and only parameter is the threshold value. The higher the value, the slimmer the boundary
to:
The last and only parameter is the threshold value. The higher the value, the slimmer the boundary.
Changed lines 158-159 from:
The main factor here is the pruning factor ''p''. If ''p''=0, there is no pruning at all and the skeleton is very rough. The point when it starts making a difference is when $p=1$. For the thinnest structures, it is advice to choose ''p''=1.3 or 1.4. For the structures that contains less detail, ''p''=1.8 to ''p''=2 might be a good estimate. Modifying $p$ gives reasonable results for most of the tracts, however, some issues might happen when the tracts are at the limit of being sheet-like. At this point, you can also tweak the parameter $e$ that is the minimal number of mesh edges separating two generator points of a VD face for it to be considered. The last parameter, ''q'' is the number of bins in each dimension. It defines the speed with which the program runs. A good value is ''q''=20-50. Reducing ''q'' reduces the number of vertices in the skeleton. For more information on each of the parameters and additional ones, you can type the command cmrep_vskel on the command line.
to:
The main factor here is the pruning factor ''p''. If ''p''=0, there is no pruning at all and the skeleton is very rough. The point when it starts making a difference is when $p=1$. For the thinnest structures, it is advice to choose ''p''=1.3 or 1.4. For the structures that contains less detail, ''p''=1.8 to ''p''=2 might be a good estimate. Modifying $p$ gives reasonable results for most of the tracts, however, some issues might happen when the tracts are at the limit of being sheet-like. At this point, you can also tweak the parameter ''e'' that is the minimal number of mesh edges separating two generator points of a VD face for it to be considered. The last parameter, ''q'' is the number of bins in each dimension. It defines the speed with which the program runs. A good value is ''q''=20-50. Reducing ''q'' reduces the number of vertices in the skeleton. For more information on each of the parameters and additional ones, you can type the command cmrep_vskel on the command line.
Changed lines 166-168 from:
The very last step of this process uses the function cmrep\_fit from the cm-rep package that we previously installed. Its inputs consist of the medialtemlate.cmrep files obtained above, the binary image as well as a parameter file and the output directory. The main command is
to:
The very last step of this process uses the function cmrep\_fit from the cm-rep package that we previously installed. Its inputs consist of the medialtemlate.cmrep files obtained above, the binary image as well as a parameter file and the output directory. The main command is
Changed lines 172-174 from:
The explanation for most of the parameters can be found on this [http://www.itksnap.org/pmwiki/pmwiki.php?n=CMREP.Documentation|page]]. The first part of this parameter file contains the default parameters that control the values that you will see appearing on your terminal after launching this command (see Figure 6 and the param_output.txt in the demo folder provided with this tutorial). A few important facts should be retained. During the different iterations you should control that the TOTAL (see Figure 6) is decreasing. Each of the values VOLOV to BNDTRI contribute to this TOTAL and are driven by the default parameters. So you can adjust them by modifying the term weights of the parameter file.
to:
The explanation for most of the parameters can be found on this [[http://www.itksnap.org/pmwiki/pmwiki.php?n=CMREP.Documentation|page]]. The first part of this parameter file contains the default parameters that control the values that you will see appearing on your terminal after launching this command (see Figure 6 and the param_output.txt in the demo folder provided with this tutorial). A few important facts should be retained. During the different iterations you should control that the TOTAL (see Figure 6) is decreasing. Each of the values VOLOV to BNDTRI contribute to this TOTAL and are driven by the default parameters. So you can adjust them by modifying the term weights of the parameter file.
Changed lines 176-177 from:
# BNDJAC is driven by DefaultParameters.BoundaryJacobianEnergyTerm.Weight, # #DefaultParameters.BoundaryJacobianEnergyTerm.PenaltyA and
to:
#BNDJAC is driven by DefaultParameters.BoundaryJacobianEnergyTerm.Weight #DefaultParameters.BoundaryJacobianEnergyTerm.PenaltyA and
Changed line 179 from:
# GRAD-R corresponds to DefaultParameters.BoundaryGradRPenaltyTerm.Weight
to:
#GRAD-R corresponds to DefaultParameters.BoundaryGradRPenaltyTerm.Weight
Changed lines 183-184 from:
to:
Changed line 191 from:
%center%%width=800px%Attach:work_flow.jpg
to:
%center%%width=700px%Attach:work_flow.jpg
Changed lines 197-199 from:
In order to check the accuracy of the template, it is worth comparing it to the original binary file, through a Dice overlap for instance. cmrep can be used to generate a binary file from the def3.med.vtk
to:
In order to check the accuracy of the template, it is worth comparing it to the original binary file, through a Dice overlap for instance. cmrep can be used to generate a binary file from the def3.med.vtk
Changed lines 203-204 from:
*The binary def3.nii.gz obtained from the information of the medial representation is then compared to the initial binary model through c3d -verbose def3.nii.gz tract_binary.nii.gz -overlap 1 (if the foreground of the binary image is 1). This command results in the computation of the Dice overlap. A value of 0.88 is satisfying.
to:
*The binary def3.nii.gz obtained from the information of the medial representation is then compared to the initial binary model through c3d -verbose def3.nii.gz tract_binary.nii.gz -overlap 1 (if the foreground of the binary image is 1). This command results in the computation of the Dice overlap. A value of 0.88 is satisfying.
Changed lines 186-189 from:
%center%Figure 6: Example of output after submitting the cmrep_fit command. %center%The total value decreases and each of the terms VOLOV to BNDTRI contribute to this decrease.
to:
%center%Figure 6: Example of output after submitting the cmrep_fit command. The total value decreases and each of the terms VOLOV to BNDTRI contribute to this decrease.
Changed line 138 from:
%center%%width=400px%Attach:img_binary.jpg
to:
%center%%width=700px%Attach:img_binary.jpg
Changed line 144 from:
%center%%width=400px%Attach:boun_skel.jpg
to:
%center%%width=600px%Attach:boun_skel.jpg
Changed line 154 from:
->2. [@ cmrep_vskel -Q /PATH\_TO\_QVORONOI/qvoronoi -p ''p'' -e ''e'' -q ''q'' tract_boundary.vtk tract_skel.vtk
to:
->2. [@ cmrep_vskel -Q /PATH_TO_QVORONOI/qvoronoi -p ''p'' -e ''e'' -q ''q'' tract_boundary.vtk tract_skel.vtk
Changed line 185 from:
%center%%width=450px%Attach:default_iteration.png
to:
%center%%width=600px%Attach:default_iteration.png
Changed line 44 from:
TVAnisotropy -in tensor.nii.gz}. This will output tensor_fa.nii.gz
to:
TVAnisotropy -in tensor.nii.gz. This will output tensor_fa.nii.gz
Changed lines 79-82 from:
%center%Figure 2: An example with the aging atlas. %center%''Top left'': FA - ''Top right'': FA with white matter mask ''Bottom'': ROIs delineating the corpus callosum
to:
%center%Figure 2: An example with the aging atlas. ''Top left'': FA - ''Top right'': FA with white matter mask ''Bottom'': ROIs delineating the corpus callosum
Changed lines 145-147 from:
%center%Figure 5: ''Left'': An example of initial boundary for the corpus callosum - %center%''Right'': the corresponding skeleton
to:
%center%Figure 5: ''Left'': An example of initial boundary for the corpus callosum - ''Right'': the corresponding skeleton
Changed line 208 from:
This command results in the computation of the Dice overlap. A value of 0.92 is satisfying.
to:
This command results in the computation of the Dice overlap. A value of 0.88 is satisfying.
Changed line 74 from:
# Once you are satisfied, go to Segmentation $\rightarrow$ Save as Image $\rightarrow$ Save your ROI as a *.nii.gz
to:
# Once you are satisfied, go to Segmentation -> Save as Image -> Save your ROI as a *.nii.gz
Changed lines 148-150 from:
''Right'': the corresponding skeleton
to:
%center%''Right'': the corresponding skeleton
Changed lines 18-19 from:
to:
Changed lines 79-80 from:
%center%An example with the aging atlas.
to:
%center%Figure 2: An example with the aging atlas.
Changed lines 84-85 from:
%center%Exclusion ROIs for the corpus callosum
to:
%center%Figure 3: Exclusion ROIs for the corpus callosum
Changed lines 141-142 from:
%center%An example of initial binary files for the cortico-spinal tract. In the bottom image, the stem was cut. The middle and right column illustrate how these two binaries are transformed into skeletons and boundaries during the next steps (see paragraph \ref{Building the initial template -1}). Modeling the stem using the cmrep model would not be adapted.
to:
%center%Figure 4: An example of initial binary files for the cortico-spinal tract. In the bottom image, the stem was cut. The middle and right column illustrate how these two binaries are transformed into skeletons and boundaries during the next steps (see paragraph Building the initial template -1). Modeling the stem using the cmrep model would not be adapted.
Changed lines 147-148 from:
%center%''Left'': An example of initial boundary for the corpus callosum - ''Right'': the corresponding skeleton
to:
%center%Figure 5: ''Left'': An example of initial boundary for the corpus callosum - ''Right'': the corresponding skeleton
Changed lines 189-191 from:
%center%%width=200px%Attach:default_iteration.png %center%Example of output after submitting the cmrep_fit command. The total value decreases and each of the terms VOLOV to BNDTRI contribute to this decrease.
to:
%center%%width=450px%Attach:default_iteration.png %center%Figure 6: Example of output after submitting the cmrep_fit command. %center%The total value decreases and each of the terms VOLOV to BNDTRI contribute to this decrease.
Changed lines 199-202 from:
%center%Pipeline illustrated on the CST Congratulations, you obtained your first white matter tract medial representation!
to:
%center%Figure 7: Pipeline illustrated on the CST Congratulations, you have obtained your first white matter tract medial representation!
Added line 209:
Changed lines 78-79 from:
%center%An example with the aging atlas. ''Top left'': FA - ''Top right'': FA with white matter mask ''Bottom'': ROIs delineating the corpus callosum
to:
%center%An example with the aging atlas. %center%''Top left'': FA - ''Top right'': FA with white matter mask ''Bottom'': ROIs delineating the corpus callosum
Changed line 93 from:
(this step is repeated for all the inclusion ROIs. `-label' is not required is the value of the label used in ITK-SNAP is 1)
to:
(this step is repeated for all the inclusion ROIs. ''-label'' is not required is the value of the label used in ITK-SNAP is 1)
Changed lines 99-101 from:
->3. Transform the *.vtk into a grey level *.nii: Once the tract has been correctly filtered, the general output (here called filtered\_tract2.vtk) is transformed into a nii file with ->[@ TractTool -in filtered\_tract2.vtk -nifti output.nii.gz -target target.nii.gz
to:
->3. Transform the *.vtk into a grey level *.nii: Once the tract has been correctly filtered, the general output (here called filtered_tract2.vtk) is transformed into a nii file with ->[@ TractTool -in filtered_tract2.vtk -nifti output.nii.gz -target target.nii.gz
Changed lines 190-192 from:
The output of this final step will be located in the cmrep\_output/ directory, under three subdirectories, called cmrep, image and mesh. The optimized structure are in cmrep\_output/mesh/, and called def3.med.vtk (the medial representation) and def3.bnd.vtk (boundary). An example can be found in Figure 7. %center%%width=600px%Attach:work_flow.jpg
to:
The output of this final step will be located in the cmrep_output directory, under three subdirectories, called cmrep, image and mesh. The optimized structure are in cmrep_output/mesh/, and called def3.med.vtk (the medial representation) and def3.bnd.vtk (boundary). An example can be found in Figure 7. %center%%width=800px%Attach:work_flow.jpg
Changed lines 17-18 from:
%center%%width=150px%Attach:atlas_example.png
to:
%center%%width=400px%Attach:atlas_example.png
Changed line 77 from:
%center%%width=150px%Attach:FA_mask_ROI.jpg
to:
%center%%width=400px%Attach:FA_mask_ROI.jpg
Changed line 80 from:
%center%Attach:ROI_exclusion.jpg
to:
%center%%width=400px%Attach:ROI_exclusion.jpg
Changed line 137 from:
%center%Attach:img_binary
to:
%center%%width=400px%Attach:img_binary.jpg
Changed line 143 from:
to:
%center%%width=400px%Attach:boun_skel.jpg
Changed line 184 from:
%center%Attach:default_iteration}
to:
%center%%width=200px%Attach:default_iteration.png
Changed line 191 from:
to:
%center%%width=600px%Attach:work_flow.jpg
Changed lines 17-18 from:
%center%Attach:atlas_example.png
to:
%center%%width=150px%Attach:atlas_example.png
Changed line 77 from:
%center%Attach:FA_mask_ROI.jpg
to:
%center%%width=150px%Attach:FA_mask_ROI.jpg
Changed line 77 from:
%center%Attach:FA_mask_ROI
to:
%center%Attach:FA_mask_ROI.jpg
Changed line 80 from:
%center%Attach:ROI_exclusion
to:
%center%Attach:ROI_exclusion.jpg
Changed line 107 from:
The model behind this representation relies on the following paper \cite{yushkevich2008} that focuses on white matter tracts that are thin sheet-like structures. After segmentation of these tracts, the cm-rep model is fitted to them that describes the skeleton and the boundary of geometrical objects as parametric digital surfaces with predefined topology. This step relies on the continuous medial representation tool developed by Yushkevich et al. The main documentation and binaries can be found [[http://www.itksnap.org/pmwiki/pmwiki.php?n=CMREP.Documentation|here]]. It also utilizes the convert3D tools that you can find and download [[http://www.itksnap.org/pmwiki/pmwiki.php n=Convert3D.Documentation|here]].
to:
The model behind this representation relies on [[Publications.Publications|Yushkevich et al., 2008]], which focuses on white matter tracts that are thin sheet-like structures. After segmentation of these tracts, the cm-rep model is fitted to them that describes the skeleton and the boundary of geometrical objects as parametric digital surfaces with predefined topology. This step relies on the continuous medial representation tool developed by Yushkevich et al. The main documentation and binaries can be found [[http://www.itksnap.org/pmwiki/pmwiki.php?n=CMREP.Documentation|here]]. It also utilizes the convert3D tools that you can find and download [[http://www.itksnap.org/pmwiki/pmwiki.php n=Convert3D.Documentation|here]].
Changed lines 109-110 from:
The main goal is to obtain a levelset image from the grey level segmentation. As stated in [[http://www.itksnap.org/pmwiki/pmwiki.php?n=Convert3D.Documentation|section''levelset n_iter'', creating a levelset segmentation requires a speed function and an initialization function. The adapted commands are as follows (the recommended parameters are indicated here)
to:
The main goal is to obtain a levelset image from the grey level segmentation. As stated in [[http://www.itksnap.org/pmwiki/pmwiki.php?n=Convert3D.Documentation|section''levelset n_iter'']], creating a levelset segmentation requires a speed function and an initialization function. The adapted commands are as follows (the recommended parameters are indicated here)
Changed lines 7-8 from:
Another companion tool that will be needed here is convert3D (see [[http://www.itksnap.org/pmwiki/pmwiki.php?n=Convert3D.Documentation|here]).
to:
Another companion tool that will be needed here is convert3D (see [[http://www.itksnap.org/pmwiki/pmwiki.php?n=Convert3D.Documentation|here]]).
Changed lines 55-56 from:
SingleTensorFT -in tensor.nii.gz -seed wm.nii.gz -out tensor.vtk]
to:
SingleTensorFT -in tensor.nii.gz -seed wm.nii.gz -out tensor.vtk @]
Changed lines 66-68 from:
If you are not familiar with brain white matter tracts in general, you can gather some information in Mori et al., 2002 [[Publications.Publications]]. This paper has been revealed to be particularly helpful to delineate the aforementioned structures. Other resources can be helpful, such as \cite{wakana2003, mori2008} and \url{http://www.loni.ucla.edu/Atlases/Atlas_Detail.jsp?atlas_id=15}.
\\
to:
If you are not familiar with brain white matter tracts in general, you can gather some information in [[Publications.Publications|Mori et al., 2002]]. This paper has been revealed to be particularly helpful to delineate the aforementioned structures. Other resources can be helpful, such as [[Publications.Publications| Wakana et al., 2003 and Mori et al., 2002]].
Changed lines 69-105 from:
\begin{enumerate}
\item In ITK-Snap, open the FA image (figure 2)
\item Open the white matter mask as an overlay (figure 2)
\item Use the polygon tool to manually trace the ROIs through which the specific tract you are focusing on is passing
\item Once you are satisfied, go to Segmentation $\rightarrow$ Save as Image $\rightarrow$ Save your ROI as a *.nii.gz
\item To remember to which tract each ROI corresponds, you can use the label editor and name each ROI, then save the label descriptions $\rightarrow$ Segmentation $\rightarrow$ Save Label Descriptions
\item You will realize very frequently (ok, all the time!) that you not only have to draw ROIs through which the fibers are supposed to go through, but you also have to draw ROIs to exclude some fibers. An example of inclusion ROIs is given for the corpus callosum in figure 2. An example of exclusion ROI is given in figure 3.
\end{enumerate}
\begin{figure}[!h] \begin{center} \includegraphics[height=9cm] {/Users/caroline/work/DT-ITK/atlas_construction/documentation/FA_mask_ROI} \label{fig2} \caption{An example with the aging atlas. {\it Top left}: FA - {\it Top right}: FA with white matter mask - {\it Bottom}: ROIs delineating the corpus callosum} \end{center} \end{figure} \begin{figure}[!h] \begin{center} \includegraphics[height=9cm] {/Users/caroline/work/DT-ITK/atlas_construction/documentation/ROI_exclusion}
\label{fig3} \caption{Exclusion ROIs for the corpus callosum} \end{center} \end{figure} \subsection{Second Step: Defining each tract} \label{second_step} For each tract, you should have drawn a few ROIs through which you expect the fibers to go (the inclusion ROIs) and a few (the exclusion ROIs) through which you expect your fibers not to go, which are here to get rid of the `extra' annoying fibers. The main tool that is used to generate each tract is called `Tracttool'. `Tracttool' will be used to 1/filter the tracts, i.e., create one .vtk file per fiber tract - 2/convert the *.vtk into a .nii file (grey level image of the tract).
Obtaining each fiber tract is an iterative procedure. The whole brain tractography (called tensor.vtk see paragraph \ref{first_step}) is filtered again and again until a reasonable fiber tract is obtained. Here is the way to do it: \begin{itemize} \item Filter the whole brain tractography with your inclusion ROIs: \\ TractTool -in tensor.vtk -filter filtered\_tract1.vtk -roi ROI\_inclusion1.nii.gz -label label\_for\_roi1 \\
to:
# In ITK-Snap, open the FA image (figure 2) # Open the white matter mask as an overlay (figure 2) # Use the polygon tool to manually trace the ROIs through which the specific tract you are focusing on is passing # Once you are satisfied, go to Segmentation $\rightarrow$ Save as Image $\rightarrow$ Save your ROI as a *.nii.gz # To remember to which tract each ROI corresponds, you can use the label editor and name each ROI, then save the label descriptions -> Segmentation -> Save Label Descriptions # You will realize very frequently (ok, all the time!) that you not only have to draw ROIs through which the fibers are supposed to go through, but you also have to draw ROIs to exclude some fibers. An example of inclusion ROIs is given for the corpus callosum in figure 2. An example of exclusion ROI is given in figure 3. %center%Attach:FA_mask_ROI %center%An example with the aging atlas. ''Top left'': FA - ''Top right'': FA with white matter mask ''Bottom'': ROIs delineating the corpus callosum %center%Attach:ROI_exclusion %center%Exclusion ROIs for the corpus callosum !!Second Step: Defining each tract For each tract, you should have drawn a few ROIs through which you expect the fibers to go (the inclusion ROIs) and a few (the exclusion ROIs) through which you expect your fibers not to go, which are here to get rid of the ''extra'' annoying fibers. The main tool that is used to generate each tract is called ''Tracttool''. ''Tracttool'' will be used to 1/filter the tracts, i.e., create one .vtk file per fiber tract - 2/convert the *.vtk into a .nii file (grey level image of the tract). Obtaining each fiber tract is an iterative procedure. The whole brain tractography (called tensor.vtk see paragraph first step) is filtered again and again until a reasonable fiber tract is obtained. Here is the way to do it: ->1. Filter the whole brain tractography with your inclusion ROIs: -> [@ TractTool -in tensor.vtk -filter filtered_tract1.vtk -roi ROI_inclusion1.nii.gz -label label_for_roi1 @]
Changed lines 93-96 from:
\item Filter the whole brain tractography with your exclusion ROIs/ exclude the erroneous tract: \\
TractTool -in filtered\_tract1.vtk -filter filtered\_tract2.vtk -roi ROI\_inclusion2.nii.gz -label label\_for\_exclusion\_roi -inclusion 0
\item Transform the *.vtk into a grey level *.nii: Once the tract has been correctly filtered, the general output (here called filtered\_tract2.vtk) is transformed into a nii file with\\
TractTool -in filtered\_tract2.vtk -nifti output.nii.gz -target target.nii.gz. \\
to:
->2. Filter the whole brain tractography with your exclusion ROIs/ exclude the erroneous tract: ->[@ TractTool -in filtered_tract1.vtk -filter filtered_tract2.vtk -roi ROI_inclusion2.nii.gz -label label_for_exclusion_roi -inclusion 0 @] ->3. Transform the *.vtk into a grey level *.nii: Once the tract has been correctly filtered, the general output (here called filtered\_tract2.vtk) is transformed into a nii file with ->[@ TractTool -in filtered\_tract2.vtk -nifti output.nii.gz -target target.nii.gz @]
Changed lines 103-125 from:
\end{itemize}
From there, if you notice that your fiber tract is not correct, you can refine the process by creating more exclusion ROIs (see \ref{first_step}) and re-creating your output (see \ref{second_step}). An example of what you can achieve for the CST is given in the example directory.
\subsection{Third Step: From the fiber tracts to the medial rep}
\label{third_step} The model behind this representation relies on the following paper \cite{yushkevich2008} that focuses on white matter tracts that are thin sheet-like structures. After segmentation of these tracts, the cm-rep model is fitted to them that describes the skeleton and the boundary of geometrical objects as parametric digital surfaces with predefined topology. This step relies on the continuous medial representation tool developed by Yushkevich et al. The main documentation and binaries can be found at \url{http://www.itksnap.org/pmwiki/pmwiki.php?n=CMREP.Documentation}. It also utilizes the convert3D tools that you can find and download here \url{http://www.itksnap.org/pmwiki/pmwiki.php?n=Convert3D.Documentation}. Now you have your segmentations ready (they are grey-level images called, let's say, tract\_greylevel.nii.gz), a few preprocessing steps are needed before building the cm-rep. These use convert3D.
The main goal is to obtain a levelset image from the grey level segmentation. As stated in \url{http://www.itksnap.org/pmwiki/pmwiki.php?n=Convert3D.Documentation}/ section {\it levelset n\_iter}, creating a levelset segmentation requires a speed function and an initialization function. The adapted commands are as follows (the recommended parameters are indicated here)
\begin{enumerate}
\item Convert the grey level segmentation into a binary image: \\ c3d tract\_greylevel.nii.gz -threshold 0.5 inf 1.0 0.0 -o tract\_binary.nii.gz (see note at the bottom of this paragraph)
\item Generate the speed function\\
c3d tract\_binary.nii.gz -shift -0.1 -o tract\_speed.nii.gz
\item Generate the initialization function\\ c3d tract\_binary.nii.gz -threshold 0.25 inf -0.5 0.5 -o tract\_init.nii.gz
\item Produce the levelset function\\
c3d tract\_speed.nii.gz tract\_init.nii.gz -levelset-curvature 0.02 -levelset 100 -o tract\_levelset.nii.gz
\end{enumerate}
to:
From there, if you notice that your fiber tract is not correct, you can refine the process by creating more exclusion ROIs (see \ref{first_step}) and re-creating your output (see \ref{second_step}). An example of what you can achieve for the CST is given in the example directory. !!Third Step: From the fiber tracts to the medial rep The model behind this representation relies on the following paper \cite{yushkevich2008} that focuses on white matter tracts that are thin sheet-like structures. After segmentation of these tracts, the cm-rep model is fitted to them that describes the skeleton and the boundary of geometrical objects as parametric digital surfaces with predefined topology. This step relies on the continuous medial representation tool developed by Yushkevich et al. The main documentation and binaries can be found [[http://www.itksnap.org/pmwiki/pmwiki.php?n=CMREP.Documentation|here]]. It also utilizes the convert3D tools that you can find and download [[http://www.itksnap.org/pmwiki/pmwiki.php n=Convert3D.Documentation|here]]. Now you have your segmentations ready (they are grey-level images called, let's say, tract_greylevel.nii.gz), a few preprocessing steps are needed before building the cm-rep. These use convert3D. The main goal is to obtain a levelset image from the grey level segmentation. As stated in [[http://www.itksnap.org/pmwiki/pmwiki.php?n=Convert3D.Documentation|section''levelset n_iter'', creating a levelset segmentation requires a speed function and an initialization function. The adapted commands are as follows (the recommended parameters are indicated here) ->1. Convert the grey level segmentation into a binary image: ->[@ c3d tract_greylevel.nii.gz -threshold 0.5 inf 1.0 0.0 -o tract_binary.nii.gz @] (see note at the bottom of this paragraph) ->2. Generate the speed function ->[@ c3d tract_binary.nii.gz -shift -0.1 -o tract_speed.nii.gz @] ->3. Generate the initialization function ->[@ c3d tract\_binary.nii.gz -threshold 0.25 inf -0.5 0.5 -o tract_init.nii.gz @] ->4. Produce the levelset function ->[@ c3d tract_speed.nii.gz tract_init.nii.gz -levelset-curvature 0.02 -levelset 100 -o tract_levelset.nii.gz @]
Changed lines 133-136 from:
Note: In some cases, especially for the CST, the filtering step is not enough to delineate the portion of the structure that is sheet-like. Consequently, I strongly suggest to act on the binary structure once it is created in the first step (i.e., step that converts the grey level segmentation into a binary image). At this point, you can open the binary image in ITK-SNAP (opening it as the image and as the segmentation is fine). Go to the 3D window $\rightarrow$ click update mesh $\rightarrow$ click 3D scalpel tool in the 3D Toolbox $\rightarrow$ Change the label number to clear label in the Segmentation options and cut the stem of the CST $\rightarrow$ Accept and update mesh. Save the new segmentation.
to:
''Note'': In some cases, especially for the CST, the filtering step is not enough to delineate the portion of the structure that is sheet-like. Consequently, I strongly suggest to act on the binary structure once it is created in the first step (i.e., step that converts the grey level segmentation into a binary image). At this point, you can open the binary image in ITK-SNAP (opening it as the image and as the segmentation is fine). Go to the 3D window -> click update mesh -> click 3D scalpel tool in the 3D Toolbox -> Change the label number to clear label in the Segmentation options and cut the stem of the CST -> Accept and update mesh. Save the new segmentation.
Changed lines 137-159 from:
\begin{figure}[!h] \begin{center} \includegraphics[height=9cm] {/Users/caroline/work/DT-ITK/atlas_construction/documentation/img_binary} \label{fig5} \caption{An example of initial binary files for the cortico-spinal tract. In the bottom image, the stem was cut. The middle and right column illustrate how these two binaries are transformed into skeletons and boundaries during the next steps (see paragraph \ref{Building the initial template -1}). Modeling the stem using the cmrep model would not be adapted.} \end{center} \end{figure} \section{Creating the Surface Representation- 2nd part- the Continuous medial representation} \label{cmrep} We are going to switch to and focus on the cmp-rep model properly speaking, and use the continuous medical rep tools only (\url{http://www.itksnap.org/pmwiki/pmwiki.php?n=CMREP.Documentation}). The principle is to build the boundary and the corresponding skeleton for each tract \begin{figure}[!h] \begin{center} \includegraphics[height=5cm] {/Users/caroline/work/DT-ITK/atlas_construction/documentation/boun_skel} \label{fig4} \caption{{\it Left:} An example of initial boundary for the corpus callosum - {\it Right:} the corresponding skeleton} \end{center} \end{figure} \subsection{Building the initial template -1} \label{Building the initial template -1}
to:
%center%Attach:img_binary %center%An example of initial binary files for the cortico-spinal tract. In the bottom image, the stem was cut. The middle and right column illustrate how these two binaries are transformed into skeletons and boundaries during the next steps (see paragraph \ref{Building the initial template -1}). Modeling the stem using the cmrep model would not be adapted. !!Creating the Surface Representation- 2nd part- the Continuous medial representation} We are going to switch to and focus on the cmp-rep model properly speaking, and use the [[http://www.itksnap.org/pmwiki/pmwiki.php?n=CMREP.Documentation|continuous medical rep]] tools only. The principle is to build the boundary and the corresponding skeleton for each tract. %center%Attach:boun_skel %center%''Left'': An example of initial boundary for the corpus callosum - ''Right'': the corresponding skeleton !!Building the initial template 1
Changed lines 148-152 from:
\begin{enumerate}
\item vtklevelset tract\_levelset.nii.gz tract\_boundary.vtk 0.0 \\(the last and only parameter is the threshold value. The higher the value, the slimmer the boundary)
\item cmrep\_vskel -Q /PATH\_TO\_QVORONOI/qvoronoi -p {\it p} -e {\it e} -q {\it q} tract\_boundary.vtk tract\_skel.vtk \\
The main factor here is the pruning factor {\it p}. If $p=0$, there is no pruning at all and the skeleton is very rough. The point when it starts making a difference is when $p=1$. For the thinnest structures, it is advice to choose $p=1.3$ or $1.4$. For the structures that contains less detail, $p=1.8$ to $p=2$ might be a good estimate. Modifying $p$ gives reasonable results for most of the tracts, however, some issues might happen when the tracts are at the limit of being sheet-like. At this point, you can also tweak the parameter $e$ that is the minimal number of mesh edges separating two generator points of a VD face for it to be considered. The last parameter, $q$ is the number of bins in each dimension. It defines the speed with which the program runs. A good value is $q=20-50$. Reducing $q$ reduces the number of vertices in the skeleton. For more information on each of the parameters and additional ones, you can type the command cmrep\_vskel on the command line.
\end{enumerate}
to:
->1. [@ vtklevelset tract_levelset.nii.gz tract_boundary.vtk 0.0 @] The last and only parameter is the threshold value. The higher the value, the slimmer the boundary ->2. [@ cmrep_vskel -Q /PATH\_TO\_QVORONOI/qvoronoi -p ''p'' -e ''e'' -q ''q'' tract_boundary.vtk tract_skel.vtk @] The main factor here is the pruning factor ''p''. If ''p''=0, there is no pruning at all and the skeleton is very rough. The point when it starts making a difference is when $p=1$. For the thinnest structures, it is advice to choose ''p''=1.3 or 1.4. For the structures that contains less detail, ''p''=1.8 to ''p''=2 might be a good estimate. Modifying $p$ gives reasonable results for most of the tracts, however, some issues might happen when the tracts are at the limit of being sheet-like. At this point, you can also tweak the parameter $e$ that is the minimal number of mesh edges separating two generator points of a VD face for it to be considered. The last parameter, ''q'' is the number of bins in each dimension. It defines the speed with which the program runs. A good value is ''q''=20-50. Reducing ''q'' reduces the number of vertices in the skeleton. For more information on each of the parameters and additional ones, you can type the command cmrep_vskel on the command line.
Changed lines 160-170 from:
\subsection{Building the initial template -2} The next action is to build the true initial template, the one that will serve as an input in the final optimization. This is done with a matlab function, called tempinit.m. This function calls a few other ones, such as vtk\_polydata\_read.m, vtk\_get\_point\_data.m as well as a package written by Kilian Weinberger that you can find here (\url{http://www.cse.wustl.edu/~kilian/code/code.html}). tempinit uses this maximum variable unfolding (MVU) algorithm, the general purpose of which is to reduce dimensionality. This function also depends on a library called Csdp, which you can download here \url{https://projects.coin-or.org/Csdp/}. This library contains an executable (found in /bin/csdp), a copy of which should be put in the user's bin directory of the machine where you are running tempinit. The same applies to the c function called triangle \url{http://www.cs.cmu.edu/~quake/triangle.html}. Once compiled, the executable should similarly go to your local bin directory. For more information about the different parameters of this matlab function, you can have a look at the .m file located in the example directory, where defaults and explanations are given for each of them. This program should output two files: medialtemplate.cmrep and medialtemplate.vtk, which are be the starting point for the very last step. \subsection{Building the initial template -3} The very last step of this process uses the function cmrep\_fit from the cm-rep package that we previously installed. Its inputs consist of the medialtemlate.cmrep files obtained above, the binary image as well as a parameter file and the output directory.
to:
!!Building the initial template -2 The next action is to build the true initial template, the one that will serve as an input in the final optimization. This is done with a matlab function, called tempinit.m. This function calls a few other ones, such as vtk_polydata_read.m, vtk_get_point_data.m as well as a package written by Kilian Weinberger that you can find [[http://www.cse.wustl.edu/~kilian/code/code.html|here]]. tempinit uses this maximum variable unfolding (MVU) algorithm, the general purpose of which is to reduce dimensionality. This function also depends on a library called Csdp, which you can download [[https://projects.coin-or.org/Csdp/|here]]. This library contains an executable (found in /bin/csdp), a copy of which should be put in the user's bin directory of the machine where you are running tempinit. The same applies to the c function called [[http://www.cs.cmu.edu/~quake/triangle.html|triangle]]. Once compiled, the executable should similarly go to your local bin directory. For more information about the different parameters of this matlab function, you can have a look at the .m file located in the example directory, where defaults and explanations are given for each of them. This program should output two files: medialtemplate.cmrep and medialtemplate.vtk, which are be the starting point for the very last step. !!Building the initial template -3 The very last step of this process uses the function cmrep\_fit from the cm-rep package that we previously installed. Its inputs consist of the medialtemlate.cmrep files obtained above, the binary image as well as a parameter file and the output directory.
Changed lines 167-183 from:
\begin{center} cmrep\_fit param.txt medialtemplate.cmrep tract\_binary.nii.gz cmrep\_output/
\end{center}
The explanation for most of the parameters can be found in \url{http://www.itksnap.org/pmwiki/pmwiki.php?n=CMREP.Documentation}. The first part of this parameter file contains the default parameters that control the values that you will see appearing on your terminal after launching this command (see Figure 6 and the param\_output.txt in the demo folder provided with this tutorial). A few important facts should be retained. During the different iterations you should control that the TOTAL (see Figure 6) is decreasing. Each of the values VOLOV to BNDTRI contribute to this TOTAL and are driven by the default parameters. So you can adjust them by modifying the term weights of the parameter file.
\begin{itemize}
\item VOLOV translates the overlap between the model that is iteratively made and the binary
\item BNDJAC is driven by DefaultParameters.BoundaryJacobianEnergyTerm.Weight, \\ DefaultParameters.BoundaryJacobianEnergyTerm.PenaltyA and\\ DefaultParameters.BoundaryJacobianEnergyTerm.PenaltyB
\item GRAD-R corresponds to DefaultParameters.BoundaryGradRPenaltyTerm.Weight
\item RADIUS to DefaultParameters.RadiusPenaltyTerm.Weight
\item LOOPTN to DefaultParameters.LoopTangentSchemeValidityPenaltyTerm.Weight
\item MEDTRI and BNDTRI express the quality of the triangulation, hence how much your model deform
to:
->[@ cmrep_fit param.txt medialtemplate.cmrep tract_binary.nii.gz cmrep_output @] The explanation for most of the parameters can be found on this [http://www.itksnap.org/pmwiki/pmwiki.php?n=CMREP.Documentation|page]]. The first part of this parameter file contains the default parameters that control the values that you will see appearing on your terminal after launching this command (see Figure 6 and the param_output.txt in the demo folder provided with this tutorial). A few important facts should be retained. During the different iterations you should control that the TOTAL (see Figure 6) is decreasing. Each of the values VOLOV to BNDTRI contribute to this TOTAL and are driven by the default parameters. So you can adjust them by modifying the term weights of the parameter file. #VOLOV translates the overlap between the model that is iteratively made and the binary # BNDJAC is driven by DefaultParameters.BoundaryJacobianEnergyTerm.Weight, # #DefaultParameters.BoundaryJacobianEnergyTerm.PenaltyA and #DefaultParameters.BoundaryJacobianEnergyTerm.PenaltyB # GRAD-R corresponds to DefaultParameters.BoundaryGradRPenaltyTerm.Weight #RADIUS to DefaultParameters.RadiusPenaltyTerm.Weight #LOOPTN to DefaultParameters.LoopTangentSchemeValidityPenaltyTerm.Weight #MEDTRI and BNDTRI express the quality of the triangulation, hence how much your model deform
Changed lines 184-194 from:
\begin{figure}[!h] \begin{center} \includegraphics[height=3cm] {/Users/caroline/work/DT-ITK/atlas_construction/documentation/default_iteration} \label{fig6} \caption{Example of output after submitting the cmrep\_fit command. The total value decreases and each of the terms VOLOV to BNDTRI contribute to this decrease.} \end{center} \end{figure} The second part of the parameter file controls each step of the run, from the alignment stage (translation and rotation) to the deformation stage (fitting of the model). All the parameters are straightforward to understand and thus to modify. One comment could be done about the blurring parameter, which can be tuned down if there are some finer structures to be preserved in the tract.
to:
%center%Attach:default_iteration} %center%Example of output after submitting the cmrep_fit command. The total value decreases and each of the terms VOLOV to BNDTRI contribute to this decrease. The second part of the parameter file controls each step of the run, from the alignment stage (translation and rotation) to the deformation stage (fitting of the model). All the parameters are straightforward to understand and thus to modify. One comment could be done about the blurring parameter, which can be tuned down if there are some finer structures to be preserved in the tract.
Changed lines 191-198 from:
\begin{figure}[!h] \begin{center} \includegraphics[height=7cm] {/Users/caroline/work/DT-ITK/atlas_construction/documentation/work_flow} \label{fig7} \caption{Pipeline illustrated on the CST} \end{center} \end{figure}
to:
%center%Attach:work_flow %center%Pipeline illustrated on the CST
Changed lines 196-202 from:
\subsection{Checking your template} In order to check the accuracy of the template, it is worth comparing it to the original binary file, through a Dice overlap for instance.
cmrep can be used to generate a binary file from the def3.med.vtk (cmrep\_fillmesh def3.med.vtk ref.nii.gz def3.nii.gz) ref.nii.gz can be the binary image itself. The binary def3.nii.gz obtained from the information of the medial representation is then compared to the initial binary model through c3d -verbose def3.nii.gz tract\_binary.nii.gz -overlap 1 (if the foreground of the binary image is 1).
to:
!!Checking your template In order to check the accuracy of the template, it is worth comparing it to the original binary file, through a Dice overlap for instance. cmrep can be used to generate a binary file from the def3.med.vtk ->[@cmrep_fillmesh def3.med.vtk ref.nii.gz def3.nii.gz @] *ref.nii.gz can be the binary image itself. *The binary def3.nii.gz obtained from the information of the medial representation is then compared to the initial binary model through c3d -verbose def3.nii.gz tract_binary.nii.gz -overlap 1 (if the foreground of the binary image is 1).
Changed lines 28-29 from:
Such an atlas was already created using an aging population (65-83 yo) obtained from the ixi database (see in the example folder). This study was published in \cite{zhang2009}. Another one is in the process of being created. The underlying database is the same but we selected subjects belonging to an adult population from age 18 to 60.
to:
Such an atlas was already created using an aging population (65-83 yo) obtained from the ixi database (see in the example folder). This study was published in \cite{zhang2009}. Another one is in the process of being created. The underlying database is the same but we selected subjects belonging to an adult population from age 18 to 60.
Changed line 32 from:
!!Creating the Surface Representation- 1st part- starting with DTI-TK}
to:
!!Creating the Surface Representation- 1st part- starting with DTI-TK
Changed lines 56-67 from:
\\Other factors can be added, such as
\begin{itemize} \item `-label' (default 1) - to be modified if the label of the seed (i.e., the white matter mask) is not 1
\item `-minFA' (default: 0.15) and `-maxAngle' (default: 45) which are stopping criteria
\item `-stepSize' (default: 0.5 mm)
\item `-upsample' (default 1). This number can be changed when using DTIs with very low resolution. To get denser tracts, the value can be set to 2 (or other puissance of 2). It inserts additional point within a voxel.
\end{itemize}
\end{itemize} \subsection{First Step: delineating the fibers corresponding to each tract} \label{first_step} If you are not familiar with brain white matter tracts in general, you can gather some information in \cite{mori2002}. This paper
to:
Other factors can be added, such as *''-label'' (default 1) - to be modified if the label of the seed (i.e., the white matter mask) is not 1 *''-minFA'' (default: 0.15) and `-maxAngle' (default: 45) which are stopping criteria *''-stepSize'' (default: 0.5 mm) *''-upsample'' (default 1). This number can be changed when using DTIs with very low resolution. To get denser tracts, the value can be set to 2 (or other puissance of 2). It inserts additional point within a voxel. !!First Step: delineating the fibers corresponding to each tract If you are not familiar with brain white matter tracts in general, you can gather some information in Mori et al., 2002 [[Publications.Publications]]. This paper
Changed lines 15-17 from:
The first task is to build a whole brain white matter atlas (see [[Documentation.HomePage|tutorial page]]. If you are already familiar with DTI-TK, you can skip the first points of the tutorial and directly go to [[Documentation.Registration|''Registration and Spatial normalization of DTI volumes'']]. At the end of this, you will have created a white matter template (see Figure 1), which is necessary to build the tract specific template.
to:
The first task is to build a whole brain white matter atlas (see [[Documentation.HomePage|tutorial page]]. If you are already familiar with DTI-TK, you can skip the first points of the tutorial and directly go to [[Documentation.Registration|''Registration and Spatial normalization of DTI volumes'']]. At the end of his, you will have created a white matter template (see Figure 1), which is necessary to build the tract specific template.
Changed lines 19-44 from:
!!{Main Goal Now the whole brain DT atlas has been created from your population, the main point is to delineate the tracts of interest and then create a medial (surface-based) representation for each one. As of December 2010, these tracts of interest that have been considered so far are \begin{itemize} \item the corpus callosum (CC) \item the inferior longitudinal fasciculus (ILF)
\item the uncinate fasciculus (UNC)
\item the superior longitudinal fasciculus (SLF)
\item the cortico-spinal tract (CST)
\item the inferior fronto-occipital fasciculus (IFO) \end{itemize}
Such an atlas was already created using an aging population (65-83 yo) obtained from the ixi database (see in the example folder). This study was published in \cite{zhang2009}. Another one is in the process of being created. The underlying database is the same but we selected subjects belonging to an adult population from age 18 to 60. Following the generation of this template, several applications are possible, such as the detection of white matter differences between two populations in these particular tracts (an example is in the aforementioned Zhang paper, where WM changes are identified between ALS and healthy subjects, based on the fractional anisotropy measure) or such as longitudinal studies. \section{Creating the Surface Representation- 1st part- starting with DTI-TK} \subsection{What to start with?} \label{prelim}
to:
!!Main Goal Now the whole brain DT atlas has been created from your population, the main point is to delineate the tracts of interest and then create a medial (surface-based) representation for each one. As of December 2010, these tracts of interest that have been considered so far are *the corpus callosum (CC) *the inferior longitudinal fasciculus (ILF) *the uncinate fasciculus (UNC) *the superior longitudinal fasciculus (SLF) *the cortico-spinal tract (CST) *the inferior fronto-occipital fasciculus (IFO) Such an atlas was already created using an aging population (65-83 yo) obtained from the ixi database (see in the example folder). This study was published in \cite{zhang2009}. Another one is in the process of being created. The underlying database is the same but we selected subjects belonging to an adult population from age 18 to 60. Following the generation of this template, several applications are possible, such as the detection of white matter differences between two populations in these particular tracts (an example is in the aforementioned Zhang paper, where WM changes are identified between ALS and healthy subjects, based on the fractional anisotropy measure) or such as longitudinal studies. !!Creating the Surface Representation- 1st part- starting with DTI-TK} !!!What to start with?
Added lines 35-56:
->1. If the size of your atlas is too small, you might have problems to draw the detailed ROIs that will be needed in the next step. So, you might want to increase its size for the delineation to be more convenient. For this, you can use, the command TVResample. (e.g.: If the initial size of the atlas, tensor.nii.gz is 128x128x64 and its voxel space is 1.75x1.75x2.25, it can easily become 224x224x144 and 1x1x1, using the command ->[@ TVResample -in tensor.nii.gz -xs 224 -ys 224 -zs 144 -xv 1 -yv 1 -zv 1}) @]
->2. It is necessary to create a fractional anisotropy image from your atlas ->[@ TVAnisotropy -in tensor.nii.gz}. This will output tensor_fa.nii.gz @]
->3. In addition, you also want to create a white matter mask, by thresholding the FA image (we suggest to threshold it to 0.2). In order to do that you can use the following command:
->[@ BinaryThresholdImageFilter tensor\_fa.nii.gz wm.nii.gz 0 0.2 0 1 @]
A whole brain tractography will be needed throughout this specific tract atlas construction. To do so, use
->[@ SingleTensorFT -in tensor.nii.gz -seed wm.nii.gz -out tensor.vtk] \\Other factors can be added, such as
Deleted lines 57-64:
\item If the size of your atlas is too small, you might have problems to draw the detailed ROIs that will be needed in the next step. So, you might want to increase its size for the delineation to be more convenient. For this, you can use, the command TVResample. (e.g.: If the initial size of the atlas, tensor.nii.gz is 128x128x64 and its voxel space is 1.75x1.75x2.25, it can easily become 224x224x144 and 1x1x1, using the command\\ {\it TVResample -in tensor.nii.gz -xs 224 -ys 224 -zs 144 -xv 1 -yv 1 -zv 1}) \item It is necessary to create a fractional anisotropy image from your atlas (use the function TVAnisotropy $\rightarrow$ {\it TVAnisotropy -in tensor.nii.gz}. This will output tensor\_fa.nii.gz). \item In addition, you also want to create a white matter mask, by thresholding the FA image (we suggest to threshold it to 0.2). In order to do that you can use the following command: {\it BinaryThresholdImageFilter tensor\_fa.nii.gz wm.nii.gz 0 0.2 0 1}. \item A whole brain tractography will be needed throughout this specific tract atlas construction. To do so, use {\it SingleTensorFT -in tensor.nii.gz -seed wm.nii.gz -out tensor.vtk} \\Other factors can be added, such as \begin{itemize}
Added lines 1-235:
(:noleft:) (:notitle:)(:title TSA Advanced:) ! How to build a tract specific white matter Atlas
!!Previous steps !!!What do you have to get installed? Creating a tract specific white matter atlas is the result of the combination of three main open-source software developed in PICSL. The first main part relies on DTI-TK. The last steps rely on the continuous medial representation model (cm-rep) (see [[http://www.itksnap.org/pmwiki/pmwiki.php?n=CMREP.Documentation| url]] for installation and documentation). Another companion tool that will be needed here is convert3D (see [[http://www.itksnap.org/pmwiki/pmwiki.php?n=Convert3D.Documentation|here]).
Two visualization softwares can help you during the course of this tutorial: #[[http://www.itksnap.org/|ITK-SNAP]] #[[http://www.paraview.org|paraview]]. The former is a good segmentation and visualization tools for nifti images, whereas the latter is convenient to deal with .vtk format images.
!!Building the whole brain white matter Atlas using DTITK The first task is to build a whole brain white matter atlas (see [[Documentation.HomePage|tutorial page]]. If you are already familiar with DTI-TK, you can skip the first points of the tutorial and directly go to [[Documentation.Registration|''Registration and Spatial normalization of DTI volumes'']]. At the end of this, you will have created a white matter template (see Figure 1), which is necessary to build the tract specific template.
%center%Attach:atlas_example.png
!!{Main Goal Now the whole brain DT atlas has been created from your population, the main point is to delineate the tracts of interest and then create a medial (surface-based) representation for each one. As of December 2010, these tracts of interest that have been considered so far are \begin{itemize} \item the corpus callosum (CC) \item the inferior longitudinal fasciculus (ILF) \item the uncinate fasciculus (UNC) \item the superior longitudinal fasciculus (SLF) \item the cortico-spinal tract (CST) \item the inferior fronto-occipital fasciculus (IFO) \end{itemize} Such an atlas was already created using an aging population (65-83 yo) obtained from the ixi database (see in the example folder). This study was published in \cite{zhang2009}. Another one is in the process of being created. The underlying database is the same but we selected subjects belonging to an adult population from age 18 to 60.
Following the generation of this template, several applications are possible, such as the detection of white matter differences between two populations in these particular tracts (an example is in the aforementioned Zhang paper, where WM changes are identified between ALS and healthy subjects, based on the fractional anisotropy measure) or such as longitudinal studies.
\section{Creating the Surface Representation- 1st part- starting with DTI-TK} \subsection{What to start with?} \label{prelim} The preliminary steps consist of creating an FA images, a white matter mask as well as a whole brain tractography from the DT image. \begin{itemize} \item If the size of your atlas is too small, you might have problems to draw the detailed ROIs that will be needed in the next step. So, you might want to increase its size for the delineation to be more convenient. For this, you can use, the command TVResample. (e.g.: If the initial size of the atlas, tensor.nii.gz is 128x128x64 and its voxel space is 1.75x1.75x2.25, it can easily become 224x224x144 and 1x1x1, using the command\\ {\it TVResample -in tensor.nii.gz -xs 224 -ys 224 -zs 144 -xv 1 -yv 1 -zv 1}) \item It is necessary to create a fractional anisotropy image from your atlas (use the function TVAnisotropy $\rightarrow$ {\it TVAnisotropy -in tensor.nii.gz}. This will output tensor\_fa.nii.gz). \item In addition, you also want to create a white matter mask, by thresholding the FA image (we suggest to threshold it to 0.2). In order to do that you can use the following command: {\it BinaryThresholdImageFilter tensor\_fa.nii.gz wm.nii.gz 0 0.2 0 1}. \item A whole brain tractography will be needed throughout this specific tract atlas construction. To do so, use {\it SingleTensorFT -in tensor.nii.gz -seed wm.nii.gz -out tensor.vtk} \\Other factors can be added, such as \begin{itemize} \item `-label' (default 1) - to be modified if the label of the seed (i.e., the white matter mask) is not 1 \item `-minFA' (default: 0.15) and `-maxAngle' (default: 45) which are stopping criteria \item `-stepSize' (default: 0.5 mm) \item `-upsample' (default 1). This number can be changed when using DTIs with very low resolution. To get denser tracts, the value can be set to 2 (or other puissance of 2). It inserts additional point within a voxel. \end{itemize} \end{itemize}
\subsection{First Step: delineating the fibers corresponding to each tract} \label{first_step} If you are not familiar with brain white matter tracts in general, you can gather some information in \cite{mori2002}. This paper has been revealed to be particularly helpful to delineate the aforementioned structures. Other resources can be helpful, such as \cite{wakana2003, mori2008} and \url{http://www.loni.ucla.edu/Atlases/Atlas_Detail.jsp?atlas_id=15}. \\ The current aim is to delineate each tract. This might be the most important step because everything else results from this. \begin{enumerate} \item In ITK-Snap, open the FA image (figure 2) \item Open the white matter mask as an overlay (figure 2) \item Use the polygon tool to manually trace the ROIs through which the specific tract you are focusing on is passing \item Once you are satisfied, go to Segmentation $\rightarrow$ Save as Image $\rightarrow$ Save your ROI as a *.nii.gz \item To remember to which tract each ROI corresponds, you can use the label editor and name each ROI, then save the label descriptions $\rightarrow$ Segmentation $\rightarrow$ Save Label Descriptions \item You will realize very frequently (ok, all the time!) that you not only have to draw ROIs through which the fibers are supposed to go through, but you also have to draw ROIs to exclude some fibers. An example of inclusion ROIs is given for the corpus callosum in figure 2. An example of exclusion ROI is given in figure 3. \end{enumerate}
\begin{figure}[!h] \begin{center} \includegraphics[height=9cm] {/Users/caroline/work/DT-ITK/atlas_construction/documentation/FA_mask_ROI} \label{fig2} \caption{An example with the aging atlas. {\it Top left}: FA - {\it Top right}: FA with white matter mask - {\it Bottom}: ROIs delineating the corpus callosum} \end{center} \end{figure}
\begin{figure}[!h] \begin{center} \includegraphics[height=9cm] {/Users/caroline/work/DT-ITK/atlas_construction/documentation/ROI_exclusion} \label{fig3} \caption{Exclusion ROIs for the corpus callosum} \end{center} \end{figure}
\subsection{Second Step: Defining each tract} \label{second_step} For each tract, you should have drawn a few ROIs through which you expect the fibers to go (the inclusion ROIs) and a few (the exclusion ROIs) through which you expect your fibers not to go, which are here to get rid of the `extra' annoying fibers. The main tool that is used to generate each tract is called `Tracttool'. `Tracttool' will be used to 1/filter the tracts, i.e., create one .vtk file per fiber tract - 2/convert the *.vtk into a .nii file (grey level image of the tract). Obtaining each fiber tract is an iterative procedure. The whole brain tractography (called tensor.vtk see paragraph \ref{first_step}) is filtered again and again until a reasonable fiber tract is obtained. Here is the way to do it: \begin{itemize} \item Filter the whole brain tractography with your inclusion ROIs: \\ TractTool -in tensor.vtk -filter filtered\_tract1.vtk -roi ROI\_inclusion1.nii.gz -label label\_for\_roi1 \\ (this step is repeated for all the inclusion ROIs. `-label' is not required is the value of the label used in ITK-SNAP is 1) \item Filter the whole brain tractography with your exclusion ROIs/ exclude the erroneous tract: \\ TractTool -in filtered\_tract1.vtk -filter filtered\_tract2.vtk -roi ROI\_inclusion2.nii.gz -label label\_for\_exclusion\_roi -inclusion 0 \item Transform the *.vtk into a grey level *.nii: Once the tract has been correctly filtered, the general output (here called filtered\_tract2.vtk) is transformed into a nii file with\\ TractTool -in filtered\_tract2.vtk -nifti output.nii.gz -target target.nii.gz. \\ The output `output.nii.gz' will have the same dimensions as `-target', which can be a volume of your choice. \end{itemize}
From there, if you notice that your fiber tract is not correct, you can refine the process by creating more exclusion ROIs (see \ref{first_step}) and re-creating your output (see \ref{second_step}). An example of what you can achieve for the CST is given in the example directory.
\subsection{Third Step: From the fiber tracts to the medial rep} \label{third_step} The model behind this representation relies on the following paper \cite{yushkevich2008} that focuses on white matter tracts that are thin sheet-like structures. After segmentation of these tracts, the cm-rep model is fitted to them that describes the skeleton and the boundary of geometrical objects as parametric digital surfaces with predefined topology. This step relies on the continuous medial representation tool developed by Yushkevich et al. The main documentation and binaries can be found at \url{http://www.itksnap.org/pmwiki/pmwiki.php?n=CMREP.Documentation}. It also utilizes the convert3D tools that you can find and download here \url{http://www.itksnap.org/pmwiki/pmwiki.php?n=Convert3D.Documentation}. Now you have your segmentations ready (they are grey-level images called, let's say, tract\_greylevel.nii.gz), a few preprocessing steps are needed before building the cm-rep. These use convert3D. The main goal is to obtain a levelset image from the grey level segmentation. As stated in \url{http://www.itksnap.org/pmwiki/pmwiki.php?n=Convert3D.Documentation}/ section {\it levelset n\_iter}, creating a levelset segmentation requires a speed function and an initialization function. The adapted commands are as follows (the recommended parameters are indicated here) \begin{enumerate} \item Convert the grey level segmentation into a binary image: \\ c3d tract\_greylevel.nii.gz -threshold 0.5 inf 1.0 0.0 -o tract\_binary.nii.gz (see note at the bottom of this paragraph) \item Generate the speed function\\ c3d tract\_binary.nii.gz -shift -0.1 -o tract\_speed.nii.gz \item Generate the initialization function\\ c3d tract\_binary.nii.gz -threshold 0.25 inf -0.5 0.5 -o tract\_init.nii.gz \item Produce the levelset function\\ c3d tract\_speed.nii.gz tract\_init.nii.gz -levelset-curvature 0.02 -levelset 100 -o tract\_levelset.nii.gz \end{enumerate}
Congratulations! You have made it through the first part. There is still quite a way to go, but we are almost there.
Note: In some cases, especially for the CST, the filtering step is not enough to delineate the portion of the structure that is sheet-like. Consequently, I strongly suggest to act on the binary structure once it is created in the first step (i.e., step that converts the grey level segmentation into a binary image). At this point, you can open the binary image in ITK-SNAP (opening it as the image and as the segmentation is fine). Go to the 3D window $\rightarrow$ click update mesh $\rightarrow$ click 3D scalpel tool in the 3D Toolbox $\rightarrow$ Change the label number to clear label in the Segmentation options and cut the stem of the CST $\rightarrow$ Accept and update mesh. Save the new segmentation. Figure 4 gives you an example.
\begin{figure}[!h] \begin{center} \includegraphics[height=9cm] {/Users/caroline/work/DT-ITK/atlas_construction/documentation/img_binary} \label{fig5} \caption{An example of initial binary files for the cortico-spinal tract. In the bottom image, the stem was cut. The middle and right column illustrate how these two binaries are transformed into skeletons and boundaries during the next steps (see paragraph \ref{Building the initial template -1}). Modeling the stem using the cmrep model would not be adapted.} \end{center} \end{figure}
\section{Creating the Surface Representation- 2nd part- the Continuous medial representation} \label{cmrep} We are going to switch to and focus on the cmp-rep model properly speaking, and use the continuous medical rep tools only (\url{http://www.itksnap.org/pmwiki/pmwiki.php?n=CMREP.Documentation}). The principle is to build the boundary and the corresponding skeleton for each tract
\begin{figure}[!h] \begin{center} \includegraphics[height=5cm] {/Users/caroline/work/DT-ITK/atlas_construction/documentation/boun_skel} \label{fig4} \caption{{\it Left:} An example of initial boundary for the corpus callosum - {\it Right:} the corresponding skeleton} \end{center} \end{figure}
\subsection{Building the initial template -1} \label{Building the initial template -1} In order to initiate the cmrep model, you need a primary template. The construction of this initial template starts with the generation of a skeleton and boundary from the previous levelset file. \begin{enumerate} \item vtklevelset tract\_levelset.nii.gz tract\_boundary.vtk 0.0 \\(the last and only parameter is the threshold value. The higher the value, the slimmer the boundary) \item cmrep\_vskel -Q /PATH\_TO\_QVORONOI/qvoronoi -p {\it p} -e {\it e} -q {\it q} tract\_boundary.vtk tract\_skel.vtk \\ The main factor here is the pruning factor {\it p}. If $p=0$, there is no pruning at all and the skeleton is very rough. The point when it starts making a difference is when $p=1$. For the thinnest structures, it is advice to choose $p=1.3$ or $1.4$. For the structures that contains less detail, $p=1.8$ to $p=2$ might be a good estimate. Modifying $p$ gives reasonable results for most of the tracts, however, some issues might happen when the tracts are at the limit of being sheet-like. At this point, you can also tweak the parameter $e$ that is the minimal number of mesh edges separating two generator points of a VD face for it to be considered. The last parameter, $q$ is the number of bins in each dimension. It defines the speed with which the program runs. A good value is $q=20-50$. Reducing $q$ reduces the number of vertices in the skeleton. For more information on each of the parameters and additional ones, you can type the command cmrep\_vskel on the command line. \end{enumerate} The results should look like the ones of Figure 5 for the corpus callosum or of Figure 4 bottom line for the corticospinal tract.
\subsection{Building the initial template -2} The next action is to build the true initial template, the one that will serve as an input in the final optimization. This is done with a matlab function, called tempinit.m. This function calls a few other ones, such as vtk\_polydata\_read.m, vtk\_get\_point\_data.m as well as a package written by Kilian Weinberger that you can find here (\url{http://www.cse.wustl.edu/~kilian/code/code.html}). tempinit uses this maximum variable unfolding (MVU) algorithm, the general purpose of which is to reduce dimensionality. This function also depends on a library called Csdp, which you can download here \url{https://projects.coin-or.org/Csdp/}. This library contains an executable (found in /bin/csdp), a copy of which should be put in the user's bin directory of the machine where you are running tempinit. The same applies to the c function called triangle \url{http://www.cs.cmu.edu/~quake/triangle.html}. Once compiled, the executable should similarly go to your local bin directory. For more information about the different parameters of this matlab function, you can have a look at the .m file located in the example directory, where defaults and explanations are given for each of them. This program should output two files: medialtemplate.cmrep and medialtemplate.vtk, which are be the starting point for the very last step.
\subsection{Building the initial template -3} The very last step of this process uses the function cmrep\_fit from the cm-rep package that we previously installed. Its inputs consist of the medialtemlate.cmrep files obtained above, the binary image as well as a parameter file and the output directory. The main command is \begin{center} cmrep\_fit param.txt medialtemplate.cmrep tract\_binary.nii.gz cmrep\_output/ \end{center} The explanation for most of the parameters can be found in \url{http://www.itksnap.org/pmwiki/pmwiki.php?n=CMREP.Documentation}. The first part of this parameter file contains the default parameters that control the values that you will see appearing on your terminal after launching this command (see Figure 6 and the param\_output.txt in the demo folder provided with this tutorial). A few important facts should be retained. During the different iterations you should control that the TOTAL (see Figure 6) is decreasing. Each of the values VOLOV to BNDTRI contribute to this TOTAL and are driven by the default parameters. So you can adjust them by modifying the term weights of the parameter file. \begin{itemize} \item VOLOV translates the overlap between the model that is iteratively made and the binary \item BNDJAC is driven by DefaultParameters.BoundaryJacobianEnergyTerm.Weight, \\ DefaultParameters.BoundaryJacobianEnergyTerm.PenaltyA and\\ DefaultParameters.BoundaryJacobianEnergyTerm.PenaltyB \item GRAD-R corresponds to DefaultParameters.BoundaryGradRPenaltyTerm.Weight \item RADIUS to DefaultParameters.RadiusPenaltyTerm.Weight \item LOOPTN to DefaultParameters.LoopTangentSchemeValidityPenaltyTerm.Weight \item MEDTRI and BNDTRI express the quality of the triangulation, hence how much your model deform \end{itemize}
\begin{figure}[!h] \begin{center} \includegraphics[height=3cm] {/Users/caroline/work/DT-ITK/atlas_construction/documentation/default_iteration} \label{fig6} \caption{Example of output after submitting the cmrep\_fit command. The total value decreases and each of the terms VOLOV to BNDTRI contribute to this decrease.} \end{center} \end{figure}
The second part of the parameter file controls each step of the run, from the alignment stage (translation and rotation) to the deformation stage (fitting of the model). All the parameters are straightforward to understand and thus to modify. One comment could be done about the blurring parameter, which can be tuned down if there are some finer structures to be preserved in the tract.
The output of this final step will be located in the cmrep\_output/ directory, under three subdirectories, called cmrep, image and mesh. The optimized structure are in cmrep\_output/mesh/, and called def3.med.vtk (the medial representation) and def3.bnd.vtk (boundary). An example can be found in Figure 7.
\begin{figure}[!h] \begin{center} \includegraphics[height=7cm] {/Users/caroline/work/DT-ITK/atlas_construction/documentation/work_flow} \label{fig7} \caption{Pipeline illustrated on the CST} \end{center} \end{figure}
Congratulations, you obtained your first white matter tract medial representation!
\subsection{Checking your template} In order to check the accuracy of the template, it is worth comparing it to the original binary file, through a Dice overlap for instance. cmrep can be used to generate a binary file from the def3.med.vtk (cmrep\_fillmesh def3.med.vtk ref.nii.gz def3.nii.gz) ref.nii.gz can be the binary image itself. The binary def3.nii.gz obtained from the information of the medial representation is then compared to the initial binary model through c3d -verbose def3.nii.gz tract\_binary.nii.gz -overlap 1 (if the foreground of the binary image is 1). This command results in the computation of the Dice overlap. A value of 0.92 is satisfying.
|
|