8000 GitHub - OzgunOzalay/SubTract: SubTract is a comprehensive white matter tractography pipeline designed for studying connectivity in limbic brain regions, with a particular focus on bed nucleus of the stria terminalis (BNST) circuitry.
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

SubTract is a comprehensive white matter tractography pipeline designed for studying connectivity in limbic brain regions, with a particular focus on bed nucleus of the stria terminalis (BNST) circuitry.

Notifications You must be signed in to change notification settings

OzgunOzalay/SubTract

Repository files navigation

SubTract: White Matter Tractography Pipeline

SubTract is a comprehensive white matter tractography pipeline designed for studying connectivity in limbic brain regions, with a particular focus on bed nucleus of the stria terminalis (BNST) circuitry. The pipeline has been completely migrated from Bash to Python, providing improved reliability, BIDS compliance, and modern software engineering practices.

๐ŸŽ‰ Version 1.0.0 Alpha - Complete Pipeline Implementation

The complete SubTract pipeline is now available! All 11 processing steps have been successfully migrated from Bash to Python, offering a robust, BIDS-compliant solution for white matter tractography analysis.

๐Ÿง  Scientific Background

SubTract is specifically designed for an alyzing white matter connectivity in limbic circuits, particularly :

  • Bed Nucleus of the Stria Terminalis (BNST): A key component of the extended amygdala
  • Amygdala: Central to fear and emotional processing
  • Hippocampus: Critical for memory formation
  • Hypothalamus: Essential for neuroendocrine regulation
  • Ventromedial Prefrontal Cortex: Important for emotion regulation

The pipeline performs probabilistic tractography between these regions and generates comprehensive connectivity fingerprints to characterize individual differences in white matter connectivity patterns.

๐Ÿ—๏ธ Complete Pipeline Architecture

โœ… All Steps Implemented and Tested (Steps 001-011)

  1. Data Organization (001) - BIDS-compliant data structure setup
  2. DWI Denoising (002) - MP-PCA denoising with MRtrix3
  3. Distortion Correction (003) - FSL TopUp with dual phase encoding
  4. Motion/Eddy Correction (004) - FSL Eddy with CUDA acceleration
  5. Registration (005) - ANTs-based MNIโ†’DWI template registration
  6. Microstructure Modeling (006) - MDT NODDI & Ball-Stick fitting
  7. MRtrix3 Preprocessing (007) - FOD estimation and 5TT generation
  8. Tractography (008) - โœ… COMPLETE - Probabilistic tracking with ACT
  9. SIFT2 Filtering (009) - โœ… COMPLETE - Track density optimization
  10. ROI Registration (010) - โœ… COMPLETE - fs2diff ROI transformation
  11. Connectome Generation (011) - โœ… COMPLETE - Connectivity matrix & fingerprints

๐Ÿ†• New in v1.0.0 Alpha

  • Complete ROI Registration: Automated transformation of 12 BNST network ROIs from fsaverage to subject DWI space
  • Connectivity Fingerprints: Microstructure-weighted connectivity matrices for bilateral BNST analysis
  • Composite Microstructure: Optimized combination of NODDI and Ball-Stick metrics
  • Full BIDS Compliance: Standardized paths and naming throughout

๐Ÿš€ Key Features

  • ๐Ÿ”ฌ BIDS Compliance: Native support for Brain Imaging Data Structure
  • ๐Ÿ Modern Python: Type-safe implementation with Pydantic validation
  • ๐Ÿ”ง Multi-Conda Integration: Automatic tool isolation (subtract/ants/mdt environments)
  • โšก GPU Acceleration: CUDA support for FSL Eddy correction
  • ๐Ÿ“Š Rich CLI: Beautiful progress tracking and reporting with status dashboard
  • ๐Ÿ”„ Resume Capability: Robust error handling with restart functionality
  • ๐Ÿ“ˆ Scalable: Multi-subject parallel processing
  • ๐ŸŽฏ Microstructure-Informed: Integration of NODDI metrics with tractography
  • ๐Ÿงฎ Complete Connectomics: From preprocessing to connectivity fingerprints

๐Ÿ’ป Installation

Prerequisites

  • Python 3.8+
  • Conda/Miniconda
  • CUDA Toolkit (optional, for GPU acceleration)

Required Conda Environments

The pipeline uses multiple conda environments for tool isolation:

# Subtract environment with MRtrix3 and FSL
conda create -n subtract python=3.9
conda activate subtract  
conda install -c mrtrix3 mrtrix3=3.0.4
# Add FSL, FreeSurfer, and other tools

# ANTs environment for registration
conda create -n ants -c conda-forge ants

# MDT environment for microstructure modeling
conda create -n mdt python=3.8
# Install MDT tools if hardware supports

Pipeline Installation

# Clone repository
git clone https://github.com/yourusername/SubTract.git
cd SubTract

# Install Python package
pip install -e .

# Verify installation
subtract --help

๐Ÿ“Š Usage

Complete Pipeline Execution

# Run full pipeline (all 11 steps)
subtract run /path/to/bids/dataset \
    --participant-label sub-001 sub-002

# Run specific steps only
subtract run /path/to/bids/dataset \
    --steps tractography,sift2,roi_registration,connectome \
    --participant-label sub-001

# Use configuration file for customization
subtract run-config example_config.yaml

# Check pipeline status
subtract status /path/to/bids/dataset --participant-label sub-001

Configuration

The pipeline uses YAML configuration files. See example_config.yaml for all options:

# Essential paths
paths:
  base_path: /path/to/project
  data_dir: /path/to/bids/dataset
  analysis_dir: /path/to/derivatives/subtract

# Processing parameters
processing:
  n_threads: 24
  n_tracks: 1000000  # 1M tracks per hemisphere
  track_algorithm: "iFOD2"
  eddy_cuda: true
  
  # SIFT2 filtering parameters  
  sift2_ndi_threshold: 0.1
  sift2_output_coeffs: true
  sift2_output_mu: true

# ROI configuration
rois:
  roi_names:
    - "Amyg_L_MNI"
    - "Amyg_R_MNI"
    - "BNST_L_MNI" 
    - "BNST_R_MNI"
    - "Hipp_L_MNI"
    - "Hipp_R_MNI"
  target_rois:
    - "BNST_L"
    - "BNST_R"

๐Ÿงช Testing & Validation

Latest Test Results (January 2025)

Environment: Linux 6.8.0-60-generic
Test Subject: ALC2004 (BIDS format)
Pipeline Steps: Complete pipeline (001-011)
Success Rate: 100%

Key Outputs Generated:

  • Tractography: tracks_1M_BNST_L.tck, tracks_1M_BNST_R.tck
  • SIFT2 Weights: Track density optimization with NDI weighting
  • ROI Registration: 12 bilateral ROIs transformed to subject space
  • Connectivity: L_BNST_fingerprint.csv, R_BNST_fingerprint.csv
  • Microstructure: composite_microstructure.mif with optimized formula

Hardware Requirements

  • CPU: Multi-core recommended (pipeline uses 24 threads by default)
  • RAM: 16GB+ recommended for large datasets
  • GPU: NVIDIA GPU with CUDA for accelerated Eddy correction
  • Storage: ~15GB per subject for complete pipeline outputs

๐Ÿ“ Project Structure

SubTract/
โ”œโ”€โ”€ src/subtract/           # Main Python package
โ”‚   โ”œโ”€โ”€ config/            # Configuration management
โ”‚   โ”œโ”€โ”€ core/              # Pipeline orchestration
โ”‚   โ”œโ”€โ”€ preprocessing/     # Steps 001-007
โ”‚   โ”œโ”€โ”€ tractography/      # Steps 008-009
โ”‚   โ”œโ”€โ”€ registration/      # Step 010
โ”‚   โ”œโ”€โ”€ connectome/        # Step 011
โ”‚   โ””โ”€โ”€ utils/             # Utility functions
โ”œโ”€โ”€ ROIs/                  # Template ROI files
โ”œโ”€โ”€ Templates/             # Brain templates
โ”œโ”€โ”€ example_config.yaml    # Configuration template
โ”œโ”€โ”€ requirements.txt       # Python dependencies
โ””โ”€โ”€ README.md             # This file

๐Ÿ”ง Development Status

โœ… Production Ready (v1.0.0 Alpha)

  • Complete Pipeline: All 11 steps implemented and tested
  • BIDS Support: Full compliance with BIDS specification
  • Multi-Environment: Seamless conda environment management
  • Error Handling: Robust validation and recovery mechanisms
  • Rich CLI: Progress tracking and status reporting
  • Connectivity Analysis: Microstructure-informed connectomics

๐ŸŽฏ Pipeline Capabilities

  • End-to-end processing from raw DWI to connectivity fingerprints
  • Bilateral BNST network analysis with 12 ROI regions
  • Microstructure-weighted track filtering using NODDI metrics
  • Automated quality control and validation at each step
  • Resume capability for interrupted processing

๐Ÿ“ˆ Performance Features

  • Optimized track count (1M per hemisphere) for efficiency
  • GPU acceleration for motion correction
  • Parallel subject processing capability
  • Smart caching and intermediate file management

๐ŸŽฏ Output Structure

derivatives/subtract/sub-{subject}/dwi/
โ”œโ”€โ”€ preprocessed/          # Steps 001-007 outputs
โ”œโ”€โ”€ mrtrix3/              # Tractography and filtering
โ”‚   โ”œโ”€โ”€ tracks_1M_BNST_L.tck
โ”‚   โ”œโ”€โ”€ tracks_1M_BNST_R.tck  
โ”‚   โ”œโ”€โ”€ sift_1M_BNST_L.txt
โ”‚   โ””โ”€โ”€ ROIs/             # Registered ROI files
โ””โ”€โ”€ connectome/           # Step 011 outputs
    โ”œโ”€โ”€ composite_microstructure.mif
    โ”œโ”€โ”€ track_weights_1M_BNST_L.txt
    โ””โ”€โ”€ fingerprints/
        โ”œโ”€โ”€ L_BNST_fingerprint.csv
        โ””โ”€โ”€ R_BNST_fingerprint.csv

๐Ÿค Contributing

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/amazing-feature)
  3. Commit changes (git commit -m 'Add amazing feature')
  4. Push to branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

๐Ÿ“š Documentation

  • Technical Details: See README_PYTHON.md for comprehensive API documentation
  • Migration Status: See MIGRATION_STATUS.md for completed migration details
  • Changelog: See CHANGELOG.md for version history and updates

๐Ÿ“ง Contact

For questions about the SubTract pipeline, please open an issue on GitHub or contact the development team.

๐Ÿ“„ License

This project is licensed under the MIT License - see the LICENSE file for details.

๐Ÿ™ Acknowledgments

  • MRtrix3 team for excellent tractography tools
  • FSL team for preprocessing utilities
  • ANTs team for registration methods
  • BIDS community for data standardization
  • MDT developers for microstructure modeling tools

About

SubTract is a comprehensive white matter tractography pipeline designed for studying connectivity in limbic brain regions, with a particular focus on bed nucleus of the stria terminalis (BNST) circuitry.

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages

0