def test_map_classes_isomorphic(self): '''map_classes should map isomorphic class image back to original.''' gt = np.array(self.gt) gt2 = gt + 1 d = map_class_ids(gt2, gt) result = map_classes(gt2, d) assert(np.alltrue(result == gt))
def test_map_classes_isomorphic(self): '''map_classes should map isomorphic class image back to original.''' from spectral.algorithms.spatial import map_class_ids, map_classes gt = np.array(self.gt) gt2 = gt + 1 d = map_class_ids(gt2, gt) result = map_classes(gt2, d) assert (np.alltrue(result == gt))
def test_map_classes_isomorphic(self): '''map_classes should map isomorphic class image back to original.''' from spectral.algorithms.spatial import map_class_ids, map_classes gt = np.array(self.gt) gt2 = gt + 1 d = map_class_ids(gt2, gt) result = map_classes(gt2, d) assert(np.alltrue(result == gt))
def test_map_allow_unmapped_true(self): '''map_classes should raise ValueError if image has unmapped value.''' gt = np.array(self.gt) gt2 = gt + 1 d = map_class_ids(gt2, gt) d.pop(1) result = map_classes(gt2, d, allow_unmapped=True) assert(np.alltrue(result[gt2 == 1] == 1))
def test_map_allow_unmapped_true(self): '''map_classes should raise ValueError if image has unmapped value.''' from spectral.algorithms.spatial import map_class_ids, map_classes from warnings import warn gt = np.array(self.gt) gt2 = gt + 1 d = map_class_ids(gt2, gt) d.pop(1) result = map_classes(gt2, d, allow_unmapped=True) assert (np.alltrue(result[gt2 == 1] == 1))
def test_map_allow_unmapped_true(self): '''map_classes should raise ValueError if image has unmapped value.''' from spectral.algorithms.spatial import map_class_ids, map_classes from warnings import warn gt = np.array(self.gt) gt2 = gt + 1 d = map_class_ids(gt2, gt) d.pop(1) result = map_classes(gt2, d, allow_unmapped=True) assert(np.alltrue(result[gt2 == 1] == 1))
def test_map_fails_allow_unmapped_false(self): '''map_classes should raise ValueError if image has unmapped value.''' gt = np.array(self.gt) gt2 = gt + 1 d = map_class_ids(gt2, gt) d.pop(1) try: result = map_classes(gt2, d) except ValueError: pass else: assert(False)
def test_map_fails_allow_unmapped_false(self): '''map_classes should raise ValueError if image has unmapped value.''' from spectral.algorithms.spatial import map_class_ids, map_classes from warnings import warn gt = np.array(self.gt) gt2 = gt + 1 d = map_class_ids(gt2, gt) d.pop(1) try: result = map_classes(gt2, d) except ValueError: pass else: assert (False)
def test_map_fails_allow_unmapped_false(self): '''map_classes should raise ValueError if image has unmapped value.''' from spectral.algorithms.spatial import map_class_ids, map_classes from warnings import warn gt = np.array(self.gt) gt2 = gt + 1 d = map_class_ids(gt2, gt) d.pop(1) try: result = map_classes(gt2, d) except ValueError: pass else: assert(False)