Skip to content

Bundle myelin fraction (BMF) mapping with MySD

Simona edited this page Apr 8, 2022 · 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 in

Initialize COMMIT and import the data

import commit
# commit.setup() # NB: this is required only the first time you run COMMIT
from commit import trk2dictionary
trk2dictionary.run(
     filename_tractogram = 'tractogram.tck',
     filename_mask  = 'WM_mask.nii.gz',
     fiber_shift    = 0.5,
     ndirs = 1
)

# Setting parameters
mit = commit.Evaluation()
mit.set_config('doNormalizeSignal', False)
    
mit.load_data( 'myelin_map.nii.gz' )

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

# Set model and generate the kernel
mit.set_model( 'VolumeFractions' )
mit.model.set()
mit.generate_kernels( ndirs=1, regenerate=True )
mit.load_kernels()

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

mit.set_threads()
mit.build_operator()

# fitting
mit.fit( tol_fun=1e-3, max_iter=1000, verbose=True )
mit.save_results()

Once the fitting has reached convergence, you find the estimated myelin contribution of each streamline in the file streamline_weights.txt inside COMMIT/Results_VolumeFraction/.

Now you can group streamlines and their weights according to your bundles definition.