MCPcopy Create free account
hub / github.com/Project-MONAI/MONAI / test_blend

Method test_blend

tests/visualize/utils/test_blend_images.py:48–59  ·  view source on GitHub ↗
(self, image, label, alpha)

Source from the content-addressed store, hash-verified

46class TestBlendImages(unittest.TestCase):
47 @parameterized.expand(TESTS)
48 def test_blend(self, image, label, alpha):
49 blended = blend_images(image, label, alpha)
50 self.assertEqual(type(image), type(blended))
51 if isinstance(blended, torch.Tensor):
52 self.assertEqual(blended.device, image.device)
53 blended = blended.cpu().numpy()
54 self.assertEqual((3,) + image[0].shape, blended.shape)
55
56 blended = moveaxis(blended, 0, -1) # move RGB component to end
57 if blended.ndim > 3:
58 blended = blended[blended.shape[0] // 2]
59 plt.imshow(blended)
60
61
62if __name__ == "__main__":

Callers

nothing calls this directly

Calls 2

blend_imagesFunction · 0.90
moveaxisFunction · 0.90

Tested by

no test coverage detected