(self, input_param, expected_shape)
| 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))} |
nothing calls this directly
no test coverage detected