Get a NumPy ndarray from a SimpleITK Image. This is a deep copy of the image buffer and is completely safe and without potential side effects.
(image: Image)
| 269 | |
| 270 | |
| 271 | def GetArrayFromImage(image: Image) -> "numpy.ndarray": |
| 272 | """Get a NumPy ndarray from a SimpleITK Image. |
| 273 | |
| 274 | This is a deep copy of the image buffer and is completely safe and without potential side effects. |
| 275 | """ |
| 276 | |
| 277 | if not HAVE_NUMPY: |
| 278 | raise ImportError("NumPy not available.") |
| 279 | |
| 280 | # perform deep copy of the image buffer |
| 281 | return numpy.array(image, copy=True) |
| 282 | |
| 283 | |
| 284 | def GetImageFromArray(arr: "numpy.ndarray", isVector: Optional[bool] = None) -> Image: |
nothing calls this directly
no outgoing calls
no test coverage detected