Skip to content

Bundle myelin fraction (BMF) mapping with MySD

Alessandro Daducci edited this page Jun 25, 2024 · 5 revisions

Assuming you have a tractogram called tractogram.tck, a co-registered myelin volume fraction map myelin_map.nii.gz and a white-matter mask WM_mask.nii.gz in the same directory, with the following code you can perform Myelin Streamline Decomposition (MySD) to reproduce results as in Schiavi et al., 2022.

Initialize COMMIT and import the data

import commit
commit.setup() # NB: this is required only the first time you run COMMIT

# Load the tractogram
from commit import trk2dictionary
trk2dictionary.run(
     filename_tractogram = 'tractogram.tck',
     filename_mask  = 'WM_mask.nii.gz',
     fiber_shift    = 0.5,
     ndirs = 1
)

# Set parameters
mit = commit.Evaluation()
mit.set_config('doNormalizeSignal', False)

# Load the myelin data
mit.load_data( 'myelin_map.nii.gz' )

Now the data are loaded and you are ready to perform MySD:

# Set model and generate the response functions
mit.set_model( 'VolumeFractions' )
mit.generate_kernels( regenerate=True )
mit.load_kernels()

# Load dictionary and buid the operator
mit.load_dictionary( 'COMMIT' )
mit.set_threads()
mit.build_operator()

# Fit model to the data
mit.fit( tol_fun=1e-3, max_iter=1000 )
mit.save_results()

Once the fitting has reached convergence, you find the estimated myelin contributions of each streamline in the file COMMIT/Results_VolumeFraction/streamline_weights.txt, which is a text file with one row for each streamline; you can use this information in your usual analysis pipeline to evaluate e.g. the myelination of different bundles or the myelin-weighted connectivity.