예제 #1
0
 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))
예제 #2
0
 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))
예제 #3
0
 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))
예제 #4
0
 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))
예제 #5
0
 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))
예제 #6
0
 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))
예제 #7
0
 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)
예제 #8
0
 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)
예제 #9
0
 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)