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

Method crop_test_value

tests/croppers.py:69–79  ·  view source on GitHub ↗
(self, input_param, input_arr, expected_array)

Source from the content-addressed store, hash-verified

67 self.assertEqual(inv_im.applied_operations, [])
68
69 def crop_test_value(self, input_param, input_arr, expected_array):
70 cropper = self.Cropper(**input_param)
71 is_map = isinstance(cropper, MapTransform)
72 for im_type in TEST_NDARRAYS_ALL:
73 with self.subTest(im_type=im_type):
74 im = im_type(input_arr)
75 input_data = {"img": im} if is_map else im
76 result = self.Cropper(**input_param)(input_data)
77 out_im = result["img"] if is_map else result
78 self.assertIsInstance(out_im, MetaTensor)
79 assert_allclose(out_im, expected_array, type_test=False)
80
81 def multi_inverse(self, input_shape, init_params):
82 input_data = np.arange(np.prod(input_shape)).reshape(*input_shape) + 1

Callers 4

test_valueMethod · 0.80
test_valueMethod · 0.80
test_valueMethod · 0.80
test_valueMethod · 0.80

Calls 1

assert_allcloseFunction · 0.90

Tested by 4

test_valueMethod · 0.64
test_valueMethod · 0.64
test_valueMethod · 0.64
test_valueMethod · 0.64