コード例 #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
ファイル: spatial.py プロジェクト: spectralpython/spectral
 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
ファイル: spatial.py プロジェクト: spectralpython/spectral
 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
ファイル: spatial.py プロジェクト: spectralpython/spectral
 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)