Exemple #1
0
 def test_IOI_IMAGE_predictionhandling(self):
     interface = Image_interface(pattern="image")
     sample = MIScnn_sample.Sample("pred.image", self.img[:, :, 0], 1, 2)
     sample.add_prediction(self.seg[:, :, 0])
     interface.save_prediction(sample, self.tmp_data.name)
     pred = interface.load_prediction("pred.image", self.tmp_data.name)
     self.assertTrue(np.array_equal(pred, self.seg[:, :, 0]))
Exemple #2
0
 def test_IOI_IMAGE_loading(self):
     interface = Image_interface(pattern="image")
     sample_list = interface.initialize(self.tmp_data.name)
     img = interface.load_image(sample_list[0])
     seg = interface.load_segmentation(sample_list[0])
     self.assertTrue(np.array_equal(img[0], self.img[:,:,0]))
     self.assertTrue(np.array_equal(seg, self.seg[:,:,0]))
Exemple #3
0
 def test_IOI_IMAGE_predictionhandling(self):
     interface = Image_interface(pattern="image")
     sample_list = interface.initialize(self.tmp_data.name)
     interface.save_prediction(self.seg[:, :, 0], "pred.image",
                               self.tmp_data.name)
     pred = interface.load_prediction("pred.image", self.tmp_data.name)
     self.assertTrue(np.array_equal(pred, self.seg[:, :, 0]))
Exemple #4
0
 def test_IOI_IMAGE_loading(self):
     interface = Image_interface(pattern="image_\\d+")
     sample_list = sorted(interface.initialize(self.tmp_data.name))
     img_01 = interface.load_image(sample_list[0])
     seg_01 = interface.load_segmentation(sample_list[0])
     self.assertTrue(np.array_equal(img_01[0], self.img[:, :, 0]))
     self.assertTrue(np.array_equal(seg_01, self.seg[:, :, 0]))
     img_02 = interface.load_image(sample_list[1])
     seg_02 = interface.load_segmentation(sample_list[1])
     true_img_02 = np.array(
         Image.fromarray(self.img[:, :, :3]).convert('LA'))
     self.assertTrue(np.array_equal(img_02[0], true_img_02[:, :, 0]))
     self.assertTrue(np.array_equal(seg_02, self.seg[:, :, 0]))
Exemple #5
0
 def test_IOI_IMAGE_initialize(self):
     interface = Image_interface(pattern="image")
     sample_list = interface.initialize(self.tmp_data.name)
     self.assertEqual(len(sample_list), 1)
     self.assertEqual(sample_list[0], "image")
Exemple #6
0
 def test_IOI_IMAGE_creation(self):
     interface = Image_interface()
Exemple #7
0
 def test_IOI_IMAGE_initialize(self):
     interface = Image_interface(pattern="image_\\d+")
     sample_list = interface.initialize(self.tmp_data.name)
     self.assertEqual(len(sample_list), 2)
     self.assertTrue("image_01" in sample_list)
     self.assertTrue("image_02" in sample_list)