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

Method test_register

tests/transforms/test_load_imaged.py:62–73  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

60 self.assertTupleEqual(result[key].shape, expected_shape)
61
62 def test_register(self):
63 spatial_size = (32, 64, 128)
64 test_image = np.random.rand(*spatial_size)
65 with tempfile.TemporaryDirectory() as tempdir:
66 filename = os.path.join(tempdir, "test_image.nii.gz")
67 itk_np_view = itk.image_view_from_array(test_image)
68 itk.imwrite(itk_np_view, filename)
69
70 loader = LoadImaged(keys="img", image_only=True)
71 loader.register(ITKReader())
72 result = loader({"img": Path(filename)})
73 self.assertTupleEqual(result["img"].shape, spatial_size[::-1])
74
75 def test_channel_dim(self):
76 spatial_size = (32, 64, 3, 128)

Callers

nothing calls this directly

Calls 3

registerMethod · 0.95
LoadImagedClass · 0.90
ITKReaderClass · 0.90

Tested by

no test coverage detected