daducci / COMMIT

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

Change logic to write xic.txt file #81

Closed daducci closed 3 years ago

daducci commented 4 years ago

When processing a tractogram with COMMIT, which contains let’s say 100 streamlines, we expect 100 coefficients as output. However, as some streamlines can be “pre-filtered” by trk2dictionary (e.g. too short), fewer coefficients (let’s say 98) may actually be estimated. To cope with that, at the moment we create a tractogram that matches this “smaller” set of streamlines, using the parameter gen_trk in trk2dictionary. This way, the coefficients that are saved to xic.txt with save_results(save_coeff=True) match this smaller tractogram (i.e. 98 coefficients for 98 streamlines).

However, this approach is not optimal because this breaks the logic, as the user expects one coefficient for each input streamline, so 100 and not 98; also, the creation of this additional tractogram occupies twice the amount of disk space.

This PR modifies COMMIT to save to the file xic.txt one coefficient for each input streamline (i.e. 100); the coefficients corresponding to the "pre-filtered" streamlines are set to 0. This also means that the parameter gen_trk of trk2dictionary is not necessary anymore (so it's removed).

In the case of models where multiple contributions are estimated for each streamline, e.g. CylinderZeppelinBall, then xic will contain all such coefficients, i.e. multiple values for every streamline.

fullbat commented 4 years ago

Instead of a flag, it might be used a parameter in order to decide how to save different coefficients for the case of multi-compartment models. Something like: save_coeff=average or save_coeff=all

MarioOcampo commented 4 years ago

Do you think the condition if xec.size > 0 should be checked to create the compartment_EC.nii.gz? The current implementation creates empty files if there is no EC. (Same for iso compartment)

daducci commented 4 years ago

I don't mind having empty files, perhaps this way an analysis pipeline will not be broken, as a file always exist and the script should only check its length (same for the weights file)