(self, zoom, mode, align_corners=False, keep_size=False)
| 45 | class TestZoom(NumpyImageTestCase2D): |
| 46 | @parameterized.expand(VALID_CASES) |
| 47 | def test_pending_ops(self, zoom, mode, align_corners=False, keep_size=False): |
| 48 | im = MetaTensor(self.imt[0], meta={"a": "b", "affine": DEFAULT_TEST_AFFINE}) |
| 49 | zoom_fn = Zoom( |
| 50 | zoom=zoom, mode="bilinear", keep_size=keep_size, dtype=torch.float64, align_corners=align_corners |
| 51 | ) |
| 52 | # non-lazy |
| 53 | expected = zoom_fn(im) |
| 54 | self.assertIsInstance(expected, MetaTensor) |
| 55 | # lazy |
| 56 | zoom_fn.lazy = True |
| 57 | pending_result = zoom_fn(im) |
| 58 | self.assertIsInstance(pending_result, MetaTensor) |
| 59 | assert_allclose(pending_result.peek_pending_affine(), expected.affine) |
| 60 | assert_allclose(pending_result.peek_pending_shape(), expected.shape[1:]) |
| 61 | overrides = {"mode": "bilinear", "dtype": np.float64, "align_corners": align_corners} |
| 62 | result = apply_pending(pending_result, overrides=overrides)[0] |
| 63 | # compare |
| 64 | match_ratio = np.sum(np.isclose(result, expected)) / np.prod(result.shape) |
| 65 | self.assertGreater(match_ratio, 0.95) |
| 66 | |
| 67 | @parameterized.expand(VALID_CASES) |
| 68 | def test_correct_results(self, zoom, mode, *_): |
nothing calls this directly
no test coverage detected