🧠
BRIDGE Lab Documentation
  • BRIDGE Lab Documentation
  • 📘General
    • About Us
    • Onboarding
      • First Steps
      • Research Specialist Training
      • Project Coordinator Training
    • Misc
      • How to do misc things
      • Burning Scans to a Disc
      • Setting Up Meetings in the Conference Room
      • Printing
    • Imaging Glossary
  • 🖇️Admin
    • Ourday
    • Training
    • Regulatory
    • Social Media
    • REDCap
      • Archiving REDCap Projects
  • 🖥️Tech
    • Setting Up Meetings in the Conference Room
    • Effective Troubleshooting
    • Remote Work Resources
    • Arthur
    • Servers
      • Connecting to an External Server
    • Bash 101
      • What is Bash?
      • Bash Examples
      • How to add elements to your bash profile
    • git and Github
  • 🩻Image Acquisition
    • ViSTa
  • 🗃️Data Organization
    • BIDs Data Formatting
    • MRI Data Organization
  • 🖼️Image Analysis
    • Image QC
      • Raw Data QC
        • Diffusion QC
        • T1/T2 QC
        • ViSTa QC
        • Spectroscopy QC
      • PyDesigner QC
    • Project Lifecycle
    • General Concepts
    • Raw Data
    • Preprocessing
      • Denoising UNI MP2RAGE Images
      • PyDesigner
      • ViSTa
    • Native Space Analysis
      • TractSeg
        • TractSeg + Within-Subject Registration
      • Segmentation
        • LST
        • Freesurfer
        • NOMIS
    • Registration
      • DTI-TK
      • TBSS
      • Coordinate Systems
    • Other Pipelines
    • Archiving
  • 📊Data Viz and Stats
    • Plotting in R
  • 📚Imaging Library
Powered by GitBook
On this page
  • Processing
  • Plotting Tractometry
  1. Image Analysis
  2. Native Space Analysis

TractSeg

Last updated 12 months ago

TractSeg is a method by which dMRI data is segmented into white matter bundles. The advantage of this method is that it takes place all in native space.

TractSeg can be easily installed with:

pip install TractSeg

Processing

TractSeg processing takes place in five steps:

TractSeg -i [input_dir]/preprocd_dwi.nii.gz -o [output_dir] --raw_diffusion_input --output_type tract_segmentation
TractSeg -i [output_dir]/peaks.nii.gz -o [output_dir] --output_type endings_segmentation
TractSeg -i [output_dir]/peaks.nii.gz -o [output_dir] --output_type TOM 
Tracking -i [output_dir]/peaks.nii.gz -o [output_dir] --nr_fibers 5000
Tractometry -i [output_dir]TOM_trackings/ -o [tractometry_output]/Tractometry.csv -e [output_dir]endings_segmentations/ -s [input_dir]/metric.nii

The outputs for the first three steps should look like this:

Tractometry outputs should look like this (note that this is a small snippet of the larger output CSV:

Note that all data is collected in column A and can be split into a proper table using Text-to-Columns in Excel. The top row is all of the discrete tracts segmented by the first four steps of the pipeline. In the following rows, you will find the average of the metric across all of the points along the tract.

Plotting Tractometry

TractSeg's current plotting modules is not ideal for our needs. We have constructed an in-house plotting script in R which outputs a variety of visualizations. In order to use this script, the Tractometry output CSVs need to be slightly rearranged. You can use this script to do that:

Once your CSVs are correctly organized, you can generate plots using this script:

Because there are so many plots, it is not feasible to save them all manually. The easiest way to save plots is by converting this script to an R Markdown script and then Knitting the script to output a DOCX or a PDF.

🖼️
922B
combine_csvs.sh
10KB
tractsegR.R
GitHub - MIC-DKFZ/TractSeg: Automatic White Matter Bundle SegmentationGitHub
Logo