Test behavior of isVector option
(shape, is_vector, expected_size, expected_type, expected_components)
| 96 | ((2, 3, 5), True, (3, 2), sitk.sitkVectorFloat32, 5), |
| 97 | ]) |
| 98 | def test_isVector(shape, is_vector, expected_size, expected_type, expected_components): |
| 99 | """Test behavior of isVector option""" |
| 100 | nda = np.arange(np.prod(shape), dtype=np.float32).reshape(shape) |
| 101 | img = sitk.GetImageFromArray(nda, isVector=is_vector) |
| 102 | |
| 103 | assert img.GetSize() == expected_size, f"Expected size {expected_size}, got {img.GetSize()}" |
| 104 | assert img.GetPixelID() == expected_type, f"Expected type {expected_type}, got {img.GetPixelID()}" |
| 105 | |
| 106 | if expected_components is not None: |
| 107 | assert img.GetNumberOfComponentsPerPixel() == expected_components, \ |
| 108 | f"Expected {expected_components} components, got {img.GetNumberOfComponentsPerPixel()}" |
| 109 | |
| 110 | |
| 111 | def test_complex_image_to_numpy(): |
nothing calls this directly
no test coverage detected