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] fix positions markers on images on sphere masker reports #4285

Merged
merged 5 commits into from
Feb 26, 2024
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions doc/changes/latest.rst
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ Fixes

- :bdg-dark:`Code` Fix errant warning when using ``stat_type`` in :func:`nilearn.glm.compute_contrast` (:gh:`4257` by `Eric Larson`_).
- :bdg-dark:`Code` Fix when thresholding is applied to images by GLM reports (:gh:`4258` by `Rémi Gau`_).
- :bdg-dark:`Code` Fix positions of the markers on the images on the sphere masker reports (:gh:`4285` by `Rémi Gau`_).
- :bdg-dark:`Code` Make sure that :class:`nilearn.maskers.NiftiSpheresMasker` reports displays properly when it contains only 1 sphere (:gh:`4269` by `Rémi Gau`_).

Enhancements
Expand Down
16 changes: 8 additions & 8 deletions examples/03_connectivity/plot_sphere_based_connectome.py
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

adding some semantic line breaks in the problematic examples reported in the issue to trigger its build in CI to check the problem is solved.

Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
and the Dosenbach-160 atlas (:footcite:t:`Dosenbach2010`).

We estimate connectomes using two different methods: **sparse inverse
covariance** and **partial_correlation**, to recover the functional brain
**networks structure**.
covariance** and **partial_correlation**,
to recover the functional brain **networks structure**.

We'll start by extracting signals from Default Mode Network regions and
computing a connectome from them.
Expand Down Expand Up @@ -83,9 +83,9 @@
# %%
# Display spheres summary report
# ------------------------------
# By default all spheres are displayed. This can be tweaked by passing an
# integer or list/array of indices to the ``displayed_spheres`` argument of
# ``generate_report``.
# By default all spheres are displayed.
# This can be tweaked by passing an integer or list/array of indices
# to the ``displayed_spheres`` argument of ``generate_report``.
report = masker.generate_report()
report

Expand All @@ -106,9 +106,9 @@
# %%
# Compute partial correlation matrix
# -----------------------------------
# Using object :class:`nilearn.connectome.ConnectivityMeasure`: Its
# default covariance estimator is Ledoit-Wolf, allowing to obtain accurate
# partial correlations.
# Using object :class:`nilearn.connectome.ConnectivityMeasure`:
# its default covariance estimator is Ledoit-Wolf,
# allowing to obtain accurate partial correlations.

from nilearn.connectome import ConnectivityMeasure

Expand Down
4 changes: 2 additions & 2 deletions nilearn/maskers/nifti_spheres_masker.py
Original file line number Diff line number Diff line change
Expand Up @@ -507,10 +507,10 @@ def _reporting(self):
regions_summary["relative size (in %)"].append("not implemented")
if idx in spheres_to_be_displayed:
display = plotting.plot_img(
img, cut_coords=positions[idx], cmap="gray"
img, cut_coords=seeds[idx], cmap="gray"
)
display.add_markers(
marker_coords=[positions[idx]],
marker_coords=[seeds[idx]],
marker_color="g",
marker_size=20 * radius,
)
Expand Down