MCPcopy Index your code
hub / github.com/Project-MONAI/MONAI / test_channel_dim

Method test_channel_dim

tests/data/test_numpy_reader.py:138–147  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

136 assert_allclose(c, test_data, type_test=False)
137
138 def test_channel_dim(self):
139 test_data = np.random.randint(0, 256, size=[3, 4, 5, 2])
140 with tempfile.TemporaryDirectory() as tempdir:
141 filepath = os.path.join(tempdir, "test_data.npy")
142 np.save(filepath, test_data)
143
144 reader = NumpyReader(channel_dim=-1)
145 result = reader.get_data(reader.read(filepath))
146 np.testing.assert_allclose(result[1]["spatial_shape"], test_data.shape[:-1])
147 self.assertEqual(result[1]["original_channel_dim"], -1)
148
149
150if __name__ == "__main__":

Callers

nothing calls this directly

Calls 4

get_dataMethod · 0.95
readMethod · 0.95
NumpyReaderClass · 0.90
saveMethod · 0.80

Tested by

no test coverage detected