imfusion#
imfusion - ImFusion SDK for Medical Imaging#
This module provides Python bindings for the C++ ImFusion libraries.
- exception imfusion.FileNotFoundError#
Bases:
FileNotFoundError
- exception imfusion.IncompatibleError#
Bases:
ValueError
- exception imfusion.MissingLicenseError#
Bases:
RuntimeError
- class imfusion.Algorithm#
Bases:
ConfigurableRe-exported from
imfusion.algorithm.Algorithm.
- class imfusion.BoundImageDescriptor#
Bases:
pybind11_objectImmutable version of
ImageDescriptorbound to an image.Struct describing the essential properties of an image.
The ImFusion framework distinguishes two main image pixel value domains, which are indicated by the shift and scale parameters of this image descriptor:
Original pixel value domain: Pixel values are the same as in their original source (e.g. when loaded from a file). Same as the storage pixel value domain if the image’s scale is 1 and the shift is 0
Storage pixel value domain: Pixel values as they are stored in a MemImage. The user may decide to apply such a rescaling in order to better use the available limits of the underlying type.
The following conversion rules apply:
OV = (SV / scale) - shift
SV = (OV + shift) * scale
- clone(self: BoundImageDescriptor) ImageDescriptor#
Return a mutable copy as
ImageDescriptor.
- coord(self: BoundImageDescriptor, index: SupportsInt | SupportsIndex) Annotated[numpy.typing.NDArray[numpy.int32], '[4, 1]']#
Return the pixel/voxel coordinate (x,y,z,c) for a given index
- has_index(self: BoundImageDescriptor, x: SupportsInt | SupportsIndex, y: SupportsInt | SupportsIndex, z: SupportsInt | SupportsIndex = 0, c: SupportsInt | SupportsIndex = 0) bool#
Return true if the pixel at (x,y,z) exists, false otherwise
- image_to_pixel(self: BoundImageDescriptor, world: Annotated[numpy.typing.ArrayLike, numpy.float64, '[3, 1]']) Annotated[numpy.typing.NDArray[numpy.float64], '[3, 1]']#
Convert 3D image coordinates to pixel/voxel position
- index(self: BoundImageDescriptor, x: SupportsInt | SupportsIndex, y: SupportsInt | SupportsIndex, z: SupportsInt | SupportsIndex = 0, c: SupportsInt | SupportsIndex = 0) int#
Return a linear memory index for a pixel or voxel
- is_compatible(self: BoundImageDescriptor, other: ImageDescriptor, ignore_type: bool = False, ignore_3D: bool = False, ignore_channels: bool = False, ignore_spacing: bool = True) bool#
Convenience function to perform partial comparison of two image descriptors. Two descriptors are compatible if their width and height, and optionally number of slices, number of channels and type are the same
- is_valid(self: BoundImageDescriptor) bool#
Return if the descriptor is valid (a size of one is allowed)
- original_to_storage(self: BoundImageDescriptor, value: SupportsFloat | SupportsIndex) float#
Apply the image’s shift and scale in order to convert a value from original pixel value domain to storage pixel value domain
- pixel_to_image(self: BoundImageDescriptor, pixel: Annotated[numpy.typing.ArrayLike, numpy.float64, '[3, 1]']) Annotated[numpy.typing.NDArray[numpy.float64], '[3, 1]']#
Convert a 3D pixel/voxel position to image coordinates
- storage_to_original(self: BoundImageDescriptor, value: SupportsFloat | SupportsIndex) float#
Apply the image’s shift and scale in order to convert a value from storage pixel value domain to original pixel value domain
- property configuration#
Serialize an image descriptor to Properties
- Type:
- property image_to_pixel_matrix#
Return a 4x4 matrix to transform from image space to pixel space
- Type:
Annotated[numpy.typing.NDArray[numpy.float64], ”[4, 4]”]
- property image_to_texture_matrix#
Return a 4x4 matrix to transform from image space to texture space
- Type:
Annotated[numpy.typing.NDArray[numpy.float64], ”[4, 4]”]
- property pixel_to_image_matrix#
Return a 4x4 matrix to transform from pixel space to image space
- Type:
Annotated[numpy.typing.NDArray[numpy.float64], ”[4, 4]”]
- property spacing#
Physical extent of each voxel in [mm] stored as a namedtuple. Spacing for a specific dimension can be accessed via
x,y, andzattributes.- Returns:
Named tuple with
x,y, andzattributes.- Return type:
(collections.namedtuple)
- Type:
- property texture_to_image_matrix#
Return a 4x4 matrix to transform from texture space to image space
- Type:
Annotated[numpy.typing.NDArray[numpy.float64], ”[4, 4]”]
- property type_size#
Return the nominal size in bytes of the current component type, zero if unknown
- Type:
- class imfusion.BoundImageDescriptorWorld#
Bases:
pybind11_objectImmutable version of
ImageDescriptorWorldbound to an image.Convenience struct extending an ImageDescriptor to also include a matrix describing the image orientation in world coordinates.
This struct can be useful for describing the geometrical properties of an image without need to hold the (heavy) image content. As such it can be used for representing reference geometries for image resampling, or for one-line creation of a new SharedImage.
- clone(self: BoundImageDescriptorWorld) ImageDescriptorWorld#
Return a mutable copy as
ImageDescriptorWorld.
- image_to_pixel(self: BoundImageDescriptorWorld, world: Annotated[numpy.typing.ArrayLike, numpy.float64, '[3, 1]']) Annotated[numpy.typing.NDArray[numpy.float64], '[3, 1]']#
Convert 3D image coordinates to pixel/voxel position
- is_spatially_compatible(self: BoundImageDescriptorWorld, other: ImageDescriptorWorld) bool#
Convenience function to compare two image world descriptors (for instance to know whether a resampling is necessary). Two descriptors are compatible if their dimensions, matrix and spacing are identical.
- pixel_to_image(self: BoundImageDescriptorWorld, pixel: Annotated[numpy.typing.ArrayLike, numpy.float64, '[3, 1]']) Annotated[numpy.typing.NDArray[numpy.float64], '[3, 1]']#
Convert a 3D pixel/voxel position to image coordinates
- pixel_to_world(self: BoundImageDescriptorWorld, pixel: Annotated[numpy.typing.ArrayLike, numpy.float64, '[3, 1]']) Annotated[numpy.typing.NDArray[numpy.float64], '[3, 1]']#
Convert a 3D pixel/voxel position to world coordinates
- world_to_pixel(self: BoundImageDescriptorWorld, world: Annotated[numpy.typing.ArrayLike, numpy.float64, '[3, 1]']) Annotated[numpy.typing.NDArray[numpy.float64], '[3, 1]']#
Convert 3D world coordinates to pixel/voxel position
- property descriptor#
- Type:
- property image_to_pixel_matrix#
Return a 4x4 matrix to transform from image space to pixel space
- Type:
Annotated[numpy.typing.NDArray[numpy.float64], ”[4, 4]”]
- property image_to_texture_matrix#
Return a 4x4 matrix to transform from image space to texture space
- Type:
Annotated[numpy.typing.NDArray[numpy.float64], ”[4, 4]”]
- property matrix_from_world#
Return the matrix transforming world coordinates to image coordinates
- Type:
Annotated[numpy.typing.NDArray[numpy.float64], ”[4, 4]”]
- property matrix_to_world#
Return the matrix transforming image coordinates to world coordinates
- Type:
Annotated[numpy.typing.NDArray[numpy.float64], ”[4, 4]”]
- property pixel_to_image_matrix#
Return a 4x4 matrix to transform from pixel space to image space
- Type:
Annotated[numpy.typing.NDArray[numpy.float64], ”[4, 4]”]
- property pixel_to_world_matrix#
Return a 4x4 matrix to transform from pixel space to world space
- Type:
Annotated[numpy.typing.NDArray[numpy.float64], ”[4, 4]”]
- property texture_to_image_matrix#
Return a 4x4 matrix to transform from texture space to image space
- Type:
Annotated[numpy.typing.NDArray[numpy.float64], ”[4, 4]”]
- property texture_to_world_matrix#
Return a 4x4 matrix to transform from texture space to world space
- Type:
Annotated[numpy.typing.NDArray[numpy.float64], ”[4, 4]”]
- class imfusion.Configurable#
Bases:
pybind11_object- configuration(self: Configurable) Properties#
- configure(self: Configurable, properties: Properties) None#
- configure_defaults(self: Configurable) None#
- class imfusion.CroppingMask(self: CroppingMask, dimensions: Annotated[numpy.typing.ArrayLike, numpy.int32, '[3, 1]'])#
Bases:
MaskSimple axis-aligned cropping mask with optional roundness.
- class RoundDims(value, names=<not given>, *values, module=None, qualname=None, type=None, start=1, boundary=None)#
Bases:
Enum- XY = 0#
- XYZ = 3#
- XZ = 2#
- YZ = 1#
- XY = 0#
- XYZ = 3#
- XZ = 2#
- YZ = 1#
- property border#
Number of pixels cropped away
- class imfusion.Data#
Bases:
pybind11_objectRe-exported from
imfusion.data.Data.
- class imfusion.DataGroup#
Bases:
DataRe-exported from
imfusion.data.DataGroup.
- class imfusion.Deformation#
Bases:
pybind11_object- configuration(self: Deformation) Properties#
- configure(self: Deformation, properties: Properties) None#
- displace_point(self: Deformation, at: Annotated[numpy.typing.ArrayLike, numpy.float64, '[3, 1]']) Annotated[numpy.typing.NDArray[numpy.float64], '[3, 1]']#
- displace_points(self: Deformation, at: Sequence[Annotated[numpy.typing.ArrayLike, numpy.float64, '[3, 1]']]) list[Annotated[numpy.typing.NDArray[numpy.float64], '[3, 1]']]#
- displacement(self: Deformation, at: Annotated[numpy.typing.ArrayLike, numpy.float64, '[3, 1]']) Annotated[numpy.typing.NDArray[numpy.float64], '[3, 1]']#
- displacement(self: Deformation, at: Annotated[numpy.typing.ArrayLike, numpy.float64, '[2, 1]']) Annotated[numpy.typing.NDArray[numpy.float64], '[3, 1]']
- displacement(self: Deformation, at: Sequence[Annotated[numpy.typing.ArrayLike, numpy.float64, '[3, 1]']]) list[Annotated[numpy.typing.NDArray[numpy.float64], '[3, 1]']]
Function overload documentation:
- displacement(self: Deformation, at: Annotated[numpy.typing.ArrayLike, numpy.float64, '[3, 1]']) Annotated[numpy.typing.NDArray[numpy.float64], '[3, 1]']
- displacement(self: Deformation, at: Annotated[numpy.typing.ArrayLike, numpy.float64, '[2, 1]']) Annotated[numpy.typing.NDArray[numpy.float64], '[3, 1]']
- displacement(self: Deformation, at: Sequence[Annotated[numpy.typing.ArrayLike, numpy.float64, '[3, 1]']]) list[Annotated[numpy.typing.NDArray[numpy.float64], '[3, 1]']]
- class imfusion.ExplicitIntensityMask(self: ExplicitIntensityMask, ref_image: SharedImage, mask_image: SharedImage)#
Bases:
MaskCombination of an ExplicitMask and an IntensityMask.
- property border_clamp#
If true, set sampler wrapping mode to
CLAMP_TO_BORDER(default). If false, set toCLAMP_TO_EDGE.- Type:
- class imfusion.ExplicitMask(*args, **kwargs)#
Bases:
MaskMask holding an individual mask value for every pixel.
Function overload documentation:
- __init__(self: ExplicitMask, width: SupportsInt | SupportsIndex, height: SupportsInt | SupportsIndex, slices: SupportsInt | SupportsIndex, initial: SupportsInt | SupportsIndex = 0) None
- __init__(self: ExplicitMask, dimensions: Annotated[numpy.typing.ArrayLike, numpy.int32, '[3, 1]'], initial: SupportsInt | SupportsIndex = 0) None
- __init__(self: ExplicitMask, mask_image: MemImage) None
- mask_image(self: ExplicitMask) SharedImage#
Returns a copy of the mask image held by the mask.
- class imfusion.FrameworkInfo#
Bases:
pybind11_objectProvides general information about the framework.
- property license#
- Type:
- property opengl#
- Type:
GlPlatformInfo | None
- property plugins#
- Type:
- class imfusion.FreeFormDeformation#
Bases:
Deformation- configuration(self: FreeFormDeformation) Properties#
- configure(self: FreeFormDeformation, arg0: Properties) None#
- control_points(self: FreeFormDeformation) list[Annotated[numpy.typing.NDArray[numpy.float64], '[3, 1]']]#
Get current control point locations (including displacement)
- property displacements#
Displacement in mm of all control points
- property grid_spacing#
Spacing of the control point grid
- Type:
Annotated[numpy.typing.NDArray[numpy.float64], ”[3, 1]”]
- class imfusion.GlPlatformInfo#
Bases:
pybind11_objectProvides information about the underlying OpenGL driver.
- class imfusion.ImageDescriptor(*args, **kwargs)#
Bases:
pybind11_objectStruct describing the essential properties of an image.
The ImFusion framework distinguishes two main image pixel value domains, which are indicated by the shift and scale parameters of this image descriptor:
Original pixel value domain: Pixel values are the same as in their original source (e.g. when loaded from a file). Same as the storage pixel value domain if the image’s scale is 1 and the shift is 0
Storage pixel value domain: Pixel values as they are stored in a MemImage. The user may decide to apply such a rescaling in order to better use the available limits of the underlying type.
The following conversion rules apply:
OV = (SV / scale) - shift
SV = (OV + shift) * scale
Function overload documentation:
- __init__(self: ImageDescriptor) None
- __init__(self: ImageDescriptor, type: PixelType, dimensions: Annotated[numpy.typing.ArrayLike, numpy.int32, '[3, 1]'], channels: SupportsInt | SupportsIndex = 1) None
- __init__(self: ImageDescriptor, type: PixelType, width: SupportsInt | SupportsIndex, height: SupportsInt | SupportsIndex, slices: SupportsInt | SupportsIndex = 1, channels: SupportsInt | SupportsIndex = 1) None
- __init__(self: ImageDescriptor, bound_image_descriptor: BoundImageDescriptor) None
- clone(self: ImageDescriptor) ImageDescriptor#
Return a mutable copy of this descriptor.
- configure(self: ImageDescriptor, properties: Properties) None#
Deserialize an image descriptor from Properties
- coord(self: ImageDescriptor, index: SupportsInt | SupportsIndex) Annotated[numpy.typing.NDArray[numpy.int32], '[4, 1]']#
Return the pixel/voxel coordinate (x,y,z,c) for a given index
- has_index(self: ImageDescriptor, x: SupportsInt | SupportsIndex, y: SupportsInt | SupportsIndex, z: SupportsInt | SupportsIndex = 0, c: SupportsInt | SupportsIndex = 0) bool#
Return true if the pixel at (x,y,z) exists, false otherwise
- image_to_pixel(self: ImageDescriptor, world: Annotated[numpy.typing.ArrayLike, numpy.float64, '[3, 1]']) Annotated[numpy.typing.NDArray[numpy.float64], '[3, 1]']#
Convert 3D image coordinates to pixel/voxel position
- index(self: ImageDescriptor, x: SupportsInt | SupportsIndex, y: SupportsInt | SupportsIndex, z: SupportsInt | SupportsIndex = 0, c: SupportsInt | SupportsIndex = 0) int#
Return a linear memory index for a pixel or voxel
- is_compatible(self: ImageDescriptor, other: ImageDescriptor, ignore_type: bool = False, ignore_3D: bool = False, ignore_channels: bool = False, ignore_spacing: bool = True) bool#
Convenience function to perform partial comparison of two image descriptors. Two descriptors are compatible if their width and height, and optionally number of slices, number of channels and type are the same
- is_valid(self: ImageDescriptor) bool#
Return if the descriptor is valid (a size of one is allowed)
- original_to_storage(self: ImageDescriptor, value: SupportsFloat | SupportsIndex) float#
Apply the image’s shift and scale in order to convert a value from original pixel value domain to storage pixel value domain
- pixel_to_image(self: ImageDescriptor, pixel: Annotated[numpy.typing.ArrayLike, numpy.float64, '[3, 1]']) Annotated[numpy.typing.NDArray[numpy.float64], '[3, 1]']#
Convert a 3D pixel/voxel position to image coordinates
- set_dimensions(self: ImageDescriptor, dimensions: Annotated[numpy.typing.ArrayLike, numpy.int32, '[3, 1]'], channels: SupportsInt | SupportsIndex = 0) None#
Convenience function for specifying the image dimensions and channels at once. If
channelsis 0, the number of channels will remain unchanged
- set_spacing(self: ImageDescriptor, spacing: Annotated[numpy.typing.ArrayLike, numpy.float64, '[3, 1]'], is_metric: bool) None#
Convenience function for specifying spacing and metric flag at the same time
- storage_to_original(self: ImageDescriptor, value: SupportsFloat | SupportsIndex) float#
Apply the image’s shift and scale in order to convert a value from storage pixel value domain to original pixel value domain
- property configuration#
Serialize an image descriptor to Properties
- Type:
- property image_to_pixel_matrix#
Return a 4x4 matrix to transform from image space to pixel space
- Type:
Annotated[numpy.typing.NDArray[numpy.float64], ”[4, 4]”]
- property image_to_texture_matrix#
Return a 4x4 matrix to transform from image space to texture space
- Type:
Annotated[numpy.typing.NDArray[numpy.float64], ”[4, 4]”]
- property pixel_to_image_matrix#
Return a 4x4 matrix to transform from pixel space to image space
- Type:
Annotated[numpy.typing.NDArray[numpy.float64], ”[4, 4]”]
- property spacing#
Physical extent of each voxel in [mm] stored as a namedtuple. Spacing for a specific dimension can be accessed via
x,y, andzattributes.When setting the spacing, it is always assumed that the given spacing is metric. If you want to specify a non-metric spacing, use
desc.set_spacing(new_spacing, is_metric=False).- Returns:
Named tuple with
x,y, andzattributes.- Return type:
(collections.namedtuple)
- Type:
- property texture_to_image_matrix#
Return a 4x4 matrix to transform from texture space to image space
- Type:
Annotated[numpy.typing.NDArray[numpy.float64], ”[4, 4]”]
- property type_size#
Return the nominal size in bytes of the current component type, zero if unknown
- Type:
- class imfusion.ImageDescriptorWorld(*args, **kwargs)#
Bases:
pybind11_objectConvenience struct extending an ImageDescriptor to also include a matrix describing the image orientation in world coordinates.
This struct can be useful for describing the geometrical properties of an image without need to hold the (heavy) image content. As such it can be used for representing reference geometries for image resampling, or for one-line creation of a new SharedImage.
Function overload documentation:
- __init__(self: ImageDescriptorWorld, descriptor: ImageDescriptor, matrix_to_world: Annotated[numpy.typing.ArrayLike, numpy.float64, '[4, 4]']) None
- __init__(self: ImageDescriptorWorld, shared_image: SharedImage) None
- __init__(self: ImageDescriptorWorld, bound_image_descriptor_world: BoundImageDescriptorWorld) None
- clone(self: ImageDescriptorWorld) ImageDescriptorWorld#
Returns a copy of this world descriptor.
- image_to_pixel(self: ImageDescriptorWorld, world: Annotated[numpy.typing.ArrayLike, numpy.float64, '[3, 1]']) Annotated[numpy.typing.NDArray[numpy.float64], '[3, 1]']#
Convert 3D image coordinates to pixel/voxel position
- is_spatially_compatible(self: ImageDescriptorWorld, other: ImageDescriptorWorld) bool#
Convenience function to compare two image world descriptors (for instance to know whether a resampling is necessary). Two descriptors are compatible if their dimensions, matrix and spacing are identical.
- pixel_to_image(self: ImageDescriptorWorld, pixel: Annotated[numpy.typing.ArrayLike, numpy.float64, '[3, 1]']) Annotated[numpy.typing.NDArray[numpy.float64], '[3, 1]']#
Convert a 3D pixel/voxel position to image coordinates
- pixel_to_world(self: ImageDescriptorWorld, pixel: Annotated[numpy.typing.ArrayLike, numpy.float64, '[3, 1]']) Annotated[numpy.typing.NDArray[numpy.float64], '[3, 1]']#
Convert a 3D pixel/voxel position to world coordinates
- world_to_pixel(self: ImageDescriptorWorld, world: Annotated[numpy.typing.ArrayLike, numpy.float64, '[3, 1]']) Annotated[numpy.typing.NDArray[numpy.float64], '[3, 1]']#
Convert 3D world coordinates to pixel/voxel position
- property descriptor#
- Type:
- property image_to_pixel_matrix#
Return a 4x4 matrix to transform from image space to pixel space
- Type:
Annotated[numpy.typing.NDArray[numpy.float64], ”[4, 4]”]
- property image_to_texture_matrix#
Return a 4x4 matrix to transform from image space to texture space
- Type:
Annotated[numpy.typing.NDArray[numpy.float64], ”[4, 4]”]
- property pixel_to_image_matrix#
Return a 4x4 matrix to transform from pixel space to image space
- Type:
Annotated[numpy.typing.NDArray[numpy.float64], ”[4, 4]”]
- property pixel_to_world_matrix#
Return a 4x4 matrix to transform from pixel space to world space
- Type:
Annotated[numpy.typing.NDArray[numpy.float64], ”[4, 4]”]
- property texture_to_image_matrix#
Return a 4x4 matrix to transform from texture space to image space
- Type:
Annotated[numpy.typing.NDArray[numpy.float64], ”[4, 4]”]
- property texture_to_world_matrix#
Return a 4x4 matrix to transform from texture space to world space
- Type:
Annotated[numpy.typing.NDArray[numpy.float64], ”[4, 4]”]
- class imfusion.IntensityMask(*args, **kwargs)#
Bases:
MaskMasks pixels with a specific value or values outside a specific range.
Function overload documentation:
- __init__(self: IntensityMask, type: PixelType, value: SupportsFloat | SupportsIndex = 0.0) None
- __init__(self: IntensityMask, image: MemImage, value: SupportsFloat | SupportsIndex = 0.0) None
- property masked_value_range#
Half-open range
[min, max)of allowed pixel values
- class imfusion.InterpolationMode(value, names=<not given>, *values, module=None, qualname=None, type=None, start=1, boundary=None)#
Bases:
Enum- LINEAR = 1#
- NEAREST = 0#
- class imfusion.InversionComponent#
Bases:
DataComponentBaseData component for storing the information needed to invert an operation.
- class InversionInfo#
Bases:
pybind11_objectStruct for storing the information needed to invert an operation.
- property context_properties#
- Type:
Properties | None
- property operation_properties#
- Type:
- get_all_inversion_infos(self: InversionComponent, arg0: str) list[InversionInfo]#
- get_inversion_info(self: InversionComponent, arg0: str) InversionInfo#
- class imfusion.LicenseInfo#
Bases:
pybind11_objectProvides information about the currently used license.
- class imfusion.Mask#
Bases:
pybind11_objectBase interface for implementing polymorphic image masks.
- class CreateOption(value, names=<not given>, *values, module=None, qualname=None, type=None, start=1, boundary=None)#
Bases:
EnumEnumeration of available behavior for Mask::create_explicit_mask().
- DEEP_COPY = 0#
- SHALLOW_COPY_IF_POSSIBLE = 1#
- create_explicit_mask(self: Mask, image: SharedImage, create_option: CreateOption = CreateOption.DEEP_COPY) MemImage#
Creates an explicit mask representation of this mask for a given image.
- is_compatible(self: Mask, arg0: SharedImage) bool#
Returns
Trueif the mask can be used with the given image orFalseotherwise.
- mask_value(self: Mask, coord: Annotated[numpy.typing.ArrayLike, numpy.int32, '[3, 1]'], color: Annotated[numpy.typing.ArrayLike, numpy.float32, '[4, 1]']) int#
- mask_value(self: Mask, coord: Annotated[numpy.typing.ArrayLike, numpy.int32, '[3, 1]'], value: SupportsFloat | SupportsIndex) int
Function overload documentation:
- mask_value(self: Mask, coord: Annotated[numpy.typing.ArrayLike, numpy.int32, '[3, 1]'], color: Annotated[numpy.typing.ArrayLike, numpy.float32, '[4, 1]']) int
Returns 0 if the given pixel is outside the mask (i.e. invisible/to be ignored) or a non-zero value if it is inside the mask (i.e. visible/to be considered).
- mask_value(self: Mask, coord: Annotated[numpy.typing.ArrayLike, numpy.int32, '[3, 1]'], value: SupportsFloat | SupportsIndex) int
Returns 0 if the given pixel is outside the mask (i.e. invisible/to be ignored) or a non-zero value if it is inside the mask (i.e. visible/to be considered).
- DEEP_COPY = 0#
- SHALLOW_COPY_IF_POSSIBLE = 1#
- class imfusion.MemImage(*args, **kwargs)#
Bases:
pybind11_objectA
MemImageinstance represents an image which resides in main memory.The
MemImageclass supports the Buffer Protocol. This means that the underlying buffer can be wrapped in e.g. numpy without a copy:>>> mem = imfusion.MemImage(imfusion.PixelType.BYTE, 10, 10) >>> arr = np.array(mem, copy=False) >>> arr.fill(0) >>> int(np.sum(arr)) 0
Be aware that most numpy operation create a copy of the data and don’t affect the original data:
>>> int(np.sum(np.add(arr, 1))) 100
>>> int(np.sum(arr)) 0
To update the buffer of a
MemImage, usenp.copyto:>>> np.copyto(arr, np.add(arr, 1)) >>> int(np.sum(arr)) 100
Alternatively use the
outargument of certain numpy functions:>>> np.add(arr, 1, out=arr) array(...)
>>> int(np.sum(arr)) 200
Function overload documentation:
- __init__(self: MemImage, type: PixelType, width: SupportsInt | SupportsIndex, height: SupportsInt | SupportsIndex, slices: SupportsInt | SupportsIndex = 1, channels: SupportsInt | SupportsIndex = 1) None
- __init__(self: MemImage, desc: ImageDescriptor) None
Factory method to instantiate a MemImage from an ImageDescriptor. note This method does not initialize the underlying buffer
- __init__(self: MemImage, array: Annotated[numpy.typing.ArrayLike, numpy.int8], greyscale: bool = False) None
Create a
MemImagefrom anumpy.array.The array must be contiguous and must have between 2 and 4 dimensions. The dimensions are interpreted as (slices, height, width, channels). Missing dimensions are set to one. The color dimension must always be present even for greyscale image in which case it would be 1.
Use the optional
greyscaleargument to specify that the color dimensions is missing and the buffer should be interpreted as greyscale.The actual array data is copied into the
MemImage.
- __init__(self: MemImage, array: Annotated[numpy.typing.ArrayLike, numpy.uint8], greyscale: bool = False) None
- __init__(self: MemImage, array: Annotated[numpy.typing.ArrayLike, numpy.int16], greyscale: bool = False) None
- __init__(self: MemImage, array: Annotated[numpy.typing.ArrayLike, numpy.uint16], greyscale: bool = False) None
- __init__(self: MemImage, array: Annotated[numpy.typing.ArrayLike, numpy.int32], greyscale: bool = False) None
- __init__(self: MemImage, array: Annotated[numpy.typing.ArrayLike, numpy.uint32], greyscale: bool = False) None
- __init__(self: MemImage, array: Annotated[numpy.typing.ArrayLike, numpy.float32], greyscale: bool = False) None
- __init__(self: MemImage, array: Annotated[numpy.typing.ArrayLike, numpy.float64], greyscale: bool = False) None
- apply_shift_and_scale(arr)#
Return a copy of the array with storage values converted to original values. The dtype of the returned array is always DOUBLE.
- astype(self: MemImage, image_type: object) MemImage#
Create a copy of the current MemImage instance with the requested Image format.
This function accepts either: - an Image type (e.g. imfusion.Image.UINT); - most of the numpy’s dtypes (e.g. np.uint); - python’s float or int types.
If the requested Image format already matches the Image format of the current instance, then a clone of the current instance is returned.
- image_to_pixel(self: MemImage, world: Annotated[numpy.typing.ArrayLike, numpy.float64, '[3, 1]']) Annotated[numpy.typing.NDArray[numpy.float64], '[3, 1]']#
Convert a 3D image coordinate to a pixel position.
- numpy()#
Convenience method for converting a MemImage or a SharedImage into a newly created numpy array with scale and shift already applied.
Shift and scale may determine a complex change of pixel type prior the conversion into numpy array:
as a first rule, even if the type of shift and scale is float, they will still be considered as integers if they are representing integers (e.g. a shift of 2.000 will be treated as 2);
if shift and scale are such that the pixel values range (determined by the pixel_type) would not be fitting into the pixel_type, e.g. a negative pixel value but the type is unsigned, then the pixel_type will be promoted into a signed type if possible, otherwise into a single precision floating point type;
if shift and scale are such that the pixel values range (determined by the pixel_type) would be fitting into a demoted pixel_type, e.g. the type is signed but the range of pixel values is unsigned, then the pixel_type will be demoted;
if shift and scale do not certainly determine that all the possible pixel values (in the range determined by the pixel_type) would become integers, then the pixel_type will be promoted into a single precision floating point type.
in any case, the returned numpy array will be returned with type up to 32-bit integers. If the integer type would require more bits, then the resulting pixel_type will be DOUBLE.
- Parameters:
self – instance of a MemImage or of a SharedImage
- Returns:
numpy.ndarray
- pixel_to_image(self: MemImage, pixel: Annotated[numpy.typing.ArrayLike, numpy.float64, '[3, 1]']) Annotated[numpy.typing.NDArray[numpy.float64], '[3, 1]']#
Convert a 3D pixel position to an image coordinate.
- static zeros(desc: ImageDescriptor) MemImage#
Factory method to create a zero-initialized image
- property shape#
Return a numpy compatible shape descripting the dimensions of this image.
The returned tuple has 4 entries: slices, height, width, channels
- class imfusion.Mesh(*args, **kwargs)#
Bases:
DataRe-exported from
imfusion.data.Mesh.
- class imfusion.Optimizer#
Bases:
pybind11_objectObject for non-linear optimization.
The current bindings are work in progress and therefore limited. They are so far mostly meant to be used for changing an existing optimizer rather than creating one from scratch.
- class Mode(value, names=<not given>, *values, module=None, qualname=None, type=None, start=1, boundary=None)#
Bases:
EnumMode of operation when execute is called.
- EVALUATE = 3#
- OPT = 0#
- PLOT = 2#
- STUDY = 1#
- __call__(self: Optimizer, x: Sequence[SupportsFloat | SupportsIndex]) list[float]#
Delegates to:
execute()
- configuration(self: Optimizer) Properties#
Returns the configuration of the object.
- configure(self: Optimizer, arg0: Properties) None#
Configures the object.
- execute(self: Optimizer, x: Sequence[SupportsFloat | SupportsIndex]) list[float]#
Execute the optimization given a vector of initial parameters of full dimensionality.
- set_bounds(self: Optimizer, bounds: SupportsFloat | SupportsIndex) None#
- set_bounds(self: Optimizer, lower_bounds: SupportsFloat | SupportsIndex, upper_bounds: SupportsFloat | SupportsIndex) None
- set_bounds(self: Optimizer, bounds: Sequence[SupportsFloat | SupportsIndex]) None
- set_bounds(self: Optimizer, lower_bounds: Sequence[SupportsFloat | SupportsIndex], upper_bounds: Sequence[SupportsFloat | SupportsIndex]) None
- set_bounds(self: Optimizer, bounds: Sequence[tuple[SupportsFloat | SupportsIndex, SupportsFloat | SupportsIndex]]) None
Function overload documentation:
- set_bounds(self: Optimizer, bounds: SupportsFloat | SupportsIndex) None
Set the same symmetric bounds in all parameters. A value of zero disables the bounds.
- set_bounds(self: Optimizer, lower_bounds: SupportsFloat | SupportsIndex, upper_bounds: SupportsFloat | SupportsIndex) None
Set the same lower and upper bounds for all parameters.
- set_bounds(self: Optimizer, bounds: Sequence[SupportsFloat | SupportsIndex]) None
Set individual symmetric bounds.
- set_bounds(self: Optimizer, lower_bounds: Sequence[SupportsFloat | SupportsIndex], upper_bounds: Sequence[SupportsFloat | SupportsIndex]) None
Set individual lower and upper bounds.
- set_bounds(self: Optimizer, bounds: Sequence[tuple[SupportsFloat | SupportsIndex, SupportsFloat | SupportsIndex]]) None
Set individual lower and upper bounds as a list of pairs.
- set_logging_level(self: Optimizer, file_level: SupportsInt | SupportsIndex | None = None, console_level: SupportsInt | SupportsIndex | None = None) None#
Set level of detail for logging to text file and the console. 0 = none (default), 1 = init/result, 2 = every evaluation, 3 = only final result after study.
- property dimension#
Total number of parameters. The selection gets cleared when the dimension value is modified.
- Type:
- property minimizing#
Whether the optimizer has a loss function (that it should minimize) or an objective function (that it should maximize).
- Type:
- class imfusion.PaddingMode(value, names=<not given>, *values, module=None, qualname=None, type=None, start=1, boundary=None)#
Bases:
Enum- CLAMP = 2#
- MIRROR = 1#
- ZERO = 0#
- class imfusion.ParametricDeformation#
Bases:
Deformation- set_parameters(self: ParametricDeformation, parameters: Sequence[SupportsFloat | SupportsIndex]) None#
- class imfusion.PatchInfo#
Bases:
pybind11_objectStruct for storing the descriptor of the image a patch was extracted from and the region of interest in the original image.
- property original_image_descriptor#
- Type:
- property roi#
- Type:
- class imfusion.PatchesFromImageDataComponent#
Bases:
DataComponentBaseData component for keeping track of the original location of a patch in the original image. This is set for instance by the SplitIntoPatchesOperation when extracting patches from the input image.
- add(self: PatchesFromImageDataComponent, arg0: PatchInfo) None#
- class imfusion.PixelType(value, names=<not given>, *values, module=None, qualname=None, type=None, start=1, boundary=None)#
Bases:
Enum- BYTE = 5120#
- DOUBLE = 5130#
- FLOAT = 5126#
- HFLOAT = 5131#
- INT = 5124#
- SHORT = 5122#
- UBYTE = 5121#
- UINT = 5125#
- USHORT = 5123#
- class imfusion.PluginInfo#
Bases:
pybind11_objectProvides information about a framework plugin.
- class imfusion.PointCloud(self: PointCloud, points: Sequence[Annotated[numpy.typing.ArrayLike, numpy.float64, '[3, 1]']] = [], *, normals: Sequence[Annotated[numpy.typing.ArrayLike, numpy.float64, '[3, 1]']] = [], colors: Sequence[Annotated[numpy.typing.ArrayLike, numpy.float64, '[3, 1]']] = [])#
Bases:
DataRe-exported from
imfusion.data.PointCloud.
- class imfusion.PointCorrespondences(self: PointCorrespondences, first: PointsOnData, second: PointsOnData)#
Bases:
pybind11_objectClass that handles point correspondences. Points at corresponding indices on the two PointsOnData instances are considered correspondences. When creating PointCorrespondences(first, second) names of points in first and second are made uniform giving precedence to names in first. Logic for matching points based on their names should be implemented outside of this class. The class supports both full-set and subset-based rigid fitting, allowing users to select specific point correspondences for the transformation calculation. The class supports estimation of a fitting error for any correspondence using complementary correspondences, which can assist with the identification of inconsistent correspondences.
- class PointCorrespondenceIterator#
Bases:
pybind11_objectIterator for PointCorrespondences
- __next__(self: PointCorrespondenceIterator) object#
- class Reduction(value, names=<not given>, *values, module=None, qualname=None, type=None, start=1, boundary=None)#
Bases:
EnumReduction type used during distance evaluation
- MAX = 2#
- MEAN = 0#
- MEDIAN = 1#
- MIN = 3#
- __getitem__(self: PointCorrespondences, index: SupportsInt | SupportsIndex) tuple[Annotated[numpy.typing.NDArray[numpy.float64], '[3, 1]'], Annotated[numpy.typing.NDArray[numpy.float64], '[3, 1]']]#
Get a point correspondences pair (in world coordinates) by index
- __iter__(self: PointCorrespondences) PointCorrespondenceIterator#
Iterate over all point correspondences in world coordinates
- clear(self: PointCorrespondences) None#
Remove all correspondences.
- compute_pairwise_distances(self: PointCorrespondences, reduction: Reduction = Reduction.MEAN, weights: Sequence[SupportsFloat | SupportsIndex] = None) float#
Compute the distance between pairs of correspondences. Parameters: reduction (PointCorrespondences.Reduction): The reduction method to use (MEAN, MEDIAN, MIN, MAX). weights (list of float): Optional weights for each correspondence. If provided, the individual errors are multiplied with these weights before reduction.
- fit_rigid(self: PointCorrespondences, subset_indices: Sequence[SupportsInt | SupportsIndex] | None = None) object#
Fit a rigid transformation that aligns the selected correspondences. :param subset_indices: Optional list of indices to use for fitting. If not provided, all selected correspondences are used.
- is_selected(self: PointCorrespondences, index: SupportsInt | SupportsIndex) bool#
Check if a correspondence is selected.
- name(self: PointCorrespondences, index: SupportsInt | SupportsIndex) str#
Return the name of a correspondence.
- set_name(self: PointCorrespondences, index: SupportsInt | SupportsIndex, name: str) None#
Set the name of a correspondence at index ‘index’.
- set_selected(self: PointCorrespondences, index: SupportsInt | SupportsIndex, selected: bool) None#
Set whether a correspondence is selected.
- property point_handler#
The PointsOnData handlers.
- Type:
- class imfusion.PointsOnData#
Bases:
pybind11_objectBase interface for points linked to Data.
- clear(self: PointsOnData) None#
Remove all the points
- empty(self: PointsOnData) bool#
Check if the list of points is empty
- find(self: PointsOnData, name: str, start: SupportsInt | SupportsIndex = 0) int#
Get the first index of a point with the given name, starting from index start. Return -1 if not found
- numpy(self: PointsOnData) numpy.typing.NDArray[numpy.float64]#
Convert all points to a numpy array
- class imfusion.PointsOnImage(self: PointsOnImage, image: SharedImageSet)#
Bases:
PointsOnDataClass that hold a list of points on a volume or image. Points are automatically updated when the matrix or deformation changes.
Create a PointsOnImage object for the given SharedImageSet.
- __getitem__(self: PointsOnImage, index: SupportsInt | SupportsIndex) PyPointsOnImagePoint#
- __getitem__(self: PointsOnImage, indices: Sequence[SupportsInt | SupportsIndex]) list[PyPointsOnImagePoint]
- __getitem__(self: PointsOnImage, slice: slice) list[PyPointsOnImagePoint]
- __getitem__(self: PointsOnImage, name: str) PyPointsOnImagePoint
Function overload documentation:
- __getitem__(self: PointsOnImage, index: SupportsInt | SupportsIndex) PyPointsOnImagePoint
- __getitem__(self: PointsOnImage, indices: Sequence[SupportsInt | SupportsIndex]) list[PyPointsOnImagePoint]
- __getitem__(self: PointsOnImage, slice: slice) list[PyPointsOnImagePoint]
- __getitem__(self: PointsOnImage, name: str) PyPointsOnImagePoint
Get a point in world coordinates by name.
- __iter__(self: PointsOnImage) PyPointsIterator#
Iterate over all points in world coordinates
- __setitem__(self: PointsOnImage, arg0: SupportsInt | SupportsIndex, arg1: Annotated[numpy.typing.ArrayLike, numpy.float64, '[3, 1]']) None#
Set a point in world coordinates
- add_image_point(self: PointsOnImage, point: Annotated[numpy.typing.ArrayLike, numpy.float64, '[3, 1]'], frame: SupportsInt | SupportsIndex) None#
Add a new point in image coordinates for a given frame.
- add_world_point(self: PointsOnImage, point: Annotated[numpy.typing.ArrayLike, numpy.float64, '[3, 1]'], find_closest_frame: bool = True) None#
Add a new point in world coordinates. If find_closest_frame is true, assigns to closest frame.
- image_point(self: PointsOnImage, index: SupportsInt | SupportsIndex) tuple[Annotated[numpy.typing.NDArray[numpy.float64], '[3, 1]'], int]#
Return the point in image coordinates, paired with its associated frame.
- property all_points#
Return the points in world coordinates.
- property image_points#
Return the points in image coordinates, paired with their associated frame.
- class imfusion.Properties(*args, **kwargs)#
Bases:
pybind11_objectPropertiesobjects store arbitrary key-value pairs as strings in a hierarchical fashion.Propertiesare extensively used within the ImFusion frameworks for purposes such as:Saving and loading the state of an application to and from files.
Configuring the
Viewinstances of the UI.Configuring the
Algorithminstances.
The bindings provide two interfaces: a C++-like one based on
param()andset_param(), and a more Pythonic interface using the[]operator. Both interfaces are equivalent and interchangeable.Parameters can be set with the
set_param()method, e.g.:>>> p = imfusion.Properties() >>> p.set_param('Spam', 5)
The parameter type will be set depending on the type of the Python value similar to C++. To retrieve a parameter, a value of the desired return type must be passed:
>>> spam = 0 >>> p.param('Spam', spam) 5
If the parameter doesn’t exists, the value of the second argument is returned:
>>> foo = 8 >>> p.param('Foo', foo) 8
The
Propertiesobject also exposes all its parameters as items, e.g. to add a new parameter just add a new key:>>> p = imfusion.Properties() >>> p['spam'] = 5
When using the dictionary-like syntax with the basic types (
bool,int,float,strandlist), the returned values are typed accordingly:>>> type(p['spam']) <class 'int'>
However, for matrix and vector types, the
param()method needs to be used, which receives an extra variable of the same type that has to be returned:>>> import numpy as np >>> np_array = np.ones(3) >>> p['foo'] = np_array >>> p.param('foo', np_array) array([1., 1., 1.])
In fact, the dictionary-like syntax would just return it as a string instead:
>>> p['foo'] '1 1 1 '
Additionally, the attributes of parameters are available through the
param_attributes()method:>>> p.set_param_attributes('spam', 'max: 10') >>> p.param_attributes('spam') [('max', '10')]
A
Propertiesobject can be obtained from adict:>>> p = imfusion.Properties({'spam': 5, 'eggs': True, 'sub/0': { 'eggs': False }}) >>> p['eggs'] True >>> p['sub/0']['eggs'] False
There are two possible, but slightly different, ways to convert a
Propertiesinstance into adict. The first method is bydictcasting, which returns adictmade by nestedProperties. The second method is by calling theasdict()method, which returns adictexpanding also the nestedPropertiesinstances:>>> dict(p) {'spam': 5, 'eggs': True, 'sub/0': <Properties(name=sub,... >>> p.asdict() {'spam': 5, 'eggs': True, 'sub/0': {'eggs': False}}
When a parameter needs to take values among a
setof possible choices, the parameter can be assigned to anEnumStringParam:>>> p["choice"] = imfusion.Properties.EnumStringParam(value="choice2", admitted_values={"choice1", "choice2"}) >>> p["choice"] Properties.EnumStringParam(value="choice2", admitted_values={...})
Please refer to
EnumStringParamfor more information.Function overload documentation:
- __init__(self: Properties, name: str = '') None
- __init__(self: Properties, dictionary: dict) None
- class EnumStringParam(self: EnumStringParam, *, value: str, admitted_values: Set[str])#
Bases:
pybind11_objectParameter that can assume a certain value among a
setofstrpossibilities.A first way to instantiate this class, is to provide the value and the
setof admitted values:>>> p = imfusion.Properties() >>> p["choice"] = imfusion.Properties.EnumStringParam(value="choice2", admitted_values={"choice1", "choice2"}) >>> p["choice"] Properties.EnumStringParam(value="choice2", admitted_values={...})
If
EnumStringParamis assigned to a value that is not in thesetof possible choices, then aValueErroris raised:>>> p["choice"] = imfusion.Properties.EnumStringParam(value="choice3", admitted_values={"choice1", "choice2"}) Traceback (most recent call last): ... ValueError: EnumStringParam was assigned to 'choice3' but it is not in the set of admitted values: ...
An
EnumStringParaminstance can be constructed from aEnummember by using thefrom_enum()method, in which case theEnumStringParaminstance gets itsvaluefrom the givenEnummember, and gets itsadmitted_valuesfrom thesetofEnummembers:>>> import enum >>> class Choices(enum.Enum): ... CHOICE_1: str = "choice1" ... CHOICE_2: str = "choice2" ... >>> p["choice"] = imfusion.Properties.EnumStringParam.from_enum(Choices.CHOICE_2) >>> p["choice"] Properties.EnumStringParam(value="CHOICE_2", admitted_values={...})
An
EnumStringParaminstance that corresponds 1-to-1 to anEnumcan be converted into theEnummember that corresponds to its currentvalue:>>> p["choice"].to_enum(Choices) <Choices.CHOICE_2: 'choice2'>
In the example above, the
Enummembers were used to populated theadmitted_values. However, it is also possible to populate theadmitted_valuesfrom theEnumvalues:>>> p["choice"] = imfusion.Properties.EnumStringParam.from_enum(Choices.CHOICE_2, take_enum_values=True) >>> p["choice"] Properties.EnumStringParam(value="choice2", admitted_values={...}) >>> p["choice"].to_enum(Choices) <Choices.CHOICE_2: 'choice2'>
- Parameters:
value – a choice among the
setofadmitted_values.
- classmethod from_enum()#
(cls: object, enum_member: object, take_enum_values: bool = False) -> imfusion.Properties.EnumStringParam
Construct an
EnumStringParamautomatically out of the provided instance of an enumeration class.- Parameters:
enum_member – a member of an enumeration class. The current
valuewill be assigned to this argument, while theadmitted_valueswill be automatically constructed from the members of the enumeration class.take_enum_values – is False, then the enumeration members are taken as values. If True, then the enumeration values are taken as values: please note that in this case all the enumeration values must be unique and of
strtype.
- to_enum(self: EnumStringParam, enum_type: object) object#
Casts into the corresponding member of the
enum_typetype. It raises when this is not possible.- Parameters:
enum_type – the enumeration class into which to cast the current value. Please note that this enumeration class must be compatible, which means it must correspond to the set of
admitted_values.
- __getitem__(self: Properties, arg0: str) object#
- __setitem__(self: Properties, name: str, value: bool) None#
- __setitem__(self: Properties, name: str, value: int) None
- __setitem__(self: Properties, name: str, value: float) None
- __setitem__(self: Properties, name: str, value: Annotated[numpy.typing.NDArray[numpy.float64], '[3, 3]']) None
- __setitem__(self: Properties, name: str, value: Annotated[numpy.typing.NDArray[numpy.float64], '[4, 4]']) None
- __setitem__(self: Properties, name: str, value: Annotated[numpy.typing.NDArray[numpy.float64], '[3, 4]']) None
- __setitem__(self: Properties, name: str, value: Annotated[numpy.typing.NDArray[numpy.float32], '[3, 3]']) None
- __setitem__(self: Properties, name: str, value: Annotated[numpy.typing.NDArray[numpy.float32], '[4, 4]']) None
- __setitem__(self: Properties, name: str, value: Annotated[numpy.typing.NDArray[numpy.float64], '[2, 1]']) None
- __setitem__(self: Properties, name: str, value: Annotated[numpy.typing.NDArray[numpy.float64], '[3, 1]']) None
- __setitem__(self: Properties, name: str, value: Annotated[numpy.typing.NDArray[numpy.float64], '[4, 1]']) None
- __setitem__(self: Properties, name: str, value: Annotated[numpy.typing.NDArray[numpy.float64], '[5, 1]']) None
- __setitem__(self: Properties, name: str, value: Annotated[numpy.typing.NDArray[numpy.float32], '[2, 1]']) None
- __setitem__(self: Properties, name: str, value: Annotated[numpy.typing.NDArray[numpy.float32], '[3, 1]']) None
- __setitem__(self: Properties, name: str, value: Annotated[numpy.typing.NDArray[numpy.float32], '[4, 1]']) None
- __setitem__(self: Properties, name: str, value: Annotated[numpy.typing.NDArray[numpy.int32], '[2, 1]']) None
- __setitem__(self: Properties, name: str, value: Annotated[numpy.typing.NDArray[numpy.int32], '[3, 1]']) None
- __setitem__(self: Properties, name: str, value: Annotated[numpy.typing.NDArray[numpy.int32], '[4, 1]']) None
- __setitem__(self: Properties, name: str, value: str) None
- __setitem__(self: Properties, name: str, value: Path) None
- __setitem__(self: Properties, name: str, value: list[str]) None
- __setitem__(self: Properties, name: str, value: list[Path]) None
- __setitem__(self: Properties, name: str, value: list[bool]) None
- __setitem__(self: Properties, name: str, value: list[int]) None
- __setitem__(self: Properties, name: str, value: list[float]) None
- __setitem__(self: Properties, name: str, value: list[Annotated[numpy.typing.NDArray[numpy.float64], '[2, 1]']]) None
- __setitem__(self: Properties, name: str, value: list[Annotated[numpy.typing.NDArray[numpy.float64], '[3, 1]']]) None
- __setitem__(self: Properties, name: str, value: list[Annotated[numpy.typing.NDArray[numpy.float64], '[4, 1]']]) None
- __setitem__(self: Properties, name: str, value: EnumStringParam) None
- __setitem__(self: Properties, name: str, value: object) None
Function overload documentation:
- __setitem__(self: Properties, name: str, value: bool) None
- __setitem__(self: Properties, name: str, value: int) None
- __setitem__(self: Properties, name: str, value: float) None
- __setitem__(self: Properties, name: str, value: Annotated[numpy.typing.NDArray[numpy.float64], '[3, 3]']) None
- __setitem__(self: Properties, name: str, value: Annotated[numpy.typing.NDArray[numpy.float64], '[4, 4]']) None
- __setitem__(self: Properties, name: str, value: Annotated[numpy.typing.NDArray[numpy.float64], '[3, 4]']) None
- __setitem__(self: Properties, name: str, value: Annotated[numpy.typing.NDArray[numpy.float32], '[3, 3]']) None
- __setitem__(self: Properties, name: str, value: Annotated[numpy.typing.NDArray[numpy.float32], '[4, 4]']) None
- __setitem__(self: Properties, name: str, value: Annotated[numpy.typing.NDArray[numpy.float64], '[2, 1]']) None
- __setitem__(self: Properties, name: str, value: Annotated[numpy.typing.NDArray[numpy.float64], '[3, 1]']) None
- __setitem__(self: Properties, name: str, value: Annotated[numpy.typing.NDArray[numpy.float64], '[4, 1]']) None
- __setitem__(self: Properties, name: str, value: Annotated[numpy.typing.NDArray[numpy.float64], '[5, 1]']) None
- __setitem__(self: Properties, name: str, value: Annotated[numpy.typing.NDArray[numpy.float32], '[2, 1]']) None
- __setitem__(self: Properties, name: str, value: Annotated[numpy.typing.NDArray[numpy.float32], '[3, 1]']) None
- __setitem__(self: Properties, name: str, value: Annotated[numpy.typing.NDArray[numpy.float32], '[4, 1]']) None
- __setitem__(self: Properties, name: str, value: Annotated[numpy.typing.NDArray[numpy.int32], '[2, 1]']) None
- __setitem__(self: Properties, name: str, value: Annotated[numpy.typing.NDArray[numpy.int32], '[3, 1]']) None
- __setitem__(self: Properties, name: str, value: Annotated[numpy.typing.NDArray[numpy.int32], '[4, 1]']) None
- __setitem__(self: Properties, name: str, value: str) None
- __setitem__(self: Properties, name: str, value: Path) None
- __setitem__(self: Properties, name: str, value: list[str]) None
- __setitem__(self: Properties, name: str, value: list[Path]) None
- __setitem__(self: Properties, name: str, value: list[bool]) None
- __setitem__(self: Properties, name: str, value: list[int]) None
- __setitem__(self: Properties, name: str, value: list[float]) None
- __setitem__(self: Properties, name: str, value: list[Annotated[numpy.typing.NDArray[numpy.float64], '[2, 1]']]) None
- __setitem__(self: Properties, name: str, value: list[Annotated[numpy.typing.NDArray[numpy.float64], '[3, 1]']]) None
- __setitem__(self: Properties, name: str, value: list[Annotated[numpy.typing.NDArray[numpy.float64], '[4, 1]']]) None
- __setitem__(self: Properties, name: str, value: EnumStringParam) None
- __setitem__(self: Properties, name: str, value: object) None
- add_sub_properties(self: Properties, name: str) Properties#
- asdict(self: Properties) dict#
Return the Properties as a dict.
The dictionary values have the correct type when they are basic (bool, int, float, str and list), all other param types are returned with a str type. Subproperties are turned into nested dicts.
- clear(self: Properties) None#
- copy_from(self: Properties, arg0: Properties) None#
- get(self: Properties, key: str, default_value: object = None) object#
- get_name(self: Properties) str#
- items(self: Properties) list#
- keys(self: Properties) list#
- static load_from_json(path: str) Properties#
- static load_from_xml(path: str) Properties#
- param(self: Properties, name: str, value: bool) bool#
- param(self: Properties, name: str, value: SupportsInt | SupportsIndex) int
- param(self: Properties, name: str, value: SupportsFloat | SupportsIndex) float
- param(self: Properties, name: str, value: Annotated[numpy.typing.ArrayLike, numpy.float64, '[3, 3]']) Annotated[numpy.typing.NDArray[numpy.float64], '[3, 3]']
- param(self: Properties, name: str, value: Annotated[numpy.typing.ArrayLike, numpy.float64, '[4, 4]']) Annotated[numpy.typing.NDArray[numpy.float64], '[4, 4]']
- param(self: Properties, name: str, value: Annotated[numpy.typing.ArrayLike, numpy.float64, '[3, 4]']) Annotated[numpy.typing.NDArray[numpy.float64], '[3, 4]']
- param(self: Properties, name: str, value: Annotated[numpy.typing.ArrayLike, numpy.float32, '[3, 3]']) Annotated[numpy.typing.NDArray[numpy.float32], '[3, 3]']
- param(self: Properties, name: str, value: Annotated[numpy.typing.ArrayLike, numpy.float32, '[4, 4]']) Annotated[numpy.typing.NDArray[numpy.float32], '[4, 4]']
- param(self: Properties, name: str, value: Annotated[numpy.typing.ArrayLike, numpy.float64, '[2, 1]']) Annotated[numpy.typing.NDArray[numpy.float64], '[2, 1]']
- param(self: Properties, name: str, value: Annotated[numpy.typing.ArrayLike, numpy.float64, '[3, 1]']) Annotated[numpy.typing.NDArray[numpy.float64], '[3, 1]']
- param(self: Properties, name: str, value: Annotated[numpy.typing.ArrayLike, numpy.float64, '[4, 1]']) Annotated[numpy.typing.NDArray[numpy.float64], '[4, 1]']
- param(self: Properties, name: str, value: Annotated[numpy.typing.ArrayLike, numpy.float64, '[5, 1]']) Annotated[numpy.typing.NDArray[numpy.float64], '[5, 1]']
- param(self: Properties, name: str, value: Annotated[numpy.typing.ArrayLike, numpy.float32, '[2, 1]']) Annotated[numpy.typing.NDArray[numpy.float32], '[2, 1]']
- param(self: Properties, name: str, value: Annotated[numpy.typing.ArrayLike, numpy.float32, '[3, 1]']) Annotated[numpy.typing.NDArray[numpy.float32], '[3, 1]']
- param(self: Properties, name: str, value: Annotated[numpy.typing.ArrayLike, numpy.float32, '[4, 1]']) Annotated[numpy.typing.NDArray[numpy.float32], '[4, 1]']
- param(self: Properties, name: str, value: Annotated[numpy.typing.ArrayLike, numpy.int32, '[2, 1]']) Annotated[numpy.typing.NDArray[numpy.int32], '[2, 1]']
- param(self: Properties, name: str, value: Annotated[numpy.typing.ArrayLike, numpy.int32, '[3, 1]']) Annotated[numpy.typing.NDArray[numpy.int32], '[3, 1]']
- param(self: Properties, name: str, value: Annotated[numpy.typing.ArrayLike, numpy.int32, '[4, 1]']) Annotated[numpy.typing.NDArray[numpy.int32], '[4, 1]']
- param(self: Properties, name: str, value: str) str
- param(self: Properties, name: str, value: PathLike | str | bytes) Path
- param(self: Properties, name: str, value: Sequence[str]) list[str]
- param(self: Properties, name: str, value: Sequence[PathLike | str | bytes]) list[Path]
- param(self: Properties, name: str, value: Sequence[bool]) list[bool]
- param(self: Properties, name: str, value: Sequence[SupportsInt | SupportsIndex]) list[int]
- param(self: Properties, name: str, value: Sequence[SupportsFloat | SupportsIndex]) list[float]
- param(self: Properties, name: str, value: Sequence[Annotated[numpy.typing.ArrayLike, numpy.float64, '[2, 1]']]) list[Annotated[numpy.typing.NDArray[numpy.float64], '[2, 1]']]
- param(self: Properties, name: str, value: Sequence[Annotated[numpy.typing.ArrayLike, numpy.float64, '[3, 1]']]) list[Annotated[numpy.typing.NDArray[numpy.float64], '[3, 1]']]
- param(self: Properties, name: str, value: Sequence[Annotated[numpy.typing.ArrayLike, numpy.float64, '[4, 1]']]) list[Annotated[numpy.typing.NDArray[numpy.float64], '[4, 1]']]
- param(self: Properties, name: str, value: EnumStringParam) EnumStringParam
Function overload documentation:
- param(self: Properties, name: str, value: bool) bool
- param(self: Properties, name: str, value: SupportsInt | SupportsIndex) int
- param(self: Properties, name: str, value: SupportsFloat | SupportsIndex) float
- param(self: Properties, name: str, value: Annotated[numpy.typing.ArrayLike, numpy.float64, '[3, 3]']) Annotated[numpy.typing.NDArray[numpy.float64], '[3, 3]']
- param(self: Properties, name: str, value: Annotated[numpy.typing.ArrayLike, numpy.float64, '[4, 4]']) Annotated[numpy.typing.NDArray[numpy.float64], '[4, 4]']
- param(self: Properties, name: str, value: Annotated[numpy.typing.ArrayLike, numpy.float64, '[3, 4]']) Annotated[numpy.typing.NDArray[numpy.float64], '[3, 4]']
- param(self: Properties, name: str, value: Annotated[numpy.typing.ArrayLike, numpy.float32, '[3, 3]']) Annotated[numpy.typing.NDArray[numpy.float32], '[3, 3]']
- param(self: Properties, name: str, value: Annotated[numpy.typing.ArrayLike, numpy.float32, '[4, 4]']) Annotated[numpy.typing.NDArray[numpy.float32], '[4, 4]']
- param(self: Properties, name: str, value: Annotated[numpy.typing.ArrayLike, numpy.float64, '[2, 1]']) Annotated[numpy.typing.NDArray[numpy.float64], '[2, 1]']
- param(self: Properties, name: str, value: Annotated[numpy.typing.ArrayLike, numpy.float64, '[3, 1]']) Annotated[numpy.typing.NDArray[numpy.float64], '[3, 1]']
- param(self: Properties, name: str, value: Annotated[numpy.typing.ArrayLike, numpy.float64, '[4, 1]']) Annotated[numpy.typing.NDArray[numpy.float64], '[4, 1]']
- param(self: Properties, name: str, value: Annotated[numpy.typing.ArrayLike, numpy.float64, '[5, 1]']) Annotated[numpy.typing.NDArray[numpy.float64], '[5, 1]']
- param(self: Properties, name: str, value: Annotated[numpy.typing.ArrayLike, numpy.float32, '[2, 1]']) Annotated[numpy.typing.NDArray[numpy.float32], '[2, 1]']
- param(self: Properties, name: str, value: Annotated[numpy.typing.ArrayLike, numpy.float32, '[3, 1]']) Annotated[numpy.typing.NDArray[numpy.float32], '[3, 1]']
- param(self: Properties, name: str, value: Annotated[numpy.typing.ArrayLike, numpy.float32, '[4, 1]']) Annotated[numpy.typing.NDArray[numpy.float32], '[4, 1]']
- param(self: Properties, name: str, value: Annotated[numpy.typing.ArrayLike, numpy.int32, '[2, 1]']) Annotated[numpy.typing.NDArray[numpy.int32], '[2, 1]']
- param(self: Properties, name: str, value: Annotated[numpy.typing.ArrayLike, numpy.int32, '[3, 1]']) Annotated[numpy.typing.NDArray[numpy.int32], '[3, 1]']
- param(self: Properties, name: str, value: Annotated[numpy.typing.ArrayLike, numpy.int32, '[4, 1]']) Annotated[numpy.typing.NDArray[numpy.int32], '[4, 1]']
- param(self: Properties, name: str, value: str) str
- param(self: Properties, name: str, value: Sequence[SupportsInt | SupportsIndex]) list[int]
- param(self: Properties, name: str, value: Sequence[SupportsFloat | SupportsIndex]) list[float]
- param(self: Properties, name: str, value: Sequence[Annotated[numpy.typing.ArrayLike, numpy.float64, '[2, 1]']]) list[Annotated[numpy.typing.NDArray[numpy.float64], '[2, 1]']]
- param(self: Properties, name: str, value: Sequence[Annotated[numpy.typing.ArrayLike, numpy.float64, '[3, 1]']]) list[Annotated[numpy.typing.NDArray[numpy.float64], '[3, 1]']]
- param(self: Properties, name: str, value: Sequence[Annotated[numpy.typing.ArrayLike, numpy.float64, '[4, 1]']]) list[Annotated[numpy.typing.NDArray[numpy.float64], '[4, 1]']]
- param(self: Properties, name: str, value: EnumStringParam) EnumStringParam
- params(self: Properties) list[str]#
Return a list of all param names.
Params inside sub-properties will be prefixed with the name of the sub-properties (e.g. ‘sub/var’). If
with_sub_paramsis false, only the top-level params are returned.
- remove_param(self: Properties, name: str) bool#
- save_to_json(self: Properties, path: str) None#
- save_to_xml(self: Properties, path: str) None#
- set_name(self: Properties, name: str) None#
- set_param(self: Properties, name: str, value: bool) None#
- set_param(self: Properties, name: str, value: bool, default: bool) None
- set_param(self: Properties, name: str, value: SupportsInt | SupportsIndex) None
- set_param(self: Properties, name: str, value: SupportsInt | SupportsIndex, default: int) None
- set_param(self: Properties, name: str, value: SupportsFloat | SupportsIndex) None
- set_param(self: Properties, name: str, value: SupportsFloat | SupportsIndex, default: float) None
- set_param(self: Properties, name: str, value: Annotated[numpy.typing.ArrayLike, numpy.float64, '[3, 3]']) None
- set_param(self: Properties, name: str, value: Annotated[numpy.typing.ArrayLike, numpy.float64, '[3, 3]'], default: Annotated[numpy.typing.NDArray[numpy.float64], '[3, 3]']) None
- set_param(self: Properties, name: str, value: Annotated[numpy.typing.ArrayLike, numpy.float64, '[4, 4]']) None
- set_param(self: Properties, name: str, value: Annotated[numpy.typing.ArrayLike, numpy.float64, '[4, 4]'], default: Annotated[numpy.typing.NDArray[numpy.float64], '[4, 4]']) None
- set_param(self: Properties, name: str, value: Annotated[numpy.typing.ArrayLike, numpy.float64, '[3, 4]']) None
- set_param(self: Properties, name: str, value: Annotated[numpy.typing.ArrayLike, numpy.float64, '[3, 4]'], default: Annotated[numpy.typing.NDArray[numpy.float64], '[3, 4]']) None
- set_param(self: Properties, name: str, value: Annotated[numpy.typing.ArrayLike, numpy.float32, '[3, 3]']) None
- set_param(self: Properties, name: str, value: Annotated[numpy.typing.ArrayLike, numpy.float32, '[3, 3]'], default: Annotated[numpy.typing.NDArray[numpy.float32], '[3, 3]']) None
- set_param(self: Properties, name: str, value: Annotated[numpy.typing.ArrayLike, numpy.float32, '[4, 4]']) None
- set_param(self: Properties, name: str, value: Annotated[numpy.typing.ArrayLike, numpy.float32, '[4, 4]'], default: Annotated[numpy.typing.NDArray[numpy.float32], '[4, 4]']) None
- set_param(self: Properties, name: str, value: Annotated[numpy.typing.ArrayLike, numpy.float64, '[2, 1]']) None
- set_param(self: Properties, name: str, value: Annotated[numpy.typing.ArrayLike, numpy.float64, '[2, 1]'], default: Annotated[numpy.typing.NDArray[numpy.float64], '[2, 1]']) None
- set_param(self: Properties, name: str, value: Annotated[numpy.typing.ArrayLike, numpy.float64, '[3, 1]']) None
- set_param(self: Properties, name: str, value: Annotated[numpy.typing.ArrayLike, numpy.float64, '[3, 1]'], default: Annotated[numpy.typing.NDArray[numpy.float64], '[3, 1]']) None
- set_param(self: Properties, name: str, value: Annotated[numpy.typing.ArrayLike, numpy.float64, '[4, 1]']) None
- set_param(self: Properties, name: str, value: Annotated[numpy.typing.ArrayLike, numpy.float64, '[4, 1]'], default: Annotated[numpy.typing.NDArray[numpy.float64], '[4, 1]']) None
- set_param(self: Properties, name: str, value: Annotated[numpy.typing.ArrayLike, numpy.float64, '[5, 1]']) None
- set_param(self: Properties, name: str, value: Annotated[numpy.typing.ArrayLike, numpy.float64, '[5, 1]'], default: Annotated[numpy.typing.NDArray[numpy.float64], '[5, 1]']) None
- set_param(self: Properties, name: str, value: Annotated[numpy.typing.ArrayLike, numpy.float32, '[2, 1]']) None
- set_param(self: Properties, name: str, value: Annotated[numpy.typing.ArrayLike, numpy.float32, '[2, 1]'], default: Annotated[numpy.typing.NDArray[numpy.float32], '[2, 1]']) None
- set_param(self: Properties, name: str, value: Annotated[numpy.typing.ArrayLike, numpy.float32, '[3, 1]']) None
- set_param(self: Properties, name: str, value: Annotated[numpy.typing.ArrayLike, numpy.float32, '[3, 1]'], default: Annotated[numpy.typing.NDArray[numpy.float32], '[3, 1]']) None
- set_param(self: Properties, name: str, value: Annotated[numpy.typing.ArrayLike, numpy.float32, '[4, 1]']) None
- set_param(self: Properties, name: str, value: Annotated[numpy.typing.ArrayLike, numpy.float32, '[4, 1]'], default: Annotated[numpy.typing.NDArray[numpy.float32], '[4, 1]']) None
- set_param(self: Properties, name: str, value: Annotated[numpy.typing.ArrayLike, numpy.int32, '[2, 1]']) None
- set_param(self: Properties, name: str, value: Annotated[numpy.typing.ArrayLike, numpy.int32, '[2, 1]'], default: Annotated[numpy.typing.NDArray[numpy.int32], '[2, 1]']) None
- set_param(self: Properties, name: str, value: Annotated[numpy.typing.ArrayLike, numpy.int32, '[3, 1]']) None
- set_param(self: Properties, name: str, value: Annotated[numpy.typing.ArrayLike, numpy.int32, '[3, 1]'], default: Annotated[numpy.typing.NDArray[numpy.int32], '[3, 1]']) None
- set_param(self: Properties, name: str, value: Annotated[numpy.typing.ArrayLike, numpy.int32, '[4, 1]']) None
- set_param(self: Properties, name: str, value: Annotated[numpy.typing.ArrayLike, numpy.int32, '[4, 1]'], default: Annotated[numpy.typing.NDArray[numpy.int32], '[4, 1]']) None
- set_param(self: Properties, name: str, value: str) None
- set_param(self: Properties, name: str, value: str, default: str) None
- set_param(self: Properties, name: str, value: PathLike | str | bytes) None
- set_param(self: Properties, name: str, value: PathLike | str | bytes, default: Path) None
- set_param(self: Properties, name: str, value: Sequence[str]) None
- set_param(self: Properties, name: str, value: Sequence[str], default: list[str]) None
- set_param(self: Properties, name: str, value: Sequence[PathLike | str | bytes]) None
- set_param(self: Properties, name: str, value: Sequence[PathLike | str | bytes], default: list[Path]) None
- set_param(self: Properties, name: str, value: Sequence[bool]) None
- set_param(self: Properties, name: str, value: Sequence[bool], default: list[bool]) None
- set_param(self: Properties, name: str, value: Sequence[SupportsInt | SupportsIndex]) None
- set_param(self: Properties, name: str, value: Sequence[SupportsInt | SupportsIndex], default: list[int]) None
- set_param(self: Properties, name: str, value: Sequence[SupportsFloat | SupportsIndex]) None
- set_param(self: Properties, name: str, value: Sequence[SupportsFloat | SupportsIndex], default: list[float]) None
- set_param(self: Properties, name: str, value: Sequence[Annotated[numpy.typing.ArrayLike, numpy.float64, '[2, 1]']]) None
- set_param(self: Properties, name: str, value: Sequence[Annotated[numpy.typing.ArrayLike, numpy.float64, '[2, 1]']], default: list[Annotated[numpy.typing.NDArray[numpy.float64], '[2, 1]']]) None
- set_param(self: Properties, name: str, value: Sequence[Annotated[numpy.typing.ArrayLike, numpy.float64, '[3, 1]']]) None
- set_param(self: Properties, name: str, value: Sequence[Annotated[numpy.typing.ArrayLike, numpy.float64, '[3, 1]']], default: list[Annotated[numpy.typing.NDArray[numpy.float64], '[3, 1]']]) None
- set_param(self: Properties, name: str, value: Sequence[Annotated[numpy.typing.ArrayLike, numpy.float64, '[4, 1]']]) None
- set_param(self: Properties, name: str, value: Sequence[Annotated[numpy.typing.ArrayLike, numpy.float64, '[4, 1]']], default: list[Annotated[numpy.typing.NDArray[numpy.float64], '[4, 1]']]) None
- set_param(self: Properties, name: str, value: EnumStringParam) None
- set_param(self: Properties, name: str, value: EnumStringParam, default: EnumStringParam) None
Function overload documentation:
- set_param(self: Properties, name: str, value: bool) None
- set_param(self: Properties, name: str, value: bool, default: bool) None
- set_param(self: Properties, name: str, value: SupportsInt | SupportsIndex) None
- set_param(self: Properties, name: str, value: SupportsInt | SupportsIndex, default: int) None
- set_param(self: Properties, name: str, value: SupportsFloat | SupportsIndex) None
- set_param(self: Properties, name: str, value: SupportsFloat | SupportsIndex, default: float) None
- set_param(self: Properties, name: str, value: Annotated[numpy.typing.ArrayLike, numpy.float64, '[3, 3]']) None
- set_param(self: Properties, name: str, value: Annotated[numpy.typing.ArrayLike, numpy.float64, '[3, 3]'], default: Annotated[numpy.typing.NDArray[numpy.float64], '[3, 3]']) None
- set_param(self: Properties, name: str, value: Annotated[numpy.typing.ArrayLike, numpy.float64, '[4, 4]']) None
- set_param(self: Properties, name: str, value: Annotated[numpy.typing.ArrayLike, numpy.float64, '[4, 4]'], default: Annotated[numpy.typing.NDArray[numpy.float64], '[4, 4]']) None
- set_param(self: Properties, name: str, value: Annotated[numpy.typing.ArrayLike, numpy.float64, '[3, 4]']) None
- set_param(self: Properties, name: str, value: Annotated[numpy.typing.ArrayLike, numpy.float64, '[3, 4]'], default: Annotated[numpy.typing.NDArray[numpy.float64], '[3, 4]']) None
- set_param(self: Properties, name: str, value: Annotated[numpy.typing.ArrayLike, numpy.float32, '[3, 3]']) None
- set_param(self: Properties, name: str, value: Annotated[numpy.typing.ArrayLike, numpy.float32, '[3, 3]'], default: Annotated[numpy.typing.NDArray[numpy.float32], '[3, 3]']) None
- set_param(self: Properties, name: str, value: Annotated[numpy.typing.ArrayLike, numpy.float32, '[4, 4]']) None
- set_param(self: Properties, name: str, value: Annotated[numpy.typing.ArrayLike, numpy.float32, '[4, 4]'], default: Annotated[numpy.typing.NDArray[numpy.float32], '[4, 4]']) None
- set_param(self: Properties, name: str, value: Annotated[numpy.typing.ArrayLike, numpy.float64, '[2, 1]']) None
- set_param(self: Properties, name: str, value: Annotated[numpy.typing.ArrayLike, numpy.float64, '[2, 1]'], default: Annotated[numpy.typing.NDArray[numpy.float64], '[2, 1]']) None
- set_param(self: Properties, name: str, value: Annotated[numpy.typing.ArrayLike, numpy.float64, '[3, 1]']) None
- set_param(self: Properties, name: str, value: Annotated[numpy.typing.ArrayLike, numpy.float64, '[3, 1]'], default: Annotated[numpy.typing.NDArray[numpy.float64], '[3, 1]']) None
- set_param(self: Properties, name: str, value: Annotated[numpy.typing.ArrayLike, numpy.float64, '[4, 1]']) None
- set_param(self: Properties, name: str, value: Annotated[numpy.typing.ArrayLike, numpy.float64, '[4, 1]'], default: Annotated[numpy.typing.NDArray[numpy.float64], '[4, 1]']) None
- set_param(self: Properties, name: str, value: Annotated[numpy.typing.ArrayLike, numpy.float64, '[5, 1]']) None
- set_param(self: Properties, name: str, value: Annotated[numpy.typing.ArrayLike, numpy.float64, '[5, 1]'], default: Annotated[numpy.typing.NDArray[numpy.float64], '[5, 1]']) None
- set_param(self: Properties, name: str, value: Annotated[numpy.typing.ArrayLike, numpy.float32, '[2, 1]']) None
- set_param(self: Properties, name: str, value: Annotated[numpy.typing.ArrayLike, numpy.float32, '[2, 1]'], default: Annotated[numpy.typing.NDArray[numpy.float32], '[2, 1]']) None
- set_param(self: Properties, name: str, value: Annotated[numpy.typing.ArrayLike, numpy.float32, '[3, 1]']) None
- set_param(self: Properties, name: str, value: Annotated[numpy.typing.ArrayLike, numpy.float32, '[3, 1]'], default: Annotated[numpy.typing.NDArray[numpy.float32], '[3, 1]']) None
- set_param(self: Properties, name: str, value: Annotated[numpy.typing.ArrayLike, numpy.float32, '[4, 1]']) None
- set_param(self: Properties, name: str, value: Annotated[numpy.typing.ArrayLike, numpy.float32, '[4, 1]'], default: Annotated[numpy.typing.NDArray[numpy.float32], '[4, 1]']) None
- set_param(self: Properties, name: str, value: Annotated[numpy.typing.ArrayLike, numpy.int32, '[2, 1]']) None
- set_param(self: Properties, name: str, value: Annotated[numpy.typing.ArrayLike, numpy.int32, '[2, 1]'], default: Annotated[numpy.typing.NDArray[numpy.int32], '[2, 1]']) None
- set_param(self: Properties, name: str, value: Annotated[numpy.typing.ArrayLike, numpy.int32, '[3, 1]']) None
- set_param(self: Properties, name: str, value: Annotated[numpy.typing.ArrayLike, numpy.int32, '[3, 1]'], default: Annotated[numpy.typing.NDArray[numpy.int32], '[3, 1]']) None
- set_param(self: Properties, name: str, value: Annotated[numpy.typing.ArrayLike, numpy.int32, '[4, 1]']) None
- set_param(self: Properties, name: str, value: Annotated[numpy.typing.ArrayLike, numpy.int32, '[4, 1]'], default: Annotated[numpy.typing.NDArray[numpy.int32], '[4, 1]']) None
- set_param(self: Properties, name: str, value: str) None
- set_param(self: Properties, name: str, value: str, default: str) None
- set_param(self: Properties, name: str, value: Sequence[str]) None
- set_param(self: Properties, name: str, value: Sequence[PathLike | str | bytes], default: list[Path]) None
- set_param(self: Properties, name: str, value: Sequence[bool]) None
- set_param(self: Properties, name: str, value: Sequence[SupportsInt | SupportsIndex]) None
- set_param(self: Properties, name: str, value: Sequence[SupportsInt | SupportsIndex], default: list[int]) None
- set_param(self: Properties, name: str, value: Sequence[SupportsFloat | SupportsIndex]) None
- set_param(self: Properties, name: str, value: Sequence[SupportsFloat | SupportsIndex], default: list[float]) None
- set_param(self: Properties, name: str, value: Sequence[Annotated[numpy.typing.ArrayLike, numpy.float64, '[2, 1]']]) None
- set_param(self: Properties, name: str, value: Sequence[Annotated[numpy.typing.ArrayLike, numpy.float64, '[2, 1]']], default: list[Annotated[numpy.typing.NDArray[numpy.float64], '[2, 1]']]) None
- set_param(self: Properties, name: str, value: Sequence[Annotated[numpy.typing.ArrayLike, numpy.float64, '[3, 1]']]) None
- set_param(self: Properties, name: str, value: Sequence[Annotated[numpy.typing.ArrayLike, numpy.float64, '[3, 1]']], default: list[Annotated[numpy.typing.NDArray[numpy.float64], '[3, 1]']]) None
- set_param(self: Properties, name: str, value: Sequence[Annotated[numpy.typing.ArrayLike, numpy.float64, '[4, 1]']]) None
- set_param(self: Properties, name: str, value: Sequence[Annotated[numpy.typing.ArrayLike, numpy.float64, '[4, 1]']], default: list[Annotated[numpy.typing.NDArray[numpy.float64], '[4, 1]']]) None
- set_param(self: Properties, name: str, value: EnumStringParam) None
- set_param(self: Properties, name: str, value: EnumStringParam, default: EnumStringParam) None
- set_param_attributes(self: Properties, name: str, attributes: str) None#
- sub_properties(self: Properties, name: str, create_if_doesnt_exist: bool = False) Properties#
- sub_properties(self: Properties) list[Properties]
Function overload documentation:
- sub_properties(self: Properties, name: str, create_if_doesnt_exist: bool = False) Properties
- sub_properties(self: Properties) list[Properties]
- sub_properties_all(self: Properties, name: str) list#
- values(self: Properties) list#
- class imfusion.PyPointsIterator#
Bases:
pybind11_object- __iter__(self: PyPointsIterator) PyPointsIterator#
- __next__(self: PyPointsIterator) PyPointsOnImagePoint#
- class imfusion.PyPointsOnImagePoint#
Bases:
pybind11_object- property image_position#
Gets/sets the image position of a point.
- Type:
Annotated[numpy.typing.NDArray[numpy.float64], ”[3, 1]”]
- property selected#
Gets/sets whether a point is selected. By default all points are selected.
- Type:
- class imfusion.ReductionMode(value, names=<not given>, *values, module=None, qualname=None, type=None, start=1, boundary=None)#
Bases:
Enum- AVERAGE = 1#
- LOOKUP = 0#
- MAXIMUM = 3#
- MINIMUM = 2#
- class imfusion.ReferenceImageDataComponent#
Bases:
DataComponentBaseData component used to store a reference image. The reference image is used to keep track of the input of a processing pipeline or a machine learning model, and can be used to set the correct image descriptor for the output of the pipeline.
- property reference#
- Type:
- class imfusion.RegionOfInterest(self: RegionOfInterest, offset: Annotated[numpy.typing.ArrayLike, numpy.int32, '[3, 1]'], size: Annotated[numpy.typing.ArrayLike, numpy.int32, '[3, 1]'])#
Bases:
pybind11_objectClass representing a rectangular region of interest (ROI) in an image.
The ROI is defined by an offset (starting position) and a size (dimensions).
- Parameters:
offset – Starting position of the ROI as a 3D vector (x, y, z) in voxel coordinates
size – Size of the ROI as a 3D vector (width, height, depth) in voxels
- class imfusion.Selection(*args, **kwargs)#
Bases:
ConfigurableUtility class for describing a selection of elements out of a set. Conceptually, a Selection pairs a list of bools describing selected items with the index of a “focus” item and provides syntactic sugar on top. For instance, the set of selected items could define which ones to show in general while the focus item is additionally highlighted. The class is fully separate from the item set of which it describes the selection. This means for instance that it cannot know the actual number of items in the set and the user/parent class must manually make sure that they match. Also, a Selection only manages indices and offers no way of accessing the underlying elements. In order to iterate over all selected indices, you can do for instance the following:
>>> for index in range(selection.start, selection.stop): ... if selection[index]: ... pass
The same effect can also be achieved in a much more terse fashion:
>>> for selected_index in selection.selected_indices: ... pass
For convenience, the selection can also be converted to a slice object (if the selection has a regular spacing, see below):
>>> selected_subset = container[selection.to_slice()]
Sometimes it can be more convenient to “thin out” a selection by only selecting every N-th element. To this end, the Selection constructor takes the arguments
start,stopandstep. Settingstepto N will only select every N-th element, mimicking the signature ofrange,slice, etc.Function overload documentation:
- __init__(self: Selection, stop: SupportsInt | SupportsIndex) None
- __init__(self: Selection, start: SupportsInt | SupportsIndex, stop: SupportsInt | SupportsIndex, step: SupportsInt | SupportsIndex = 1) None
- __init__(self: Selection, indices: Sequence[SupportsInt | SupportsIndex]) None
- class NonePolicy(value, names=<not given>, *values, module=None, qualname=None, type=None, start=1, boundary=None)#
Bases:
Enum- ALL = 2#
- EMPTY = 0#
- FOCUS = 1#
- __getitem__(self: Selection, index: SupportsInt | SupportsIndex) bool#
- __setitem__(self: Selection, index: SupportsInt | SupportsIndex, selected: bool) None#
- clamp(self: Selection, last_selected_index: SupportsInt | SupportsIndex) None#
- is_selected(self: Selection, index: SupportsInt | SupportsIndex, none_policy: NonePolicy) bool#
- select_only(self: Selection, index: SupportsInt | SupportsIndex) None#
- select_up_to(self: Selection, stop: SupportsInt | SupportsIndex) None#
- set_first_last_skip(self: Selection, arg0: SupportsInt | SupportsIndex, arg1: SupportsInt | SupportsIndex, arg2: SupportsInt | SupportsIndex) None#
- ALL = 2#
- EMPTY = 0#
- FOCUS = 1#
Bases:
pybind11_objectA
SharedImageinstance represents an image that resides in different memory locations, i.e. in CPU memory or GPU memory.A
SharedImagecan be directly converted from and to a numpy array:>>> img = imfusion.SharedImage(np.ones([10, 10, 1], dtype='uint8')) >>> arr = np.array(img)
See
MemImagefor details.Function overload documentation:
- __init__(self: SharedImage, mem_image: MemImage) None
- __init__(self: SharedImage, desc: ImageDescriptor) None
- __init__(self: SharedImage, desc: ImageDescriptorWorld) None
- __init__(self: SharedImage, type: PixelType, width: SupportsInt | SupportsIndex, height: SupportsInt | SupportsIndex, slices: SupportsInt | SupportsIndex = 1, channels: SupportsInt | SupportsIndex = 1) None
- __init__(self: SharedImage, array: Annotated[numpy.typing.ArrayLike, numpy.int8], greyscale: bool = False) None
- __init__(self: SharedImage, array: Annotated[numpy.typing.ArrayLike, numpy.uint8], greyscale: bool = False) None
- __init__(self: SharedImage, array: Annotated[numpy.typing.ArrayLike, numpy.int16], greyscale: bool = False) None
- __init__(self: SharedImage, array: Annotated[numpy.typing.ArrayLike, numpy.uint16], greyscale: bool = False) None
- __init__(self: SharedImage, array: Annotated[numpy.typing.ArrayLike, numpy.int32], greyscale: bool = False) None
- __init__(self: SharedImage, array: Annotated[numpy.typing.ArrayLike, numpy.uint32], greyscale: bool = False) None
- __init__(self: SharedImage, array: Annotated[numpy.typing.ArrayLike, numpy.float32], greyscale: bool = False) None
- __init__(self: SharedImage, array: Annotated[numpy.typing.ArrayLike, numpy.float64], greyscale: bool = False) None
Returns True if all pixels / voxels is non-zero
Returns True if at least one pixel / voxel is non-zero
Return a copy of the array with storage values converted to original values. The dtype of the returned array is always DOUBLE.
Return a list of the indices of maximum values, channel-wise. The indices are represented as (x, y, z, image index).
- Returns:
List of indices (x, y, z, image index) returned as a list of numpy arrays.
Return a list of the indices of minimum values, channel-wise. The indices are represented as (x, y, z, image index).
- Returns:
List of indices (x, y, z, image index) returned as a list of numpy arrays.
Copies the contents of arr to the SharedImage. Automatically calls setDirtyMem.
The casting parameters behaves like numpy.copyto.
Create a copy of the current SharedImage instance with the requested Image format.
This function accepts either: - a PixelType (e.g. imfusion.PixelType.UInt); - most of the numpy’s dtypes (e.g. np.uint); - python’s float or int types.
If the requested PixelType already matches the PixelType of the provided SharedImage, then a clone of the current instance is returned.
Reorders the channels of an image based on the input indices, e.g.
indices[0]will correspond to the first channel of the output image.- Parameters:
indices – List of channel indices to swizzle the channels of the input.
- Returns:
SharedImageinstance with reordered channels.
Clear representations that are not CPU memory
Return the list of the maximum elements of images, channel-wise.
- Returns:
Channel-wise values returned as a numpy array.
Return a list of channel-wise average of image elements.
- Returns:
Channel-wise values returned as a numpy array.
Return the list of the minimum elements of images, channel-wise.
- Returns:
Channel-wise values returned as a numpy array.
Returns the norm of an image instance, channel-wise.
- Parameters:
order – Order of the norm. Use a number (e.g., 1 or 2) or ‘inf’. The default is the L2 norm.
- Returns:
Norm values per channel returned as a numpy array.
Convenience method for converting a MemImage or a SharedImage into a newly created numpy array with scale and shift already applied.
Shift and scale may determine a complex change of pixel type prior the conversion into numpy array:
as a first rule, even if the type of shift and scale is float, they will still be considered as integers if they are representing integers (e.g. a shift of 2.000 will be treated as 2);
if shift and scale are such that the pixel values range (determined by the pixel_type) would not be fitting into the pixel_type, e.g. a negative pixel value but the type is unsigned, then the pixel_type will be promoted into a signed type if possible, otherwise into a single precision floating point type;
if shift and scale are such that the pixel values range (determined by the pixel_type) would be fitting into a demoted pixel_type, e.g. the type is signed but the range of pixel values is unsigned, then the pixel_type will be demoted;
if shift and scale do not certainly determine that all the possible pixel values (in the range determined by the pixel_type) would become integers, then the pixel_type will be promoted into a single precision floating point type.
in any case, the returned numpy array will be returned with type up to 32-bit integers. If the integer type would require more bits, then the resulting pixel_type will be DOUBLE.
- Parameters:
self – instance of a MemImage or of a SharedImage
- Returns:
numpy.ndarray
- Prepare the image:
Integral types are converted to unsigned representation if applicable, double-precision will be converted to single-precision float. Furthermore, if shift_only is False it will rescale the present intensity range to [0..1] for floating point types or to the entire available value range for integral types.
Return a list of channel-wise production of image elements.
- Returns:
Channel-wise values returned as a numpy array.
Return a list of channel-wise sum of image elements.
- Returns:
Channel-wise values returned as a numpy array.
Convert SharedImageSet or a SharedImage to a torch.Tensor.
- Parameters:
self (DataElement | SharedImageSet | SharedImage) – Instance of SharedImageSet or SharedImage (this function bound as a method to SharedImageSet and SharedImage)
device (device) – Target device for the new torch.Tensor
dtype (dtype) – Type of the new torch.Tensor
same_as (Tensor) – Template tensor whose device and dtype configuration should be matched.
deviceanddtypeare still applied afterwards.
- Returns:
New torch.Tensor
- Return type:
- Type:
- Type:
Read-only descriptor view of this image.
- Type:
Read-only world descriptor view of this image.
- Type:
Annotated[numpy.typing.NDArray[numpy.float64], ”[3, 1]”]
- Type:
- Type:
Annotated[numpy.typing.NDArray[numpy.float64], ”[4, 4]”]
- Type:
- Type:
- Type:
- Type:
- Type:
- Type:
Annotated[numpy.typing.NDArray[numpy.float64], ”[4, 4]”]
- Type:
Numpy compatible shape describing the dimensions of this image, stored as a namedtuple.
- Returns:
Named tuple with
slices,height,width, andchannelsattributes.- Return type:
(collections.namedtuple)
- Type:
- Type:
- Type:
Physical extent of each voxel in [mm] stored as a namedtuple. Spacing for a specific dimension can be accessed via
x,y, andzattributes.- Returns:
Named tuple with
x,y, andzattributes.- Return type:
(collections.namedtuple)
- Type:
- Type:
- Type:
Annotated[numpy.typing.NDArray[numpy.float64], ”[4, 4]”]
- Type:
Annotated[numpy.typing.NDArray[numpy.float64], ”[4, 4]”]
Bases:
DataRe-exported from
imfusion.data.SharedImageSet.
- class imfusion.SkippingMask(self: SkippingMask, shape: Annotated[numpy.typing.ArrayLike, numpy.int32, '[3, 1]'], skip: Annotated[numpy.typing.ArrayLike, numpy.int32, '[3, 1]'])#
Bases:
MaskBasic mask where only every N-th pixel is considered inside.
- class imfusion.SpacingMode(value, names=<not given>, *values, module=None, qualname=None, type=None, start=1, boundary=None)#
Bases:
Enum- ADJUST = 1#
- EXACT = 0#
Bases:
SharedImageSetRe-exported from
imfusion.data.TrackedSharedImageSet.
- class imfusion.TrackerID(*args, **kwargs)#
Bases:
pybind11_objectFunction overload documentation:
- class imfusion.TrackingSequence(self: TrackingSequence, name: str = '')#
Bases:
DataRe-exported from
imfusion.data.TrackingSequence.
- imfusion.algorithm_properties(id: str, data: list) object#
Returns the default properties of the given algorithm. This is useful to figure out what properties are supported by an algorithm.
Deprecated since version 0.12.0: Use
imfusion.algorithm.get_properties()instead.
- imfusion.auto_window(image: SharedImageSet, change2d: bool = True, change3d: bool = True, lower_limit: SupportsFloat | SupportsIndex = 0.0, upper_limit: SupportsFloat | SupportsIndex = 0.0) None#
Update window/level of input image to show the entire intensity range of the image.
- Parameters:
image (SharedImageSet) – Image to change the windowing for.
change2d (bool) – Flag whether update the DisplayOptions2d attached to a img.
change3d (bool) – Flag whether update the DisplayOptions3d attached to a img.
lower_limit (double) – Ratio of lower values removed by the auto windowing.
upper_limit (double) – Ratio of upper values removed by the auto windowing.
- imfusion.available_algorithms(sub_string: str = '', case_sensitive: bool = False) object#
Return a list of all available algorithm ids.
Optionally, a substring can be given to filter the list (case-insensitive by default).
Deprecated since version 0.12.0: Use
imfusion.algorithm.list_available()instead.
- imfusion.create_algorithm(id: str, data: list = [], properties: Properties = None) object#
Create the algorithm with the given id without executing it.
The algorithm will only be created if it is compatible with the given data. The optional
Propertiesobject will be used to configure the algorithm.Deprecated since version 0.12.0: Use
imfusion.algorithm.create()instead.
- imfusion.execute_algorithm(id: str, data: list = [], properties: Properties = None) object#
Execute the algorithm with the given id and return its output.
The algorithm will only be executed if it is compatible with the given data. The optional
Propertiesobject will be used to configure the algorithm before executing it.Deprecated since version 0.12.0: Use
imfusion.algorithm.execute()instead.
- imfusion.gpu_info() str | None#
Return string with information about GPU to check if hardware support for OpenGL is available.
- imfusion.info(*, show_license_key: bool = False) FrameworkInfo#
Provides general information about the framework.
- imfusion.is_compatible_imfusion_plugin(path: PathLike | str | bytes) bool#
Returns True if the given plugin is compatible, False otherwise.
- imfusion.load_plugin(path: PathLike | str | bytes) str#
Load a single ImFusionLib plugin from the given file. WARNING: This might execute arbitary code. Only use with trusted files!
- imfusion.load_plugins(folder: PathLike | str | bytes) None#
Loads all ImFusionLib plugins from the given folder. WARNING: This might execute arbitary code. Only use with trusted folders!
- imfusion.save(object: object, path: PathLike | str | bytes) object#
- imfusion.save(image: SharedImageSet, path: PathLike | str | bytes, **kwargs) object
Function overload documentation:
- imfusion.save(object: object, path: PathLike | str | bytes) object
Deprecation alias for
imfusion.io.save().
- imfusion.save(image: SharedImageSet, path: PathLike | str | bytes, **kwargs) object
Deprecation alias for
imfusion.io.save().
- imfusion.show(*args, **kwargs)#
Re-exported from
imfusion.gui.show().