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

Method test_inverse_metatensor

tests/integration/test_one_of.py:220–232  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

218 self.assertTupleEqual(result["img"].shape, (1, 101, 102, 103))
219
220 def test_inverse_metatensor(self):
221 transform = Compose(
222 [
223 Resize(spatial_size=[100, 100, 100]),
224 OneOf([RandScaleIntensity(factors=0.5, prob=1.0), RandShiftIntensity(offsets=0.5, prob=1.0)]),
225 OneOf([RandScaleIntensity(factors=0.5, prob=1.0), RandShiftIntensity(offsets=0.5, prob=1.0)]),
226 ]
227 )
228 transform.set_random_state(seed=0)
229 result = transform(np.ones((1, 101, 102, 103)))
230 self.assertTupleEqual(result.shape, (1, 100, 100, 100))
231 result = transform.inverse(result)
232 self.assertTupleEqual(result.shape, (1, 101, 102, 103))
233
234 def test_one_of(self):
235 p = OneOf((A(), B(), C()), (1, 2, 1))

Callers

nothing calls this directly

Calls 7

set_random_stateMethod · 0.95
inverseMethod · 0.95
ComposeClass · 0.90
ResizeClass · 0.90
OneOfClass · 0.90
RandScaleIntensityClass · 0.90
RandShiftIntensityClass · 0.90

Tested by

no test coverage detected