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

Method test_default

tests/transforms/test_rand_rotate90d.py:26–48  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

24
25class TestRandRotate90d(NumpyImageTestCase2D):
26 def test_default(self):
27 key = "test"
28 rotate = RandRotate90d(keys=key)
29 for p in TEST_NDARRAYS_ALL:
30 rotate.set_random_state(1323)
31 im = {key: p(self.imt[0])}
32 call_param = {"data": im}
33 rotated = rotate(**call_param)
34
35 # test lazy
36 test_resampler_lazy(rotate, rotated, call_param=call_param, seed=1323, output_key=key)
37 rotate.lazy = False
38
39 test_local_inversion(rotate, rotated, im, key)
40 expected = [np.rot90(channel, 0, (0, 1)) for channel in self.imt[0]]
41 expected = np.stack(expected)
42 assert_allclose(rotated[key], p(expected), type_test="tensor")
43
44 set_track_meta(False)
45 rotated = rotate(im)[key]
46 self.assertNotIsInstance(rotated, MetaTensor)
47 self.assertIsInstance(rotated, torch.Tensor)
48 set_track_meta(True)
49
50 def test_k(self):
51 key = "test"

Callers

nothing calls this directly

Calls 7

RandRotate90dClass · 0.90
test_resampler_lazyFunction · 0.90
test_local_inversionFunction · 0.90
assert_allcloseFunction · 0.90
set_track_metaFunction · 0.90
rotateFunction · 0.85
set_random_stateMethod · 0.45

Tested by

no test coverage detected