Skip to content

NF: volume computation function for nifti masks #952

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

Merged
merged 9 commits into from
Oct 20, 2020
Prev Previous commit
Next Next commit
Fix failing docstring
  • Loading branch information
JulianKlug committed Oct 19, 2020
commit 93532dedbb547597bbc29444bd67e5068b5a9752
3 changes: 2 additions & 1 deletion nibabel/imagestats.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,11 @@ def mask_volume(img):

Examples
--------
>>> import numpy as np
>>> import nibabel as nb
>>> mask_data = np.zeros((20, 20, 20), dtype='u1')
>>> mask_data[5:15, 5:15, 5:15] = 1
>>> nb.imagestats.mask_volume(nb.Nifti1Image(mask_data, np.eye(4))
>>> nb.imagestats.mask_volume(nb.Nifti1Image(mask_data, np.eye(4)))
1000.0
"""
if not spatial_axes_first(img):
Expand Down