Skip to content

Commit 43a82f8

Browse files
authored
Merge pull request #769 from nipreps/fix/nii-plotting
FIX: Coerce `MGHImage`s to `Nifti1Image`s when plotting
2 parents 174c541 + 5bf26e5 commit 43a82f8

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

niworkflows/viz/utils.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -341,11 +341,17 @@ def plot_registration(
341341
if cuts is None:
342342
raise NotImplementedError # TODO
343343

344+
# nilearn 0.10.0 uses Nifti-specific methods
345+
anat_nii = nb.Nifti1Image.from_image(anat_nii)
346+
344347
out_files = []
345348
if estimate_brightness:
346349
plot_params = robust_set_limits(anat_nii.get_fdata().reshape(-1), plot_params)
347350

348351
# FreeSurfer ribbon.mgz
352+
if contour:
353+
contour = nb.Nifti1Image.from_image(anat_nii)
354+
349355
ribbon = contour is not None and np.array_equal(
350356
np.unique(contour.get_fdata()), [0, 2, 3, 41, 42]
351357
)

0 commit comments

Comments
 (0)