daducci / COMMIT

Linear framework to combine tractography and tissue micro-structure estimation with diffusion MRI
Other
43 stars 33 forks source link

Final Output from COMMIT2 Not Aligned #116

Closed RaviBot closed 1 year ago

RaviBot commented 1 year ago

Hello,

First of all thank you for this amazing pipeline! I am having an issue with the output when I run the COMMIT2 pipeline on my data. I am attaching two photos. The first is the dictionary that is created. As you can see the white matter boundaries are well aligned together. But when I look at the RMSE output, this is not the case. Can you please help me troubleshoot this problem?

Thanks in advance!

Ravi

Screen Shot 2022-10-18 at 8 36 08 AM Screen Shot 2022-10-18 at 8 36 40 AM
daducci commented 1 year ago

Dear @RaviBot ,

That sounds indeed a bit strange. Did you notice the same when looking at other maps?

Ale

RaviBot commented 1 year ago

Yes all of the maps that come out of the pipeline are like this except the dictionary images (TDI and mask).

daducci commented 1 year ago

Would it be possible to share privately this data (DWI, scheme file, masks, tractogram etc) for us to check if some exception is not properly handled?

RaviBot commented 1 year ago

Sure of course. Can you please tell me where I should send or upload?

daducci commented 1 year ago

You can send me the link at my email address: alessandro[DOT]daducci[AT]univr[DOT]it

RaviBot commented 1 year ago

I just sent an email with a link to download all the files. If you need anything else, please let me know!

daducci commented 1 year ago

Dear @RaviBot ,

Thanks for sharing the data. I tested it and the problem is that your WM mask (wm_coreg_resampled_fsl_bin_0_1.nii.gz) doesn't have the same geometry as the DWI file (dwi_unbiased.nii.gz). I solved this issue with the following command:

mrtransform -force \
    -template dwi_unbiased.nii.gz -interp nearest -strides -1,2,3 \
    wm_coreg_resampled_fsl_bin_0_1.nii wm_coreg_resampled_fsl_bin_0_1_REGRID.nii.gz

Here are the resulting maps when fitting with the "corrected" WM mask: my_results

And here is the snippet of code I used:

#!/usr/bin/env python3

# Fix the orientation/grid of the WM mask
import os
os.system( 'mrtransform -force \
    -template dwi_unbiased.nii.gz -interp nearest -strides -1,2,3 \
    wm_coreg_resampled_fsl_bin_0_1.nii wm_coreg_resampled_fsl_bin_0_1_REGRID.nii.gz'
)

# Import the tractogram using the new WM mask
from commit import trk2dictionary
trk2dictionary.run(
    filename_tractogram='./trekker_wholebrain_connecting.tck',
    TCK_ref_image='./wm_coreg_resampled_fsl_bin_0_1_REGRID.nii.gz',
    ndirs=500
)

# Fit with COMMIT
import commit
mit = commit.Evaluation()
mit.load_data('./dwi_unbiased.nii.gz', './DWI.scheme', b0_min_signal=1e-4 )

mit.set_model('StickZeppelinBall')
mit.model.set( 1.7E-3, [], [ 1.7E-3, 3.0E-3 ] )
mit.generate_kernels(ndirs=500, regenerate=True)
mit.load_kernels()

mit.load_dictionary('COMMIT')

mit.set_threads()
mit.build_operator()

mit.fit(tol_fun=1e-3, max_iter=500)
mit.save_results()

Let me know if this solves your issue.

RaviBot commented 1 year ago

Hi @daducci

Thank you so much, this fixed the issue! It is aligned now. I just have one follow-up question. When choosing lamba for COMMIT2, what is the best way/statistic to look at following COMMIT2 to empirically validate your data?

Thanks! Ravi

daducci commented 1 year ago

No worries, we're glad to help!

About your question, we haven't deeply studied that, but as any optimization problem with a free parameter, there's no "magic method" to find out the optimal regularization strength, but it depends on your application. In our lab, we usually search for a lambda value which allows us to obtain a network density of about 0.30-0.35, and when doing that we visually inspect our data to check that the streamlines that are kept explain the DWI signal equally well (i.e. no holes, similar RMSE etc). And then we us this lambda for all subjects in the study. But this is "our approach", I wouldn't say this is the best approach.. :-P But it is a very interesting question, and definitely worth investigating!