This repository contains a Python-based pipeline for Diffusion Tensor Imaging (DTI) reconstruction and Fiber Tractography. Using the DIPY library, the script processes diffusion-weighted magnetic resonance imaging (dMRI) data, fits a tensor model, and generates 3D streamlines representing white matter pathways.
Interactive 3D visualization generated by the pipeline.
This repository was a supplementary tool for a presentation made for a Medical Imaging course:
- Presentation Link: Google Slides
The pipeline automates the following neuroimaging steps:
- Data Acquisition: Automatically fetches the Stanford HARDI dataset for demonstration via
fetch_stanford_hardi(). - Tensor Reconstruction: Fits a
TensorModelto the diffusion data to calculate Fractional Anisotropy (FA) maps. - Cleaning & Seeding:
- Identifies organized white matter by masking FA > 0.4.
- Generates seeds from the mask with a density of
[1, 1, 1].
- Tractography:
- Uses Seed-based tracking via
LocalTracking. - Implements a
ThresholdStoppingCriterion(stopping at FA < 0.2). - Filters streamlines by length (min 40 nodes) to remove noise.
- Uses Seed-based tracking via
- Visualization:
- Renders a 3D scene with direction-colored stream tubes.
- Includes an interactive FA slicer with 50% opacity.
- Automatically saves a high-resolution snapshot as
Clinical_Tractography_Final.png.
Ensure you have a Python environment (3.8+) with the following dependencies:
pip install numpy nibabel dipy fury