Skip to content

Commit d2d07d4

Browse files
committed
ENH: Pass ndim through to DataobjImage
1 parent c940dea commit d2d07d4

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

nibabel/dataobj_images.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,8 @@ def __init__(self, dataobj, header=None, extra=None, file_map=None):
2828
----------
2929
dataobj : object
3030
Object containg image data. It should be some object that retuns an
31-
array from ``np.asanyarray``. It should have a ``shape`` attribute
32-
or property
31+
array from ``np.asanyarray``. It should have ``shape`` and ``ndim``
32+
attributes or properties
3333
header : None or mapping or header instance, optional
3434
metadata for this image format
3535
extra : None or mapping, optional
@@ -392,6 +392,10 @@ def uncache(self):
392392
def shape(self):
393393
return self._dataobj.shape
394394

395+
@property
396+
def ndim(self):
397+
return self._dataobj.ndim
398+
395399
@deprecate_with_version('get_shape method is deprecated.\n'
396400
'Please use the ``img.shape`` property '
397401
'instead.',

0 commit comments

Comments
 (0)