-
Notifications
You must be signed in to change notification settings - Fork 34
4) Measurement from Clustered Tracts
- In order to measure from all individual clusters across all subjects, use this command.
- wm_measure_all_subjects.py
- The Tractography Measurements module takes an input of a folder containing fiber clusters/tracts (vtk/vtp), and outputs measured values of each input file.
- The output of the Tractography Measurements module is a comma-separated or tab-separated file that can be viewed in Excel or any other spreadsheet program.
- To measure automatically from all fiber clusters/tracts in a directory:
cli=SLICER_SUPERBUILD_PATH/Slicer-build/lib/Slicer-4.5/cli-modules/FiberTractMeasurements
inputdir=PATH_OF_FIBER_CLUSTERS
outputtxt=PATH_OF_FIBER_CLUSTERS/measurements.txt
$cli --inputtype Fibers_File_Folder --inputdirectory $inputdir --outputfile $outputtxt --format Column_Hierarchy --separator Tab
- To run this module from the command line by launching using the environment of Slicer to make sure all libraries are found (this example uses a nightly version of Slicer on linux):
~/software/Slicer-nightlies/Slicer-4.4.0-2015-10-26-linux-amd64/Slicer --launch ~/software/Slicer-nightlies/Slicer-4.4.0-2015-10-26-linux-amd64/lib/Slicer-4.4/cli-modules/FiberTractMeasurements -f Column_Hierarchy -i Fibers_File_Folder --inputdirectory 1T_fw_subjID_clean_reg_reg --outputfile 1T_fw_subjID_clean_reg_reg.csv
-
In order to measure using a fiber hierarchy, which allows grouping of clusters according to anatomical criteria for a study, it is currently necessary to measure from each subject individually. This can be done on the command line using the Slicer Fiber Tract Scalar Measurements module as follows.
-
To measure using a fiber hierarchy (for example to combine corpus subregions together and correctly measure their mean FA):
/opt/quarantine/slicer/nightly/build/lib/Slicer-4.5/cli-modules/FiberTractMeasurements --outputfile /projects/saba/SCZsubtype_classification_project/file_FibersHierarchy2.csv --inputdirectory /projects/saba/SCZsubtype_classification_project/wma_output_new/ApplyAtlasToNewSubjects/ClusterByHemisphere/S015/tracts_commissural/ --fiberHierarchy /projects/saba/SCZsubtype_classification_project/wma_output_new/ApplyAtlasToNewSubjects/ClusterByHemisphere/S015/tracts_commissural/clustered_tracts_mod2.mrml#vtkMRMLModelHierarchyNode1 -i Fibers_Hierarchy --separator Tab
- To find the node ID of the hierarchy node to use for measurement using the --fibersHierarchy parameter, you can use the grep command on the mrml file to get the node ID:
grep -i corpus_callosum ./clustered_tracts_mod2.mrml | cut -d ' ' -f 3
-
Please note these commands must be edited for your location of Slicer and your data.
-
Slicer Fiber Bundle Selection and Scalar Measurements Tutorial: https://github.com/SlicerDMRI/slicerdmri.github.io/blob/master/docs/tutorials/FiberBundleSelectionAndScalarMeasurement.pdf
-
Tractography selection and measurements in command line interface (CLI) mode: https://github.com/SlicerDMRI/slicerdmri.github.io/blob/master/docs/tutorials/CLITutorial.pdf
-
Usage from CLI with whitematteranalysis: https://github.com/SlicerDMRI/whitematteranalysis/wiki/Visualization-and-Analysis-of-Clustered-Tracts
- To ensure all measurements have the same header (same variables measured) and to test subject clustering success and report possible outliers:
wm_quality_control_cluster_measurements.py measurement_directory
- At this stage, any datasets failing the clustering pipeline can be detected. For less strict outlier detection:
wm_quality_control_cluster_measurements.py measurement_directory -outlier_std 3
- To export data measured by Slicer into one Excel-readable file containing data from all subjects:
wm_statistics_export_data.py measurement_directory subject_IDs.xlsx output.txt -m tensor1.FractionalAnisotropy tensor1.Trace