mirror of
https://github.com/wassname/scikit-image.git
synced 2026-08-02 13:03:48 +08:00
Make area a cached property; use np.sum
This commit is contained in:
committed by
emmanuelle
parent
d8cc148d8c
commit
9317b7be34
@@ -106,8 +106,9 @@ class _RegionProperties(object):
|
||||
self._cache = {}
|
||||
self._ndim = label_image.ndim
|
||||
|
||||
@_cached_property
|
||||
def area(self):
|
||||
return self.image.sum()
|
||||
return np.sum(self.image)
|
||||
|
||||
def bbox(self):
|
||||
return tuple([self._slice[i].start for i in range(self._ndim)] +
|
||||
|
||||
Reference in New Issue
Block a user