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

Method test_register

tests/transforms/test_load_image.py:401–412  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

399 np.testing.assert_allclose(result.T, test_image)
400
401 def test_register(self):
402 spatial_size = (32, 64, 128)
403 test_image = np.random.rand(*spatial_size)
404 with tempfile.TemporaryDirectory() as tempdir:
405 filename = os.path.join(tempdir, "test_image.nii.gz")
406 itk_np_view = itk.image_view_from_array(test_image)
407 itk.imwrite(itk_np_view, filename)
408
409 loader = LoadImage(image_only=True)
410 loader.register(ITKReader())
411 result = loader(filename)
412 self.assertTupleEqual(result.shape, spatial_size[::-1])
413
414 def test_kwargs(self):
415 spatial_size = (32, 64, 128)

Callers

nothing calls this directly

Calls 3

registerMethod · 0.95
LoadImageClass · 0.90
ITKReaderClass · 0.85

Tested by

no test coverage detected