(self, _, spatial_axis)
| 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 | |
| 59 | if __name__ == "__main__": |
nothing calls this directly
no test coverage detected