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: Coerce MGHImages to Nifti1Images when plotting #769

Merged
merged 4 commits into from
Jan 13, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions niworkflows/viz/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -341,11 +341,17 @@ def plot_registration(
if cuts is None:
raise NotImplementedError # TODO

# nilearn 0.10.0 uses Nifti-specific methods
anat_nii = nb.Nifti1Image.from_image(anat_nii)

out_files = []
if estimate_brightness:
plot_params = robust_set_limits(anat_nii.get_fdata().reshape(-1), plot_params)

# FreeSurfer ribbon.mgz
if contour:
contour = nb.Nifti1Image.from_image(anat_nii)

ribbon = contour is not None and np.array_equal(
np.unique(contour.get_fdata()), [0, 2, 3, 41, 42]
)
Expand Down