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

[FIX] threshold images right before ploting in GLM reports #4258

Merged
merged 7 commits into from Feb 13, 2024

Conversation

Remi-Gau
Copy link
Collaborator

@Remi-Gau Remi-Gau commented Feb 2, 2024

Changes proposed in this pull request:

  • pass threshold to _stat_map_to_svg

Copy link
Contributor

github-actions bot commented Feb 2, 2024

👋 @Remi-Gau Thanks for creating a PR!

Until this PR is ready for review, you can include the [WIP] tag in its title, or leave it as a github draft.

Please make sure it is compliant with our contributing guidelines. In particular, be sure it checks the boxes listed below.

  • PR has an interpretable title.
  • PR links to Github issue with mention Closes #XXXX (see our documentation on PR structure)
  • Code is PEP8-compliant (see our documentation on coding style)
  • Changelog or what's new entry in doc/changes/latest.rst (see our documentation on PR structure)

For new features:

  • There is at least one unit test per new function / class (see our documentation on testing)
  • The new feature is demoed in at least one relevant example.

For bug fixes:

  • There is at least one test that would fail under the original bug conditions.

We will review it as quick as possible, feel free to ping us with questions if needed.

@Remi-Gau
Copy link
Collaborator Author

Remi-Gau commented Feb 2, 2024

before:

image

after:

image

Also adding all before / after reports from the code snippet from #4192

report.zip

@Remi-Gau
Copy link
Collaborator Author

Remi-Gau commented Feb 2, 2024

Copy link

codecov bot commented Feb 2, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (abb80ff) 91.85% compared to head (21dc748) 91.98%.
Report is 6 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #4258      +/-   ##
==========================================
+ Coverage   91.85%   91.98%   +0.12%     
==========================================
  Files         144      144              
  Lines       16419    16421       +2     
  Branches     3434     3435       +1     
==========================================
+ Hits        15082    15105      +23     
+ Misses        792      776      -16     
+ Partials      545      540       -5     
Flag Coverage Δ
macos-latest_3.10_test_plotting 91.85% <100.00%> (?)
macos-latest_3.11_test_plotting 91.85% <100.00%> (+<0.01%) ⬆️
macos-latest_3.12_test_plotting 91.85% <100.00%> (?)
macos-latest_3.8_test_plotting 91.81% <100.00%> (?)
macos-latest_3.9_test_plotting 91.82% <100.00%> (?)
ubuntu-latest_3.10_test_plotting 91.85% <100.00%> (+<0.01%) ⬆️
ubuntu-latest_3.11_test_plotting 91.85% <100.00%> (?)
ubuntu-latest_3.12_test_plotting 91.85% <100.00%> (?)
ubuntu-latest_3.12_test_pre 91.85% <100.00%> (?)
ubuntu-latest_3.8_test_plot_min 91.56% <100.00%> (?)
ubuntu-latest_3.8_test_plotting 91.81% <100.00%> (?)
ubuntu-latest_3.9_test_plotting 91.82% <100.00%> (?)
windows-latest_3.10_test_plotting 91.83% <100.00%> (?)
windows-latest_3.11_test_plotting 91.83% <100.00%> (?)
windows-latest_3.12_test_plotting 91.83% <100.00%> (?)
windows-latest_3.8_test_plotting 91.79% <100.00%> (?)
windows-latest_3.9_test_plotting 91.80% <100.00%> (?)

Flags with carried forward coverage won't be shown. Click here to find out more.

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

@bthirion
Copy link
Member

bthirion commented Feb 4, 2024

@bthirion

I feel we should have a "test" for this in the visual inspection suite of the GLM reporter.

https://github.com/nilearn/nilearn/blob/310f5ca659eb135b0c9489199b0c0cc9895780fa/nilearn/reporting/_visual_testing/_glm_reporter_visual_inspection_suite_.py

This means that we just need to look at the results from time to time ? Before releases ? Then we should add that to the dev doc.

@Remi-Gau
Copy link
Collaborator Author

Remi-Gau commented Feb 5, 2024

This means that we just need to look at the results from time to time ? Before releases ? Then we should add that to the dev doc.

That would be the "generate once in a while / manual check".

Other alternative "generate automatically / manual check": would be the actually show what the reports look like as part of our doc: see this comment in another thread #2194 (comment)

In any case this would be for another PR.

@Remi-Gau Remi-Gau marked this pull request as ready for review February 5, 2024 10:45
# and _stat_map_to_svg
# Necessary to avoid :
# https://github.com/nilearn/nilearn/issues/4192
_, threshold = threshold_stats_img(
Copy link
Member

Choose a reason for hiding this comment

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

Actually you cannot do that: you need to get the thresholdedimage because you want to take into account the cluster_threshold that is provided. In the implementation you propose, this gets forgotten.

@Remi-Gau
Copy link
Collaborator Author

report 1 after:

image

report 2 after:

image

report_after.zip

Comment on lines -227 to -228
mask_img=mask_img,
bg_img=bg_img,
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

unrelated but realized that the cut_coords was not passed to the mask plotting

Copy link
Member

@bthirion bthirion left a comment

Choose a reason for hiding this comment

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

Seems to do the job properly, thx.

@Remi-Gau
Copy link
Collaborator Author

Will update the changelog to log the bug fix

@Remi-Gau Remi-Gau merged commit 0beaaf8 into nilearn:main Feb 13, 2024
32 checks passed
@Remi-Gau Remi-Gau deleted the 4192 branch April 8, 2024 11:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[BUG] Glm reports does not apply image threshold at the right place
2 participants