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

Function gen_fixed_img

tests/transforms/test_label_to_contourd.py:119–142  ·  view source on GitHub ↗
(array_type)

Source from the content-addressed store, hash-verified

117
118
119def gen_fixed_img(array_type):
120 img = np.array(
121 [
122 [0, 0, 0, 1, 1, 1, 1],
123 [0, 0, 0, 1, 1, 1, 1],
124 [0, 0, 1, 1, 1, 1, 1],
125 [0, 1, 1, 1, 1, 1, 1],
126 [1, 1, 1, 1, 1, 1, 1],
127 ],
128 dtype=np.float32,
129 )
130 batch_size, channels = 10, 6
131 img = np.tile(img, (batch_size, channels, 1, 1))
132 img = array_type(img)
133 expected_output_for_img = array_type(
134 [
135 [0, 0, 0, 1, 1, 1, 1],
136 [0, 0, 0, 1, 0, 0, 1],
137 [0, 0, 1, 1, 0, 0, 1],
138 [0, 1, 1, 0, 0, 0, 1],
139 [1, 1, 1, 1, 1, 1, 1],
140 ]
141 )
142 return img, expected_output_for_img
143
144
145class TestContourd(unittest.TestCase):

Callers 1

test_contourMethod · 0.70

Calls 1

arrayMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…