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

[DOC] Add documentation page on denoising approaches #823

Merged
merged 42 commits into from
Nov 28, 2022

Conversation

tsalo
Copy link
Member

@tsalo tsalo commented Oct 22, 2021

Closes None, but stems from #819.

Changes proposed in this pull request:

To do:

  • Figure out where to put the new page/information in our documentation.
  • [ ] Add AFNI code to do the denoising.
  • Discuss when someone would want to use each approach and why.

@tsalo
Copy link
Member Author

tsalo commented Oct 22, 2021

@codecov
Copy link

codecov bot commented Oct 22, 2021

Codecov Report

Base: 93.30% // Head: 93.30% // No change to project coverage 👍

Coverage data is based on head (33ff086) compared to base (d85dac3).
Patch has no changes to coverable lines.

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #823   +/-   ##
=======================================
  Coverage   93.30%   93.30%           
=======================================
  Files          28       28           
  Lines        2345     2345           
=======================================
  Hits         2188     2188           
  Misses        157      157           

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report at Codecov.
📢 Do you have feedback about the report comment? Let us know in this issue.

@handwerkerd
Copy link
Member

I really like the idea of adding several example preprocessing pipelines and noise regression pipelines to the documentation. I think the question of how to connect this information to the documentation and what to include on this page are linked. In the current text, these examples are linked with an explanation of aggressive vs non-aggressive denoising. Would you consider calling this something like "Using tedana output with other programs"? Then the focus will be how to use the output (including for aggressive vs non-aggressive denoising). It would also then fit as a link off off "Outputs of tedana"

Other general comments:

  • You're saying tedana is doing non-aggressive denoising, but by your definition, I think it's aggressive. See:

    tedana/tedana/io.py

    Lines 378 to 379 in f1e98cb

    lowkts = utils.unmask(betas[:, rej].dot(mmix.T[rej, :]), mask)
    dnts = utils.unmask(data[mask] - lowkts[mask], mask)

    The rejected components are fit to the data without regard to the regressors of interest.
  • Looking at the python code sample I think you're trying to show how regress out things like motion in addition to the tedana rejected time series, but you don't clearly say that anywhere.
  • Perhaps this can be reorganized to show how to load the ICA mixing matrix and component table into python/AFNI/FSL and then regress out those data in isolation or in combination with other noise regressors. You'd still cover what you're calling aggressive vs non-aggressive, but focusing on that distinction is making the main use of these examples a bit more confusing.
  • Why are we including FSL if FSL currently is currently so multi-echo unfriendly? If someone knows how to load the time series and regress them out in FSL, I'm fine including that example, but I don't feel like re-learning enough of FSL to get that working, and I'm hesitant to present a use case that none of the current tedana developers are using/supporting.

@tsalo
Copy link
Member Author

tsalo commented Nov 15, 2021

In the current text, these examples are linked with an explanation of aggressive vs non-aggressive denoising. Would you consider calling this something like "Using tedana output with other programs"? Then the focus will be how to use the output (including for aggressive vs non-aggressive denoising). It would also then fit as a link off off "Outputs of tedana"

To be honest, part of my goal was to document the differences in a general sense, so that AROMA users (or whomever) could read our documentation and understand what their own outputs mean. I'm hoping to link to whatever page we add this to in the AROMA documentation, and potentially in other related packages as well. That said, as long as we have some kind of subsection that is more specifically about different denoising approaches, I'm comfortable changing the file.

The rejected components are fit to the data without regard to the regressors of interest.

True, but the parameter estimates come from all components in the mixing matrix:

betas = get_coeffs(dmdata.T, mmix, mask=None)

Wouldn't that make it non-aggressive denoising?

Perhaps this can be reorganized to show how to load the ICA mixing matrix and component table into python/AFNI/FSL and then regress out those data in isolation or in combination with other noise regressors.

Great point. I can do that with the Python portion at least.

Why are we including FSL if FSL currently is currently so multi-echo unfriendly?

I just wanted to try it out with more than two tabs, but am happy to remove it since no one in the group uses it.

@handwerkerd
Copy link
Member

Good point on the betas estimate. I think this makes me double-down on how aggressive vs non-aggressive can be confusing language. I'm also realizing we've sometimes used "aggressive"/"conservative" to describe variations in decision trees. We might need to be more precise (and unfortunately more wordy)
We can say that noise removal is regressing out:

  • Rejected time series without regard to accepted time series (your aggressive)
  • Rejected time series in a model that also fits accepted time series (your non-aggressive) (effectively splits the shared signals of accepted and rejected time series)
  • Only the parts of rejected time series that aren't in the accepted time series (your orthogonalization)
    Note: rejected time series could be just what is rejected by tedana or also include things like motion or respiratory regressors.

If you want three tabs, would there be any difference between fmriprep and python?

@tsalo
Copy link
Member Author

tsalo commented Nov 16, 2021

I think it's important that we incorporate external nuisance regressors and regressors of interest, but I'm not sure if that should go in the main part of each section or in separate parts. Maybe separate tabs? Like:

[ Python ] [ Python with external regressors ] [ AFNI ] [AFNI with external regressors ]

WDYT? Would having separate sections, like Nonaggressive denoising, followed by Nonaggressive denoising with external regressors be better?

If you want three tabs, would there be any difference between fmriprep and python?

There probably will be some differences in filenames once we merge in some of the changes we've been discussing with the fMRIPrep team, but I don't think the core operations (e.g., what type of file each element is stored in) will differ. That said, I think folks will start copying and pasting our example code into their own scripts, so it might be best to have examples for each of the major naming conventions, even when the core code remains the same.

@handwerkerd
Copy link
Member

I like your tabs because they explain a bit more clearly what each includes. I'd lean into your tab suggestions more and use more mathy terminology rather than "aggressive" "non-aggressive". That would mean something like "Remove all noise-correlated fluctuations" "Only remove noise-correlated fluctuations that aren't correlated with fluctuations in accepted components" (That's probably a bit too wordy)

@tsalo
Copy link
Member Author

tsalo commented Nov 18, 2021

@handwerkerd what difference, if any, is there between orthogonalizing the rejected components w.r.t. the accepted ones and including both rejected and accepted components in the initial regression (i.e., nonaggressive denoising)?

I'd lean into your tab suggestions more and use more mathy terminology rather than "aggressive" "non-aggressive". That would mean something like "Remove all noise-correlated fluctuations" "Only remove noise-correlated fluctuations that aren't correlated with fluctuations in accepted components" (That's probably a bit too wordy)

I've added the longer headings and we can iterate on the descriptions. The biggest things I want to focus on are when and why someone would choose each approach, but I don't know enough about each to say.

@eurunuela
Copy link
Collaborator

@handwerkerd what difference, if any, is there between orthogonalizing the rejected components w.r.t. the accepted ones and including both rejected and accepted components in the initial regression (i.e., nonaggressive denoising)?

Maybe @CesarCaballeroGaudes and @smoia want to comment on this.

@tsalo
Copy link
Member Author

tsalo commented Nov 18, 2021

I hesitated to tag Cesar because I remember him very patiently explaining it to me in DC and I've completely forgotten it all! 😆

@eurunuela
Copy link
Collaborator

I hesitated to tag Cesar because I remember him very patiently explaining it to me in DC and I've completely forgotten it all! 😆

I believe he wanted to contribute to this PR.

@handwerkerd
Copy link
Member

This isn't quite right but hopefully it helps explain.
Accepted components X includes fluctuations A, B, C
Rejected components Y includes fluctuations C, D, E
Aggressive denoising removes Y without regard to X, therefeore, C, D, & E are all removed.
If A-E are all fit in the model, then, when you remove the rejected comopnents, you removed 0.5*C, D, & E since C is split.
If you Y from X first, then you remove anything in Y that's common to X. In this case, only D & E are removed.

@CesarCaballeroGaudes
Copy link
Contributor

Hey, I'm listening 😄 (in fact I receive all TEDANA notifications). I was thinking for working on this PR or the AROMA during the forthcoming BHD

@CesarCaballeroGaudes
Copy link
Contributor

As @handwerkerd explains, the main difference between orthogonalizing and non-aggressive is that with orthogonalization, all the variance common across the accepted and rejected components is put in the accepted basket and therefore it is not removed in the nuisance regression. In contrast, with the non-agressive denoising, the shared variance is smartly split during the estimation process and therefore some amount is removed.

@tsalo tsalo added the documentation issues related to improving documentation for the project label Nov 22, 2022
docs/denoising.rst Outdated Show resolved Hide resolved
docs/denoising.rst Outdated Show resolved Hide resolved
docs/denoising.rst Outdated Show resolved Hide resolved
Copy link
Member

@handwerkerd handwerkerd left a comment

Choose a reason for hiding this comment

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

I few minor suggestions on typos or style, but otherwise LGTM.

@tsalo
Copy link
Member Author

tsalo commented Nov 27, 2022

I still wish our recommendations for which type of denoising to use were more explicit (e.g., in situation A, use denoising strategy 1), but I think this is pretty good now. I'd love everyone's input.

handwerkerd
handwerkerd previously approved these changes Nov 28, 2022
Copy link
Member

@handwerkerd handwerkerd left a comment

Choose a reason for hiding this comment

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

LGTM

@handwerkerd
Copy link
Member

I don't think we can make much more specific recommendations. So much of this has to do with study specific goals. That is, for the specific goals of a study, is it worse to remove something that shouldn't be removed or keep something that should be removed.

eurunuela
eurunuela previously approved these changes Nov 28, 2022
Copy link
Collaborator

@eurunuela eurunuela left a comment

Choose a reason for hiding this comment

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

LGTM!

Left a minor comment.

docs/denoising.rst Show resolved Hide resolved
@tsalo tsalo dismissed stale reviews from eurunuela and handwerkerd via 2e377a5 November 28, 2022 18:40
handwerkerd
handwerkerd previously approved these changes Nov 28, 2022
@tsalo
Copy link
Member Author

tsalo commented Nov 28, 2022

Sorry for the extra commit! I accidentally used a markdown-style link instead of rst. I'll merge once CI passes though, so no need to re-review.

@tsalo tsalo merged commit d01f670 into ME-ICA:main Nov 28, 2022
@tsalo tsalo deleted the document-denoising branch November 28, 2022 19:57
@tsalo tsalo mentioned this pull request Nov 28, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation issues related to improving documentation for the project
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Carpet plot image in documentation is missing
6 participants