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/ENH] Improve generate_report method to work with fit_transform for the maskers #3897
Conversation
👋 @ymzayek 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.
For new features:
For bug fixes:
We will review it as quick as possible, feel free to ping us with questions if needed. |
Now data = masker.fit_transform(img)
report = masker.generate_report() works the same as: masker.fit(img)
report = masker.generate_report() I changed the colormap but maybe there are suggestions for something better?? To fully reproduce:from nilearn.maskers import NiftiLabelsMasker
from nilearn import datasets
atlas = datasets.fetch_atlas_harvard_oxford("cort-maxprob-thr25-2mm")
atlas_filename, labels = atlas.maps, atlas.labels
dataset = datasets.fetch_development_fmri(n_subjects=1)
fmri_filename = dataset.func[0]
#%%
masker = NiftiLabelsMasker(labels_img=atlas_filename, standardize=True)
masker.fit(fmri_filename)
#%%
masker = NiftiLabelsMasker(labels_img=atlas_filename, standardize=True)
masker.fit_transform(fmri_filename) |
Codecov Report
@@ Coverage Diff @@
## main #3897 +/- ##
=======================================
Coverage 91.76% 91.77%
=======================================
Files 134 134
Lines 15747 15750 +3
Branches 3283 3283
=======================================
+ Hits 14451 14454 +3
Misses 752 752
Partials 544 544
Flags with carried forward coverage won't be shown. Click here to find out more.
📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
Storing one time point for the report seems a bit more involved than I thought given the failures here: https://github.com/nilearn/nilearn/actions/runs/5787425257 so I will handle it in a separate follow-up PR |
4540b37
to
b986a0c
Compare
The red background is not great for the atlas display. I'll try to get a neutral one. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM otherwise
I changed it back to the default colormap but now allowing the user to pass a custom colormap as a **kwarg that is passed to For reference, the default colormap looks like this in my example (same as in the example gallery) But I guess it is suboptimal for the example shown in the issue #3709 |
b986a0c
to
7f6e11c
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thx.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good with me!
Changes proposed in this pull request: