Image
- class mitk_workbench_remote.image.Image(data, *, spacing=None, origin=None, direction=None, properties=None)
Bases:
objectSpatial image wrapper backed by a numpy array with spacing, origin, and direction.
Accepts any type handled by the converter registry (ndarray, SimpleITK.Image, mlarray.MLArray, file path). Pixel data conversion is lazy – the array is only materialized on first access to
array.- Parameters:
data (
Any) – Pixel data or an object convertible via the converter registry.spacing (
Sequence[float] |ndarray|None(default:None)) – Voxel spacing. Overrides converter-extracted values. Defaults to(1.0, ...)per dimension.origin (
Sequence[float] |ndarray|None(default:None)) – World-space origin. Overrides converter-extracted values. Defaults to(0.0, ...).direction (
Sequence[Any] |ndarray|None(default:None)) – Direction cosine matrix. Overrides converter-extracted values. Defaults to the identity matrix.properties (
dict[str,Any] |None(default:None)) – Data-scope properties dict. IfNoneand a converter is used, properties are extracted from the source object.
- property ndim: int
Number of spatial dimensions.
For vector or multichannel images,
ndimis the number of spatial axes (e.g. 3 for a 3-D volume), whileshapemay have an additional channel axis.ndimequalslen(spacing)and always matches the geometry, not the array rank.
- get_property(key)
Get a property by key.
- set_property(key, value)
Set a property by key.
- remove_property(key)
Remove a property by key.
- to_simpleitk()
Convert to a SimpleITK Image.
- Raises:
ImportError – If SimpleITK is not installed.
- Return type:
- to_mlarray()
Convert to an mlarray.MLArray.
- Raises:
ImportError – If mlarray is not installed.
- Return type:
- to_mitk()
Convert to a
mitk.Image(native MITK Python binding).Requires the
mitkpackage. Geometry and pixel data are copied into the native image; properties are not transferred by this call (useDataNode.get_data()withinclude_properties=TrueorDataNode.set_data()withinclude_properties=Truefor metadata round-tripping).- Raises:
ImportError – If
mitkis not installed.- Return type: