Skip to content

Commit

Permalink
Merge pull request #769 from nipreps/fix/nii-plotting
Browse files Browse the repository at this point in the history
FIX: Coerce `MGHImage`s to `Nifti1Image`s when plotting
  • Loading branch information
effigies authored Jan 13, 2023
2 parents 174c541 + 5bf26e5 commit 43a82f8
Showing 1 changed file with 6 additions and 0 deletions.
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

0 comments on commit 43a82f8

Please sign in to comment.