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

Add T2* and S0 figures #1040

Merged
merged 24 commits into from
Feb 29, 2024
Merged

Add T2* and S0 figures #1040

merged 24 commits into from
Feb 29, 2024

Conversation

tsalo
Copy link
Member

@tsalo tsalo commented Feb 20, 2024

Closes #689.

Changes proposed in this pull request:

  • Add seaborn as a dependency.
  • Add new figures to static_figures and HTML report.
    • Mosaic-format brain plots created with nilearn.plotting.plot_stat_map.
    • Histograms created with seaborn.histplot.

@tsalo tsalo added reports issues related to boilerplate generation or visual reports enhancement issues describing possible enhancements to the project labels Feb 20, 2024
@tsalo
Copy link
Member Author

tsalo commented Feb 20, 2024

The brain images are massive in the HTML report for some reason. @eurunuela do you have any idea what might be causing that?

Copy link

codecov bot commented Feb 20, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 89.66%. Comparing base (d0298f2) to head (ee044e6).
Report is 42 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1040      +/-   ##
==========================================
+ Coverage   89.55%   89.66%   +0.11%     
==========================================
  Files          26       26              
  Lines        3466     3503      +37     
  Branches      634      634              
==========================================
+ Hits         3104     3141      +37     
  Misses        210      210              
  Partials      152      152              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@eurunuela
Copy link
Collaborator

The brain images are massive in the HTML report for some reason. @eurunuela do you have any idea what might be causing that?

Yes. So it looks like you haven't used any CSS to limit the size of the image. It is currently taking 100% of the width of its parent div, which happens to be 100% of the page.

I can work on improving the overall layout of the report in the coming weeks.

@eurunuela
Copy link
Collaborator

Ah, I see you made some edits to the CSS @tsalo, awesome!

Let me know if you want me to work on improving this.

@tsalo
Copy link
Member Author

tsalo commented Feb 21, 2024

I'm happy to just get something readable working in this PR, but I'd love to improve the report overall in a future one.

One thing that would be amazing is if we could have all of the figures be rendered with the same width. Maybe even based on the window size, if that's feasible?

@eurunuela
Copy link
Collaborator

One thing that would be amazing is if we could have all of the figures be rendered with the same width. Maybe even based on the window size, if that's feasible?

Yes, that's feasible and shouldn't be difficult to build.

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.

Thank you for doing this. These are nice additions. In addition to my suggested change below, the colorbars for maps are really narrow and unreadable. I can't figure out how to make them wider.

Also, once the figures are finalized, the "ICA Components Report" section of outputs.rst in the docs should be updated to mention/explain the new figures.

tedana/reporting/static_figures.py Outdated Show resolved Hide resolved
@handwerkerd
Copy link
Member

One other Q is the addition of seaborn. It's a widely used library, but it's one more dependency. It makes the histograms slightly nicer, but I don't know if it's necessary. If you eventually plan to use seaborn to make everything look a bit nicer, that's one thing, but, for this PR, I don't think it's essential. (Not going to protest if you really want to keep the seaborn visualizations)

@tsalo
Copy link
Member Author

tsalo commented Feb 22, 2024

It makes the histograms slightly nicer, but I don't know if it's necessary.

That's a good point. I've dropped seaborn.

@tsalo
Copy link
Member Author

tsalo commented Feb 22, 2024

I've opened an issue about the colorbar (nilearn/nilearn#4283), so I think we can address that particular problem in a future PR.

@handwerkerd
Copy link
Member

This looks good. The one last thing to do before merging is to add some images and explanatory text to the "ICA Components Report" section of outputs.rst in the docs.

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 have one annoying suggestion. We have a parameter to select the colormap and we default to a red/blue map for the ICA components with positive and negative values. The T2* and S0 maps are all positive and I find are much more interpretable in grayscale. I'd suggest hard-coding them as gray scale rather than using the inputted colormap. If you disagree, I won't argue.

Also, the other text descriptions give a hint at what people should be looking for. You could add something like "The T2* map should look similar to T2 maps and be brightest in the ventricles. The S0 map should roughly follow the signal-to-noise ratio and will be brightest near the surface near receiver coils."
The T2* histogram should have more values or a second bump to the left of the peak, but I'm not sure what to highlight to users as a warning sign of a problem.

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.

One minor suggestion for the documentation text and my other suggestion to make the T2* and S0 maps always grayscale. I'm flexible on both, if you have other preferences.

docs/outputs.rst Show resolved Hide resolved
tsalo and others added 2 commits February 27, 2024 07:58
Co-authored-by: Dan Handwerker <7406227+handwerkerd@users.noreply.github.com>
@tsalo
Copy link
Member Author

tsalo commented Feb 27, 2024

@handwerkerd what do you think of the updated version?

image

If you like it, I'll update the image in the docs.

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.

Sorry for prolonging this. In addition to suggested changes below, t2s_and_s0_plots.png should use a grayscale image. Also, I'm fine with that image just including the t2s example, but, given the file name, did you intend for it to also include s0 examples?

tedana/reporting/static_figures.py Outdated Show resolved Hide resolved
Co-authored-by: Dan Handwerker <7406227+handwerkerd@users.noreply.github.com>
tsalo and others added 2 commits February 27, 2024 13:18
Co-authored-by: Dan Handwerker <7406227+handwerkerd@users.noreply.github.com>
@handwerkerd
Copy link
Member

Thanks for humoring my requests. I think the maps look good now so just update t2s_and_s0_plots.png and this should be ready.

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
Sorry again for creating so much back-and-forth on this one.

@tsalo
Copy link
Member Author

tsalo commented Feb 27, 2024

No worries. I'm glad it looks good to you.

Copy link
Collaborator

@dowdlelt dowdlelt left a comment

Choose a reason for hiding this comment

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

I'm happy with this - the nice visual is a useful addition and a good sanity check. Nice work ya'll - I had completely missed that this was being put together.

@tsalo tsalo merged commit 8d7e5ff into ME-ICA:main Feb 29, 2024
16 checks passed
@tsalo tsalo deleted the report-t2star branch February 29, 2024 16:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement issues describing possible enhancements to the project reports issues related to boilerplate generation or visual reports
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add T2*/S0 maps to HTML reports
4 participants