Slicer3 Training Tutorial Python Stochastic Tractography Module by zrl90908

VIEWS: 34 PAGES: 54

									                                               Slicer3 Training Compendium

                                                     Slicer3 Training Tutorial
     Python Stochastic Tractography Module




Julien von Siebenthal, Sylvain Bouix, Marek Kubicki, (RA Andrew Rausch)
                                            Psychiatry Neuroimaging Lab
     Pujol S, Gollub R
     National Alliance for Medical Image Computing                           -1-
                                                Introduction
The python stochastic tractography module contains the
tools necessary to extract, visualize and quantify white matter
connections from DTI images. It seeds nerve fiber bundles
from regions of interest (ROIs) based on DWI images. Unlike
streamline tractography, stochastic tractography uses a
probabilistic framework to perform tractography.

By incorporating uncertainty due to fiber crossings, imaging
noise and resolution, stochastic tractography can robustly
extract fiber bundles when streamline tractography cannot.

The tracts generated by the stochastic tractography can be
used to generate a connectivity probability image, which can
be used to study connectivity between different regions of the
brain.
Pujol S, Gollub R
Rausch, von Siebenthal, Bouix, Kubicki
National Alliance for Medical Image Computing                     -2-
                                  Materials and Req.’s
This course requires the installation of the Slicer3 software
and training dataset accessible at the following locations:

•   Slicer 3 Software (Slicer 3.5 nightly build as of January 3rd, 2010)
     –   http://slicer.org/pages/Special:SlicerDownloads


•   Training Dataset (packaged and compressed)
     –   http://www.na-mic.org/Wiki/images/0/01/IJdata.tar.gz


•   Training Wiki
     –   http://www.na-mic.org/Wiki/index.php/Python_Stochastic_Tractography_Tutorial


•   Prerequisite Skills
     – Loading images into Slicer 3

                                               Disclaimer
                                               It is the responsibility of the user of 3D Slicer to
                                               comply with both the terms of the license and with
                                               the applicable laws, regulations and rules.
     Pujol von Siebenthal, Bouix, Kubicki
     Terry,S, Gollub R
     Rausch, von Siebenthal, Bouix, Kubicki
     National Alliance for Medical Image Computing                                              -3-
                                                            Data
 This course is built upon three datasets from a
   single healthy subject brain:




 DWI (Nrrd)                    Optional:        ROI Image (Nrrd)
                             Whitematter
                                                 shown overlaid on
                             Image (Nrrd)        baseline DWI, tan
                                                 pixel is seed ROI

Pujol von Siebenthal, Bouix, Kubicki
Terry,S, Gollub R
Rausch, von Siebenthal, Bouix, Kubicki
National Alliance for Medical Image Computing                        -4-
                                                      ROI Image
     Regions of Interest (ROI) are
     denoted by an integer label.




  An ROI image overlaid on FA image, regions with zero label are transparent.
  The ROI image is an integer image. Each value defines a unique region.

Terry,S, Gollub R
Pujol von Siebenthal, Bouix, Kubicki
Rausch, von Siebenthal, Bouix, Kubicki
National Alliance for Medical Image Computing                                   -5-
                                    Learning objective
                                                       INPUT:
Following this tutorial,                                DWI,
                                                      ROI Images
you‟ll be able to seed
nerve fiber bundles
                                                   Python Stochastic
and compute a                                     Tractography Module
connectivity map
using the stochastic
                                                       OUTPUT:
tractography module.                                  Connectivity
                                                         Map
This map can be used
for further analysis.
                                                    Further Analysis


  Pujol von Siebenthal, Bouix, Kubicki
  Terry,S, Gollub R
  Rausch, von Siebenthal, Bouix, Kubicki
  National Alliance for Medical Image Computing                         -6-
                                    Enabling Daemons
• Also note, if this is your first time using a python module, you
  must change one slicer setting.
   – On the top menu, click “View”
   – Go down to “Application Settings” and select it.
   – Click the “Slicer Settings” Tab
   – Click the box to “Slicer Daemon” to enable Slicer
      Daemons.
   – You must now close and restart Slicer 3 for these changes to
      take effect.




     Pujol von Siebenthal, Bouix, Kubicki
     Terry,S, Gollub R
     Rausch, von Siebenthal, Bouix, Kubicki
     National Alliance for Medical Image Computing                   -7-
                                                     Loading Volumes
Click the „Load Data‟
 folder button in the
 upper left part of the
 program. On the
 dropdown menu that
 appears, choose
 „Add data‟




          Pujol von Siebenthal, Bouix, Kubicki
          Terry,S, Gollub R
          Rausch, von Siebenthal, Bouix, Kubicki
          National Alliance for Medical Image Computing           -8-
                                                     Loading images
• In the „Add Data‟ box that
  appears, Click Add File(s)
• Search file directory for your
  dwi nrrd file. In this tutorial,
  we will be using namic01-
  dwi_compressed.nhdr
• Click Open

• Click Add File(s) again
• Search your file directory for
  ROI file(s). We will use
  namic01-ROI-
  corpuscallosum.nhdr
• Click Open


           Terry,S, Gollub R
           Pujol von Siebenthal, Bouix, Kubicki
           Rausch, von Siebenthal, Bouix, Kubicki
           National Alliance for Medical Image Computing              -9-
                                                          Loading ROI
• For each image you‟re loading,
  select the „Centered‟ box
• For your ROI, select the
  „LabelMap‟ box




• If you‟re using multiple ROIs,
  you should load those now the
  same way, by clicking Add
  File(s), opening the appropriate
  nrrd, and checking the Centered
  and LabelMap options – this is
  optional, and we won‟t do so at
  this point in the tutorial

          Pujol von Siebenthal, Bouix, Kubicki
          Terry,S, Gollub R
          Rausch, von Siebenthal, Bouix, Kubicki
          National Alliance for Medical Image Computing                 -10-
                               Different Data Sets
 • This module was created on the framework that
   it could be used by anyone with a diffusion
   weighted image without external preprocessing
   steps, therefore making it available to anyone
   interested in probabilistic tractography. As long
   as the data can be loaded into Slicer, it can
   undergo Python Stochastic Tractography.




Pujol von Siebenthal, Bouix, Kubicki
Terry,S, Gollub R
Rausch, von Siebenthal, Bouix, Kubicki
National Alliance for Medical Image Computing          -11-
                                                 Verifying the ROI

• 1st Click the Rings
  to link views.
• Set B(ackground)
  as DWI.nhdr image
• Set F(oreground) as
  ROI.nhdr image
• Use slider to
  examine ROI and
  make sure it is over
  correct area of DWI.




           Pujol von Siebenthal, Bouix, Kubicki
           Terry,S, Gollub R
           Rausch, von Siebenthal, Bouix, Kubicki
           National Alliance for Medical Image Computing             -12-
                                                 Verifying the ROI

• Slide left and right
  to examine the
  position of your ROI
  in the 3D space of
  the brain.
• In our case, the tan
  dot is placed
  centrally in the
  corpus callosum,
  just as we expect.




           Pujol von Siebenthal, Bouix, Kubicki
           Terry,S, Gollub R
           Rausch, von Siebenthal, Bouix, Kubicki
           National Alliance for Medical Image Computing             -13-
                                      White Matter Mask
• A white matter mask is used
  to include only white matter
  portions of the brain in
  tractography to save
  computation time.
• See an example WM Mask
  by loading namic01-dwi-
  compressed.nhdr from the
  tutorial dataset.
• If you don‟t have a mask for
  your DWI, the next steps will
  give us the upper and lower
  thresholds needed by the
  Stochastic Tractography
  module to automatically                 White matter mask overlaid on DWI baseline image
  create one.

      Pujol von Siebenthal, Bouix, Kubicki
      Terry,S, Gollub R
      Rausch, von Siebenthal, Bouix, Kubicki
      National Alliance for Medical Image Computing                                          -14-
                                                    Extract DWI


• Click the Modules drop
  down tab.
• Select Diffusion
• Select Diffusion Tensor
  Estimation




    Pujol von Siebenthal, Bouix, Kubicki
    Terry,S, Gollub R
    Rausch, von Siebenthal, Bouix, Kubicki
    National Alliance for Medical Image Computing                 -15-
                                                Extract DWI

• Click the box next to Input
  DWI Volume and select
  namic01-dwi-
  compressed.nhdr
• Click the boxes next to
  Output DTI Volume, Output
  Baseline Volume, and Otsu
  Threshold Mask, and for
  each option select Create
  New Volume




Pujol von Siebenthal, Bouix, Kubicki
Terry,S, Gollub R
Rausch, von Siebenthal, Bouix, Kubicki
National Alliance for Medical Image Computing                 -16-
                               Selecting the Baseline
• Once this has
  completed, we will
  load the baseline for
  finding our white
  matter mask
  thresholds
• Set B(ackground)
  as baseline image,
  which has lowest
  number of all the
  images created.




          Pujol von Siebenthal, Bouix, Kubicki
          Terry,S, Gollub R
          Rausch, von Siebenthal, Bouix, Kubicki
          National Alliance for Medical Image Computing   -17-
                              Thresholding Baseline

• Click the Modules drop down tab and
  select Volumes.
• Set the Active Volume to the new
  Baseline Image.
• Adjust the Window/Level values by moving
  the sliders to make the grey scale image
  easily viewable




         Pujol von Siebenthal, Bouix, Kubicki
         Terry,S, Gollub R
         Rausch, von Siebenthal, Bouix, Kubicki
         National Alliance for Medical Image Computing   -18-
                                         Baseline Intensities
• Bright white areas of the
  ventricles should be
  excluded
• Dark areas outside the
  brain should also be
  excluded.
• Moving your mouse over
  the image, find the range
  of numbers you want to
  include inside the brain
  by looking at the „Bg‟
  value shown in the corner
  of your active axis
• Record the upper and
  lower thresholds for later
  use.

           Terry,S, Gollub R
           Pujol von Siebenthal, Bouix, Kubicki
           Rausch, von Siebenthal, Bouix, Kubicki
           National Alliance for Medical Image Computing        -19-
       Launch Stochastic Tractography


 • Click the Modules drop
   down tab.
 • Select Diffusion.
 • Select Python Stochastic
   Tractography.




Pujol von Siebenthal, Bouix, Kubicki
Terry,S, Gollub R
Rausch, von Siebenthal, Bouix, Kubicki
National Alliance for Medical Image Computing   -20-
                                              Input/Output Tab
• Click Input DWI Volume
  drop-down menu and select
  the namic01-dwi-
  compressed.nhdr
• Click Input ROI Volume
  drop-down menu and select
  the namic01-ROI-
  corpuscallosum.nhdr
• Optional:
• Enter in a second ROI (for
  filtering) or White Matter
  Volume




        Pujol von Siebenthal, Bouix, Kubicki
        Terry,S, Gollub R
        Rausch, von Siebenthal, Bouix, Kubicki
        National Alliance for Medical Image Computing            -21-
                                        Input/Output Tab

• If you would like not only all
  the tracts coming from one
  seed ROI, but rather all the
  tracts coming from one seed
  ROI that also go though a
  second ROI, you should
  select that ROI as your Input
  ROI Volume (Region B)




  Pujol von Siebenthal, Bouix, Kubicki
  Terry,S, Gollub R
  Rausch, von Siebenthal, Bouix, Kubicki
  National Alliance for Medical Image Computing            -22-
                                        Input/Output Tab

• If you would prefer to use
  your own previously
  generated white matter
  mask, select Input WM
  Volume and select your
  mask.




  Pujol von Siebenthal, Bouix, Kubicki
  Terry,S, Gollub R
  Rausch, von Siebenthal, Bouix, Kubicki
  National Alliance for Medical Image Computing            -23-
                                                   Smoothing Tab
• To enable Gaussian
  Smoothing, click the box
  next to Enabled so the
  check mark is displayed
• Enter in FWHM (Full width
  at half max in millimeters)
  numbers for each direction.
  This is the „spread‟ of the
  gaussian in the x, y, and z
  directions. The larger the
  value the more blurring will
  occur.




       Pujol von Siebenthal, Bouix, Kubicki
       Terry,S, Gollub R
       Rausch, von Siebenthal, Bouix, Kubicki
       National Alliance for Medical Image Computing               -24-
                                                    Brain Mask Tab
• To enable the mask, click
  the box next to Enabled so
  the check mark is displayed
• Enter in Lower and Higher
  brain threshold numbers
  (based on baseline intensity
  values). We will use 200-
  800.
• These are the values you
  determined by looking at the
  „Bg‟ values on the extracted
  baseline.
• A wider threshold will
  include more of the brain,
  but may take more
  processing time

          Terry,S, Gollub R
          Pujol von Siebenthal, Bouix, Kubicki
          Rausch, von Siebenthal, Bouix, Kubicki
          National Alliance for Medical Image Computing              -25-
                                                IJK/RAS switch


• Leave this box checked if
  your scans are in IJK space.
  We will check the box for the
  tutorial.




     Terry,S, Gollub R
     Pujol von Siebenthal, Bouix, Kubicki
     Rausch, von Siebenthal, Bouix, Kubicki
     National Alliance for Medical Image Computing               -26-
                              Diffusion Tensor Tab


• Check Enabled as well as
  FA, TRACE, and/or MODE
  to output anisotropy index
  images.




     Terry,S, Gollub R
     Pujol von Siebenthal, Bouix, Kubicki
     Rausch, von Siebenthal, Bouix, Kubicki
     National Alliance for Medical Image Computing   -27-
                                                    Tractography Tab
• Set Total Tracts to the number on
  tracts you want to be seeded from
  each ROI voxel. Hundreds are needed
  to ensure a reliable study. For a quick
  and dirty tutorial example we‟ll use 50.
• Set Maximum Tract Length to the
  length (in mm). For the tutorial, we use
  200mm so that no tracts are longer
  than the length of the brain.                            • Check Stopping criteria and enter FA
• Set Step Size as the distance between                      value from 0 to 1 to terminate tracts
  each re-estimation of tensors (usually                     (e.g. to stop fibers from traveling
  between 0.5 and 1 mm). If this is larger                   through the CSF). Normally this is not
  than your voxel size, you can possibly                     used in stochastic tractography, and
  jump over whole slices. In the tutorial,                   we will not check it in this tutorial.
  we‟ll use 0.8mm.


           Pujol von Siebenthal, Bouix, Kubicki
           Terry,S, Gollub R
           Rausch, von Siebenthal, Bouix, Kubicki
           National Alliance for Medical Image Computing                                       -28-
                                  Connectivity Map Tab
• Choose a Computation Mode.
     • binary (each voxel is counted only
       once if a fiber passes through it)
     • cumulative (tracts are summed by
       voxel independently) We‟ll use this
       setting for the tutorial.
     • weighted (tracts are summed by
       voxel depending on their length).
• Length Based only shows tracts meeting
  length criteria. It is not used in this tutorial.
     • small shows only the shortest 1/3rd of
       tracts
     • medium shows only the middle1/3rd
     • large shows only the longest 1/3rd

            Terry,S, Gollub R
            Pujol von Siebenthal, Bouix, Kubicki
            Rausch, von Siebenthal, Bouix, Kubicki
            National Alliance for Medical Image Computing   -29-
                                Connectivity Map Tab
• The remaining options only apply to 2-ROI
  experiments, and so will not be used in
  the tutorial.
    • Threshold between 0 and 1 will cut
      out tracts that have a lower fraction of
      tracts on the connectivity map
    • Tract Offset defines how far back
      along a tract after its termination the
      algorithm will search for membership
      in a second ROI
    • Use spherical ROI vicinity takes a
      second ROI and expands it
      spherically. Useful for very small
      target ROIs. Vicinity sets the size of
      the spherical expansion.

          Terry,S, Gollub R
          Pujol von Siebenthal, Bouix, Kubicki
          Rausch, von Siebenthal, Bouix, Kubicki
          National Alliance for Medical Image Computing   -30-
       Automatic Server Initialisation


• In Linux and Mac only, this allows the
  server running the algorithm to
  automatically be started




        Terry,S, Gollub R
        Pujol von Siebenthal, Bouix, Kubicki
        Rausch, von Siebenthal, Bouix, Kubicki
        National Alliance for Medical Image Computing   -31-
                            Running Tractography

• Now that settings are properly
  configured, hit Apply to begin
  tractography.




• If a pop-up appears asking to allow
  external connections from 127.0.0.1,
  click Yes.




       Pujol von Siebenthal, Bouix, Kubicki
       Terry,S, Gollub R
       Rausch, von Siebenthal, Bouix, Kubicki
       National Alliance for Medical Image Computing   -32-
                                                             …wait.
 • Wait until computation is completed.




Completed!




             Pujol S, Gollub R
             Rausch, von Siebenthal, Bouix, Kubicki
             National Alliance for Medical Image Computing            -33-
                                           Module Outputs
• Once tractography is complete, it
  should output 6 new images
     • brain_### is the mask created by
       the module
     • tensor_### is the tensor image
     • fa_### is an fa map
     • trace_### is a trace map
     • mode_### is a mode map
     • cmFA_### is a normalized
       connectivity map, where each
       voxel has a value from 0 to 1
       describing the percentage of the
       total number of tracts that go
       through this voxel

 Pujol S, Gollub R
 Rausch, von Siebenthal, Bouix, Kubicki
 National Alliance for Medical Image Computing              -34-
                                     Connectivity Map




• The connectivity map is the key output of stochastic tractography,
  defining a probability of a tract coming from your seed ROI being
  present at a given point. The image output of stochastic is a grey
  scale image with values from 0 to 1 describing this probability.

Pujol S, Gollub R
Rausch, von Siebenthal, Bouix, Kubicki
National Alliance for Medical Image Computing                          -35-
                                     Threshold Indication
• Scroll over the
  connectivity
  map to see its
  intensity values
  under “Bg”. You
  can threshold
  the connectivity
  map in the
  Editor, or
  examine it in 3D
  with the Volume
  Rendering
  Module.




          Terry,S, Gollub R
          Pujol von Siebenthal, Bouix, Kubicki
          Rausch, von Siebenthal, Bouix, Kubicki
          National Alliance for Medical Image Computing     -36-
                                                     Saving Outputs
• Go to File at the
  top right corner
  of the screen and
  select Save.
• Rename the
  newly created
  files as you
  choose and save
  them in preferred
  directory.




          Pujol S, Gollub R
          Rausch, von Siebenthal, Bouix, Kubicki
          National Alliance for Medical Image Computing               -37-
                                                Visualizations


• Connectivity files have now been created and can be visualized in
  2D or 3D with a couple modules in Slicer.
      • Editor
      • VolumeRendering




Pujol S, Gollub R
Rausch, von Siebenthal, Bouix, Kubicki
National Alliance for Medical Image Computing                         -38-
                               Threshold Label Maps
• Go to the Editor from the
  Modules dropdown menu
• Next to Create Label Map
  From select cmFA_###
• Select the Threshold tool
• Change the lower bound to
  0.1 so that only voxels with
  a 10% chance of
  connecting or higher will
  be included
• Press Apply
• This label map can be
  used for label statistics
  analysis of FA, Mode, etc.


          Pujol S, Gollub R
          Rausch, von Siebenthal, Bouix, Kubicki
          National Alliance for Medical Image Computing   -39-
                       Volume Rendering Tab
• VolumeRendering will allow you to create
  a 3D model of your probability cloud.
• Drop down the Modules tab and select
  Volume Rendering.
• Under Background Volume, next to
  Source, select cmFA_###. This will create
  a probability cloud of the tracts out by
  stochastic tractography.
• If you would like to threshold this cloud to
  only contain connections with >10%
  chance of connection, under the
  Rendering tab, select the Volume Property
  pane, check the Use Thresholding box to
  enable, and set the lower value to 0.1.


     Pujol S, Gollub R
     Rausch, von Siebenthal, Bouix, Kubicki
     National Alliance for Medical Image Computing   -40-
                              Acknowledgements
           National Alliance for Medical Image Computing
           NIH U54 EB005149

           Morphometry Biomedical Informatics Research Network
           NIH U24 RRO21382

           Surgical Planning Laboratory (BWH)


           Psychiatry Neuroimaging Laboratory


           Marek Kubicki’s NIH Grant




Pujol von Siebenthal, Bouix, Kubicki
Terry,S, Gollub R
Rausch, von Siebenthal, Bouix, Kubicki
National Alliance for Medical Image Computing                    -41-
                                                     Appendix
• The following images have been generated from either
  Model Maker or Volume Rendering and modified
  under Models and Volumes just to show you the many
  things you can do with your Python Stochastic
  Tractography Output.

• The brain based models are seeded from a corpus
  callosum ROI from the data of Anna Rotarska-Jagiela
  at Goethe-Universität.
• The helix based models are seeded from an arbitrary
  ROI from the phantom of Sonia Pujol at BWH.

     Pujol S, Gollub R
     Terry, von Siebenthal, Bouix, Kubicki
     National Alliance for Medical Image Computing              -42-
                                          Visualize Model




Pujol S, Gollub R
Terry, von Siebenthal, Bouix, Kubicki
National Alliance for Medical Image Computing               -43-
Pujol S, Gollub R
Terry, von Siebenthal, Bouix, Kubicki
National Alliance for Medical Image Computing   -44-
   Glyphs Turned on under Volumes




Pujol S, Gollub R
Terry, von Siebenthal, Bouix, Kubicki
National Alliance for Medical Image Computing   -45-
                 Visualize glyphs with models




Pujol S, Gollub R
Terry, von Siebenthal, Bouix, Kubicki
National Alliance for Medical Image Computing   -46-
                                                Thresholded




Pujol S, Gollub R
Terry, von Siebenthal, Bouix, Kubicki
National Alliance for Medical Image Computing                 -47-
Pujol S, Gollub R
Terry, von Siebenthal, Bouix, Kubicki
National Alliance for Medical Image Computing   -48-
 Visualize Tensor (FA) Connectivity




Pujol S, Gollub R
Terry, von Siebenthal, Bouix, Kubicki
National Alliance for Medical Image Computing   -49-
Pujol S, Gollub R
Terry, von Siebenthal, Bouix, Kubicki
National Alliance for Medical Image Computing   -50-
     From Helix Phantom with ROI




Pujol S, Gollub R
Terry, von Siebenthal, Bouix, Kubicki
National Alliance for Medical Image Computing   -51-
Pujol S, Gollub R
Terry, von Siebenthal, Bouix, Kubicki
National Alliance for Medical Image Computing   -52-
Pujol S, Gollub R
Terry, von Siebenthal, Bouix, Kubicki
National Alliance for Medical Image Computing   -53-
Pujol S, Gollub R
Terry, von Siebenthal, Bouix, Kubicki
National Alliance for Medical Image Computing   -54-

								
To top