mirror of
https://github.com/wassname/scikit-image.git
synced 2026-07-21 12:50:27 +08:00
added nan case
This commit is contained in:
@@ -329,9 +329,20 @@ class _RegionProperties(MutableMapping):
|
||||
return getattr(self, PROPS[key])
|
||||
|
||||
def __eq__(self, other):
|
||||
if not isinstance(other,_RegionProperties):
|
||||
return False
|
||||
|
||||
attr1 = np.array([getattr(self, k, None)for k in PROP_VALS])
|
||||
attr2 = np.array([getattr(other, k, None)for k in PROP_VALS])
|
||||
return np.all(attr1 == attr2)
|
||||
|
||||
for x,y in zip(attr1, attr2):
|
||||
try:
|
||||
#so that NaNs are equal
|
||||
np.testing.assert_equal(x,y)
|
||||
except AssertionError :
|
||||
return False
|
||||
|
||||
return True
|
||||
|
||||
|
||||
def regionprops(label_image, properties=None,
|
||||
|
||||
Reference in New Issue
Block a user