def test_get_nlabels_multiple(self): slab = {"liver": 1, "porta": 2} val = imsl.get_nlabels(slab, [2, "porta", "new", 7], return_mode="str") self.assertEqual(val[0], "porta") self.assertEqual(val[1], "porta") self.assertEqual(val[2], "3") self.assertEqual(val[3], "7")
def test_get_nlabels(self): datap = io3d.datasets.generate_abdominal() data3d = datap["data3d"] segmentation = datap["segmentation"] newlab = imsl.get_nlabels(datap["slab"], "new", return_mode="str") self.assertEqual(type(newlab), str)
def test_get_nlabels_single_both(self): slab = {"liver": 1, "porta": 2} val = imsl.get_nlabels(slab, "porta", return_mode="both") self.assertEqual(val[0], 2) self.assertEqual(val[1], "porta")
def test_get_nlabels_single(self): slab = {"liver": 1, "porta": 2} val = imsl.get_nlabels(slab, "porta", return_mode="int") self.assertEqual(val, 2)
def test_get_nlabels_single_label(self): slab = {"liver": 1, "kindey": 15, "none": 0} labels = 1 val = imsl.get_nlabels(slab, labels) self.assertEqual(val, 1)