/
TractSeg & Tractometry Examples

Attention: Confluence is not suitable for the storage of highly confidential data. Please ensure that any data classified as Highly Protected is stored using a more secure platform.
If you have any questions, please refer to the University's data classification guide or contact ict.askcyber@sydney.edu.au

TractSeg & Tractometry Examples

This page will show examples of Tractseg commands that are currently being tested. Official TractSeg documentation is listed here.

 

To run TractSeg on Artemis, you will need to load python modules and modules that need to support pytorch. If you are using python/3.6.5 - module load cuda/10.0.130 & openmpi-gcc/3.1.3
For python/3.7.7 - module load magma/2.5.3 & openmpi-gcc/3.1.5

 

Running TractSeg Tractometry with peaks given from mrtrix3

  1. Continuing from a mrtrix pipeline, you need to extract the peaks of each voxel (sh2peaks).

  2. You will need to run the standard TractSeg pipeline for:

    1. segmentations

    2. Tract Orientation Maps (TOMs)

    3. tractograms

  3. a) Perform tractometry (segment each streamline) using peaks created from mrtrix3 pipeline

#!/bin/bash -v #PBS -P FFCheng #PBS -N TractSeg_Tractometry #PBS -l select=1:ncpus=16:ngpus=1:mem=16GB #PBS -q=main #PBS -l walltime=4:00:00 #PBS -q defaultQ cd $PBS_O_WORKDIR module load openmpi-gcc/3.1.3 module load cuda/10.0.130 module load python/3.6.5 module load mrtrix3tissue/5.2.7 module load fsl/6.0.3 module load ants/2.3.2 module load mrtrix3/3.0.1 export FSLMETHOD=NONE tractseg_path=/scratch/FFCheng/DWI_mrtrix_longitudinal/Matched/TractSeg/${sub}/ mkdir ${tractseg_path} cd ${tractseg_path} sh2peaks /scratch/FFCheng/DWI_mrtrix_longitudinal/Matched/mrtrix3/DataProcessed/${sub}/tmp/${sub}_wmfod.mif.gz ${tractseg_path}${sub}_peaks.nii.gz TractSeg -i ${tractseg_path}${sub}_peaks.nii.gz TractSeg -i ${tractseg_path}${sub}_peaks.nii.gz --output_type endings_segmentation TractSeg -i ${tractseg_path}${sub}_peaks.nii.gz --output_type TOM Tracking -i ${tractseg_path}${sub}_peaks.nii.gz --tracking_format tck --nr_fibers 5000 cd ${tractseg_path}tractseg_output Tractometry -i TOM_trackings/ -o Tractometry.csv -e endings_segmentations/ -s ${tractseg_path}${sub}_peaks.nii.gz --TOM TOM/ --tracking_format tck --peak_length

 

b) Perform tractometry (segment each streamline) using preprocessed DWI

#mrconvert ${dataproc_path}${sub}_DWI_preprocessed.mif.gz ${tractseg_path}${sub}_DWI_preprocessed.nii.gz -export_grad_fsl ${tractseg_path}${sub}_DWI_preprocessed.bvecs ${tractseg_path}${sub}_DWI_preprocessed.bvals -force #dwi2tensor ${dataproc_path}${sub}_DWI_preprocessed.mif.gz ${tractseg_path}${sub}_DWI_preprocessed_tensor.mif -force #tensor2metric ${tractseg_path}${sub}_DWI_preprocessed_tensor.mif -fa ${tractseg_path}${sub}_DWI_preprocessed_FA.nii.gz -force TractSeg -i ${tractseg_path}${sub}_DWI_preprocessed.nii.gz -o ${tractseg_path} --raw_diffusion_input TractSeg -i ${tractseg_path}${sub}_peaks.nii.gz --output_type endings_segmentation TractSeg -i ${tractseg_path}${sub}_peaks.nii.gz --output_type TOM Tracking -i ${tractseg_path}${sub}_peaks.nii.gz --tracking_format tck --nr_fibers 5000 cd ${tractseg_path}tractseg_output Tractometry -i TOM_trackings/ -o Tractometry.csv -e endings_segmentations/ -s ${tractseg_path}${sub}_DWI_preprocessed_FA.nii.gz --tracking_format tck

 

Plotting results

You will need to load the same modules as listed above to plot results.

tractseg_path=/scratch/FFCheng/DWI_mrtrix_longitudinal/Matched/TractSeg/${sub}/ cd /scratch/FFCheng/DWI_mrtrix_longitudinal/Matched/TractSeg/ plot_tractometry_results -i /scratch/FFCheng/DWI_mrtrix_longitudinal/Matched/TractSeg/subjects.txt -o tractometry_result.png --mc

 

Related content

Pre-processing
Pre-processing
More like this
General Neuroimaging Process
General Neuroimaging Process
Read with this
Group Analysis (baseline)
Group Analysis (baseline)
More like this
MRtrix3
More like this
FreeSurfer
More like this
DWI & tractography preprocessing output check
DWI & tractography preprocessing output check
More like this