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

Method test_npz2

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

Source from the content-addressed store, hash-verified

49 np.testing.assert_allclose(result[0], test_data1)
50
51 def test_npz2(self):
52 test_data1 = np.random.randint(0, 256, size=[3, 4, 4])
53 test_data2 = np.random.randint(0, 256, size=[3, 4, 4])
54 with tempfile.TemporaryDirectory() as tempdir:
55 filepath = os.path.join(tempdir, "test_data.npz")
56 np.savez(filepath, test_data1, test_data2)
57
58 reader = NumpyReader()
59 result = reader.get_data(reader.read(filepath))
60 np.testing.assert_allclose(result[1]["spatial_shape"], test_data1.shape)
61 np.testing.assert_allclose(result[0].shape, (2, 3, 4, 4))
62 np.testing.assert_allclose(result[0], np.stack([test_data1, test_data2]))
63
64 def test_npz3(self):
65 test_data1 = np.random.randint(0, 256, size=[3, 4, 4])

Callers

nothing calls this directly

Calls 3

get_dataMethod · 0.95
readMethod · 0.95
NumpyReaderClass · 0.90

Tested by

no test coverage detected