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

Method test_correct_results

tests/transforms/test_rand_flip.py:38–56  ·  view source on GitHub ↗
(self, _, spatial_axis)

Source from the content-addressed store, hash-verified

36
37 @parameterized.expand(VALID_CASES)
38 def test_correct_results(self, _, spatial_axis):
39 for p in TEST_NDARRAYS_ALL:
40 im = p(self.imt[0])
41 init_param = {"prob": 1.0, "spatial_axis": spatial_axis}
42 flip = RandFlip(**init_param)
43 set_track_meta(False)
44 result = flip(im)
45 self.assertNotIsInstance(result, MetaTensor)
46 self.assertIsInstance(result, torch.Tensor)
47 set_track_meta(True)
48 expected = [np.flip(channel, spatial_axis) for channel in self.imt[0]]
49 expected = np.stack(expected)
50 call_param = {"img": im}
51 result = flip(**call_param)
52 assert_allclose(result, p(expected), type_test="tensor")
53 test_local_inversion(flip, result, im)
54
55 # test lazy
56 test_resampler_lazy(flip, result, init_param, call_param)
57
58
59if __name__ == "__main__":

Callers

nothing calls this directly

Calls 6

RandFlipClass · 0.90
set_track_metaFunction · 0.90
assert_allcloseFunction · 0.90
test_local_inversionFunction · 0.90
test_resampler_lazyFunction · 0.90
flipFunction · 0.85

Tested by

no test coverage detected