MCPcopy Create free account
hub / github.com/MITK/MITK / test_image_geometry

Function test_image_geometry

Modules/Python/test/pytest/test_image_geometry.py:18–42  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

16
17
18def test_image_geometry():
19 image = mitk.Image()
20 image.initialize("float32", [10, 20, 30])
21
22 assert image.shape == (30, 20, 10)
23 assert image.ndim == 3
24 assert image.dtype == np.float32
25
26 assert image.spacing == (1.0, 1.0, 1.0)
27 image.spacing = (0.5, 0.7, 1.5)
28 assert image.spacing == (0.5, 0.7, 1.5)
29
30 image.origin = (10.0, 20.0, 30.0)
31 assert image.origin == (10.0, 20.0, 30.0)
32
33 np.testing.assert_allclose(image.direction, np.eye(3))
34 flipped = np.diag([-1.0, -1.0, 1.0])
35 image.direction = flipped
36 np.testing.assert_allclose(image.direction, flipped)
37 assert image.spacing == (0.5, 0.7, 1.5)
38
39 assert image.time_steps == 1
40 assert image.time_geometry is not None
41 assert image.time_geometry.count_time_steps() == 1
42 assert image.get_geometry(time_step=0) is not None

Callers

nothing calls this directly

Calls 2

ImageMethod · 0.45
initializeMethod · 0.45

Tested by

no test coverage detected