Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NF: rumba reconst #2423

Merged
merged 106 commits into from Feb 17, 2022
Merged

NF: rumba reconst #2423

merged 106 commits into from Feb 17, 2022

Conversation

kenjimarshall
Copy link
Contributor

@kenjimarshall kenjimarshall commented Jul 22, 2021

Robust and Unbiased Model-BAsed Spherical Deconvolution (RUMBA-SD)

  • RumbaSD and RumbaFit classes for local reconstruction
  • Standalone global_fit method for whole brain fitting with built-in spatial regularization option
  • Examples for both local reconstruction (single- and multi-shell) and fiber tracking with RUMBA-SD
  • Model compartments for white matter, grey matter, and cerebrospinal fluid

Developed in collaboration with @gabknight and @ejcanalesr. RUMBA-SD is the algorithm that won the MICCAI IronTract 2019 challenge, the 3D VoTEM ISBI 2018 challenge (sub-challenge #2), and the co-winner of the ISBI HARDI 2013 challenge.

Reference:

Canales-Rodríguez, E. J., Daducci, A., Sotiropoulos, S. N., Caruyer, E., Aja-Fernández, S., Radua, J., Mendizabal, J. M. Y., Iturria-Medina, Y., Melie-García, L., Alemán-Gómez, Y., Thiran, J.-P., Sarró, S., Pomarol-Clotet, E., & Salvador, R. (2015). Spherical Deconvolution of Multichannel Diffusion MRI Data with Non-Gaussian Noise Models and Spatial Regularization. PLOS ONE, 10(10), e0138910. https://doi.org/10.1371/journal.pone.0138910

kenjimarshall and others added 30 commits June 30, 2021 10:44
Decompose into rotation and scaling components also in case the affine is a 3x3 matrix
Co-authored-by: Ariel Rokem <arokem@gmail.com>
@kenjimarshall
Copy link
Contributor Author

Yes that works! I'll see you then.

@kenjimarshall
Copy link
Contributor Author

Hi @arokem the changes we discussed yesterday have all been pushed!

The only difference from our conversation is that I ended up having to define _voxelwise_fit and _global_fit within the RumbaSD rather than outside, so I'm doing the unpleasant self.fit = self._voxelwise_fit assignment. This is because, if defined outside, then model needs to be passed explicitly whenever fit is called. This breaks the typical fit signature. Let me know if this is okay, or if there's a solution to this that I didn't think of.

Thank you!

Copy link
Contributor

@arokem arokem left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good! I had a couple of suggestions here and there.

I also think that we should change the name of the "RumbaSD" class to "RumbaSDModel" to be consistent with the other models.

dipy/reconst/tests/test_rumba.py Outdated Show resolved Hide resolved
doc/examples/reconst_rumba.py Outdated Show resolved Hide resolved
doc/examples/reconst_rumba.py Outdated Show resolved Hide resolved
doc/examples/reconst_rumba_multishell.py Outdated Show resolved Hide resolved
doc/examples/reconst_rumba_multishell.py Outdated Show resolved Hide resolved
doc/examples/reconst_rumba_multishell.py Outdated Show resolved Hide resolved
@kenjimarshall
Copy link
Contributor Author

kenjimarshall commented Oct 21, 2021

Hi @arokem I pushed these suggestions. I'm not sure why all the Linux checks were cancelled... Should I try making another commit to re-run the tests?

@skoudoro
Copy link
Member

Hi @kenjimarshall,

They failed because ubuntu 1604 is deprecated. We need to update our azure-pipeline files. See #2413

@skoudoro skoudoro mentioned this pull request Oct 29, 2021
23 tasks
@arokem
Copy link
Contributor

arokem commented Feb 10, 2022

Following up here, after our discussion this morning. I think that it was suggested that it would be OK to merge this code into master, but there was some question about how to discuss the multi-shell implementation in the example. One easy way to deal with the questions around multi-shell would be to remove that example. I think that maybe @gabknight was suggesting that as a possibility. I'd alright with that. What do others think?

@ejcanalesr
Copy link

ejcanalesr commented Feb 11, 2022 via email

@arokem
Copy link
Contributor

arokem commented Feb 11, 2022

Hi @kenjimarshall : are you still available to work on this? Could you make this change? I think after removing the multi-shell example, we'd be ready to merge this.

@kenjimarshall
Copy link
Contributor Author

kenjimarshall commented Feb 11, 2022

Hi @arokem and everyone. Yes no problem! I'll delete it now.

To clarify, we're keeping the multi-shell functionality on the model but just deleting the example?

@arokem
Copy link
Contributor

arokem commented Feb 11, 2022

Thanks for being so quick! I think that this is ready for the merge. I will wait until EOB Monday, to give people time to raise any objections, before I go ahead with it.

@Garyfallidis
Copy link
Contributor

Hi @kenjimarshall and all. This PR needs rebasing.

Copy link
Contributor

@Garyfallidis Garyfallidis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The PR needs a careful rebasing and a few more comments need addressing too. Overall, a great work in the making :) This is super close to be merged.

dipy/reconst/rumba.py Outdated Show resolved Hide resolved
dipy/reconst/rumba.py Outdated Show resolved Hide resolved
matter (WM) fiber populations in a given orientation as well as effects
from GM and CSF. The equation governing these contributions is:

$ S_i = S_0\left(\sum_{j=1}^{M}f_j\exp(-b_i\bold{v}_i^T\bold{D}_j
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@kenjimarshall have you tried to render the documentation? If yes, do the math render correctly?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for pointing this out -- there were some rendering issues that I believe I've now fixed.

bvecs = btable[:, 1:]
gtab = gradient_table(bvals, bvecs)

rumba = RumbaSDModel(gtab, n_iter=600, sphere=sphere)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this model okay to use with DSI type of data?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes I believe so, but maybe @ejcanalesr can confirm?

data_pred = rumba_fit.predict()

# Assert reconstructed signal value within 0.01 of original
assert_allclose(data, data_pred, atol=0.01, rtol=1.0)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tolerance seem low. Any reasons?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just increased the precision on this test a bit further. It's now close to the threshold for RUMBA's predict performance.

doc/examples/reconst_rumba.py Show resolved Hide resolved
@Garyfallidis
Copy link
Contributor

@arokem have you checked that the documentation of this PR renders correctly?

@Garyfallidis
Copy link
Contributor

Thank you for the great work @kenjimarshall and team. I am merging this now.

@Garyfallidis Garyfallidis merged commit d15715b into dipy:master Feb 17, 2022
@Garyfallidis
Copy link
Contributor

🎉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet