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

Method test_lambda_slicing

tests/transforms/utility/test_lambda.py:36–49  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

34 assert_allclose(identity_func(img), lambd(img), type_test=False)
35
36 def test_lambda_slicing(self):
37 for p in TEST_NDARRAYS:
38 img = p(self.imt)
39
40 def slice_func(x):
41 return x[:, :, :6, ::2]
42
43 lambd = Lambda(func=slice_func)
44 out = lambd(img)
45 assert_allclose(slice_func(img), out, type_test=False)
46 self.assertIsInstance(out, MetaTensor)
47 self.assertEqual(len(out.applied_operations), 1)
48 out = lambd.inverse(out)
49 self.assertEqual(len(out.applied_operations), 0)
50
51 def test_lambda_track_meta_false(self):
52 for p in TEST_NDARRAYS:

Callers

nothing calls this directly

Calls 3

inverseMethod · 0.95
LambdaClass · 0.90
assert_allcloseFunction · 0.90

Tested by

no test coverage detected