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

Method test_keep_size

tests/transforms/test_zoomd.py:73–82  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

71 assert_allclose(zoomed[key], p(expected), atol=1.0, type_test=False)
72
73 def test_keep_size(self):
74 key = "img"
75 zoom_fn = Zoomd(key, zoom=0.6, keep_size=True, padding_mode="constant", constant_values=2)
76 for p in TEST_NDARRAYS_ALL:
77 zoomed = zoom_fn({key: p(self.imt[0])})
78 np.testing.assert_array_equal(zoomed[key].shape, self.imt.shape[1:])
79
80 zoom_fn = Zoomd(key, zoom=1.3, keep_size=True)
81 zoomed = zoom_fn({key: self.imt[0]})
82 self.assertTrue(np.array_equal(zoomed[key].shape, self.imt.shape[1:]))
83
84 @parameterized.expand(INVALID_CASES)
85 def test_invalid_inputs(self, _, zoom, mode, raises):

Callers

nothing calls this directly

Calls 1

ZoomdClass · 0.90

Tested by

no test coverage detected