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

Method test_keep_size

tests/transforms/test_zoom.py:83–101  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

81 assert_allclose(zoomed, p(expected), atol=1.0, type_test=False)
82
83 def test_keep_size(self):
84 for p in TEST_NDARRAYS_ALL:
85 zoom_fn = Zoom(zoom=[0.6, 0.6], keep_size=True, align_corners=True)
86 im = p(self.imt[0])
87 zoomed = zoom_fn(im, mode="bilinear")
88 assert_allclose(zoomed.shape, self.imt.shape[1:], type_test=False)
89 test_local_inversion(zoom_fn, zoomed, im)
90
91 zoom_fn = Zoom(zoom=[1.3, 1.3], keep_size=True)
92 im = p(self.imt[0])
93 zoomed = zoom_fn(im)
94 assert_allclose(zoomed.shape, self.imt.shape[1:], type_test=False)
95 test_local_inversion(zoom_fn, zoomed, p(self.imt[0]))
96
97 set_track_meta(False)
98 rotated = zoom_fn(im)
99 self.assertNotIsInstance(rotated, MetaTensor)
100 np.testing.assert_allclose(zoomed.shape, self.imt.shape[1:])
101 set_track_meta(True)
102
103 @parameterized.expand(INVALID_CASES)
104 def test_invalid_inputs(self, zoom, mode, raises):

Callers

nothing calls this directly

Calls 4

ZoomClass · 0.90
assert_allcloseFunction · 0.90
test_local_inversionFunction · 0.90
set_track_metaFunction · 0.90

Tested by

no test coverage detected