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

Method test_longest_shape

tests/transforms/test_resized.py:114–128  ·  view source on GitHub ↗
(self, input_param, expected_shape)

Source from the content-addressed store, hash-verified

112
113 @parameterized.expand([TEST_CASE_0, TEST_CASE_1, TEST_CASE_2, TEST_CASE_3])
114 def test_longest_shape(self, input_param, expected_shape):
115 input_data = {
116 "img": np.random.randint(0, 2, size=[3, 4, 7, 10]),
117 "label": np.random.randint(0, 2, size=[3, 4, 7, 10]),
118 }
119 input_param["size_mode"] = "longest"
120 rescaler = Resized(**input_param)
121 result = rescaler(input_data)
122 for k in rescaler.keys:
123 np.testing.assert_allclose(result[k].shape[1:], expected_shape)
124 set_track_meta(False)
125 result = Resized(**input_param)(input_data)
126 self.assertNotIsInstance(result["img"], MetaTensor)
127 np.testing.assert_allclose(result["img"].shape[1:], expected_shape)
128 set_track_meta(True)
129
130 def test_identical_spatial(self):
131 test_input = {"X": np.ones((1, 10, 16, 17))}

Callers

nothing calls this directly

Calls 2

ResizedClass · 0.90
set_track_metaFunction · 0.90

Tested by

no test coverage detected