diff --git a/model_server/base/accessors.py b/model_server/base/accessors.py index f7d076fa7653faf7fbf22d8a2ff7577228ab2420..6ccd74b7833092473b444bf66aaca9593f75fe2e 100644 --- a/model_server/base/accessors.py +++ b/model_server/base/accessors.py @@ -88,7 +88,7 @@ class GenericImageDataAccessor(ABC): def _gc(self, channels): return self.get_channels(list(channels)) - def _unique(self): + def unique(self): return np.unique(self.data, return_counts=True) @property diff --git a/tests/test_ilastik/test_ilastik.py b/tests/test_ilastik/test_ilastik.py index b6a6f851f6cb674e29b904470a28b0b4100f3966..9e2bbd3d42a4a0fdbf65b553852aa4b26cb94e91 100644 --- a/tests/test_ilastik/test_ilastik.py +++ b/tests/test_ilastik/test_ilastik.py @@ -382,7 +382,7 @@ class TestIlastikOnMultichannelInputs(conf.TestServerBaseClass): acc_input = generate_file_accessor(self.pa_input_image) acc_obmap = res['ob_map'] self.assertEqual(acc_obmap.hw, acc_input.hw) - self.assertEqual(len(acc_obmap._unique()[1]), 3) + self.assertEqual(len(acc_obmap.unique()[1]), 3) def test_api(self): diff --git a/tests/test_ilastik/test_roiset_workflow.py b/tests/test_ilastik/test_roiset_workflow.py index 19c7d9f78aa97f22ac46c79f76c380a762b93ecf..4d8d4ec3885402eb1ba1e3ab48124ac72693774b 100644 --- a/tests/test_ilastik/test_roiset_workflow.py +++ b/tests/test_ilastik/test_roiset_workflow.py @@ -119,9 +119,9 @@ class TestRoiSetWorkflow(BaseTestRoiSetMonoProducts, unittest.TestCase): trace.write_interm(Path(output_path) / 'trace', 'roiset_worfklow_trace', skip_first=False, skip_last=False) self.assertTrue('ob_id' in trace.keys()) - self.assertEqual(len(trace['labeled']._unique()[0]), 14) + self.assertEqual(len(trace['labeled'].unique()[0]), 14) self.assertEqual(rois.count, 13) - self.assertEqual(len(trace['ob_id']._unique()[0]), 2) + self.assertEqual(len(trace['ob_id'].unique()[0]), 2) class TestRoiSetWorkflowOverApi(conf.TestServerBaseClass, BaseTestRoiSetMonoProducts): @@ -183,8 +183,8 @@ class TestRoiSetWorkflowOverApi(conf.TestServerBaseClass, BaseTestRoiSetMonoProd def test_workflow_with_object_classifier(self): acc = self._object_map_workflow(self.test_load_object_classifier()) - self.assertTrue(np.all(acc._unique()[0] == [0, 1, 2])) + self.assertTrue(np.all(acc.unique()[0] == [0, 1, 2])) def test_workflow_without_object_classifier(self): acc = self._object_map_workflow(None) - self.assertTrue(np.all(acc._unique()[0] == [0, 1])) + self.assertTrue(np.all(acc.unique()[0] == [0, 1]))