imfusion.data.components#
Submodule for data components.
- class imfusion.data.components.DataComponentBase#
Bases:
Configurable
- class imfusion.data.components.DataComponentList#
Bases:
pybind11_objectA list of DataComponent. The list contains properties for specific DataComponent types. Each DataComponent type can only occur once.
- __getitem__(self: DataComponentList, index: SupportsInt | SupportsIndex) object#
- __getitem__(self: DataComponentList, indices: Sequence[SupportsInt | SupportsIndex]) list[object]
- __getitem__(self: DataComponentList, slice: slice) list[object]
- __getitem__(self: DataComponentList, id: str) object
Function overload documentation:
- __getitem__(self: DataComponentList, index: SupportsInt | SupportsIndex) object
- __getitem__(self: DataComponentList, indices: Sequence[SupportsInt | SupportsIndex]) list[object]
- __getitem__(self: DataComponentList, slice: slice) list[object]
- __getitem__(self: DataComponentList, id: str) object
- add(self: DataComponentList, component: TDataComponentBound) TDataComponentBound#
- add(self: DataComponentList, arg0: CameraCalibrationDataComponent) DataComponentBase
- add(self: DataComponentList, arg0: StereoCalibrationDataComponent) DataComponentBase
- add(self: DataComponentList, arg0: FrameGeometryMetadata) DataComponentBase
- add(self: DataComponentList, arg0: UltrasoundMetadata) DataComponentBase
- add(self: DataComponentList, arg0: ASCDisplayOptions) DataComponentBase
- add(self: DataComponentList, arg0: GeneralEquipmentModuleDataComponent) DataComponentBase
- add(self: DataComponentList, arg0: SourceInfoComponent) DataComponentBase
- add(self: DataComponentList, arg0: ReferencedInstancesComponent) DataComponentBase
- add(self: DataComponentList, arg0: RTStructureDataComponent) DataComponentBase
- add(self: DataComponentList, arg0: PulseEchoEvent) DataComponentBase
- add(self: DataComponentList, arg0: FrameAcquisition) DataComponentBase
- add(self: DataComponentList, arg0: Transducer) DataComponentBase
- add(self: DataComponentList, arg0: ChannelDataLayout) DataComponentBase
- add(self: DataComponentList, arg0: BeamformingRois) DataComponentBase
- add(self: DataComponentList, arg0: TargetTag) DataComponentBase
- add(self: DataComponentList, arg0: ProcessingRecordComponent) DataComponentBase
- add(self: DataComponentList, arg0: ReferenceImageDataComponent) DataComponentBase
- add(self: DataComponentList, arg0: PatchesFromImageDataComponent) DataComponentBase
- add(self: DataComponentList, arg0: InversionComponent) DataComponentBase
Function overload documentation:
- add(self: DataComponentList, component: TDataComponentBound) TDataComponentBound
Adds the component to the component list and returns the stored component.
- add(self: DataComponentList, arg0: CameraCalibrationDataComponent) DataComponentBase
Adds a copy of the component to the component list and returns a reference to the copy.
- add(self: DataComponentList, arg0: StereoCalibrationDataComponent) DataComponentBase
Adds a copy of the component to the component list and returns a reference to the copy.
- add(self: DataComponentList, arg0: FrameGeometryMetadata) DataComponentBase
Adds a copy of the component to the component list and returns a reference to the copy.
- add(self: DataComponentList, arg0: UltrasoundMetadata) DataComponentBase
Adds a copy of the component to the component list and returns a reference to the copy.
- add(self: DataComponentList, arg0: ASCDisplayOptions) DataComponentBase
Adds a copy of the component to the component list and returns a reference to the copy.
- add(self: DataComponentList, arg0: GeneralEquipmentModuleDataComponent) DataComponentBase
Adds a copy of the component to the component list and returns a reference to the copy.
- add(self: DataComponentList, arg0: SourceInfoComponent) DataComponentBase
Adds a copy of the component to the component list and returns a reference to the copy.
- add(self: DataComponentList, arg0: ReferencedInstancesComponent) DataComponentBase
Adds a copy of the component to the component list and returns a reference to the copy.
- add(self: DataComponentList, arg0: RTStructureDataComponent) DataComponentBase
Adds a copy of the component to the component list and returns a reference to the copy.
- add(self: DataComponentList, arg0: PulseEchoEvent) DataComponentBase
Adds a copy of the component to the component list and returns a reference to the copy.
- add(self: DataComponentList, arg0: FrameAcquisition) DataComponentBase
Adds a copy of the component to the component list and returns a reference to the copy.
- add(self: DataComponentList, arg0: Transducer) DataComponentBase
Adds a copy of the component to the component list and returns a reference to the copy.
- add(self: DataComponentList, arg0: ChannelDataLayout) DataComponentBase
Adds a copy of the component to the component list and returns a reference to the copy.
- add(self: DataComponentList, arg0: BeamformingRois) DataComponentBase
Adds a copy of the component to the component list and returns a reference to the copy.
- add(self: DataComponentList, arg0: TargetTag) DataComponentBase
Adds a copy of the component to the component list and returns a reference to the copy.
- add(self: DataComponentList, arg0: ProcessingRecordComponent) DataComponentBase
Adds a copy of the component to the component list and returns a reference to the copy.
- add(self: DataComponentList, arg0: ReferenceImageDataComponent) DataComponentBase
Adds a copy of the component to the component list and returns a reference to the copy.
- add(self: DataComponentList, arg0: PatchesFromImageDataComponent) DataComponentBase
Adds a copy of the component to the component list and returns a reference to the copy.
- add(self: DataComponentList, arg0: InversionComponent) DataComponentBase
Adds a copy of the component to the component list and returns a reference to the copy.
- property asc_display_options#
- Type:
- property beamforming_rois#
- Type:
- property camera_calibration#
- property channel_data_layout#
- Type:
- property data_source#
- Type:
- property dataset_license#
- Type:
- property display_options_2d#
- Type:
- property display_options_3d#
- Type:
- property frame_acquisition#
- Type:
- property frame_geometry_metadata#
- Type:
- property general_equipment_module#
- property image_info#
- Type:
- property inversion#
- Type:
- property label#
- Type:
- property patches_from_image#
- property processing_record#
- property pulse_echo_event#
- Type:
- property real_world_mapping#
- property reference_image#
- property referenced_instances#
- property rt_structure#
- Type:
- property source_info#
- Type:
- property stereo_calibration#
- property transducer#
- Type:
- property transformation_stash#
- property ultrasound_metadata#
- Type:
- class imfusion.data.components.DataSourceComponent#
Bases:
DataComponentBase- class DataSourceInfo(self: DataSourceInfo, arg0: str, arg1: str, arg2: Properties, arg3: SupportsInt | SupportsIndex, arg4: Sequence[DataSourceInfo])#
Bases:
Configurable- update(self: DataSourceInfo, arg0: DataSourceInfo) None#
- property history#
- Type:
- property io_algorithm_config#
- Type:
- property sources#
- Type:
- class imfusion.data.components.DatasetLicenseComponent(*args, **kwargs)#
Bases:
DataComponentBaseFunction overload documentation:
- __init__(self: DatasetLicenseComponent) None
- __init__(self: DatasetLicenseComponent, infos: Sequence[DatasetInfo]) None
- class DatasetInfo(*args, **kwargs)#
Bases:
pybind11_objectFunction overload documentation:
- __init__(self: DatasetInfo) None
- infos(self: DatasetLicenseComponent) list[DatasetInfo]#
- class imfusion.data.components.DisplayOptions2d(self: DisplayOptions2d, arg0: Data)#
Bases:
DataComponentBase
- class imfusion.data.components.DisplayOptions3d(self: DisplayOptions3d, arg0: Data)#
Bases:
DataComponentBase
- class imfusion.data.components.ImageInfoDataComponent(self: ImageInfoDataComponent)#
Bases:
DataComponentBaseDataComponent storing general information on the image origin.
Modeled after the DICOM patient-study-series hierarchy, it stores information on the patient, study and series the data set belongs to.
- class AnatomicalOrientationType(value, names=<not given>, *values, module=None, qualname=None, type=None, start=1, boundary=None)#
Bases:
EnumThe anatomical orientation type used in Instances generated by this equipment.
- BIPED = 1#
- QUADRUPED = 2#
- UNKNOWN = 0#
- class Laterality(value, names=<not given>, *values, module=None, qualname=None, type=None, start=1, boundary=None)#
Bases:
EnumLaterality of (paired) body part examined
- LEFT = 1#
- RIGHT = 2#
- UNKNOWN = 0#
- class PatientSex(value, names=<not given>, *values, module=None, qualname=None, type=None, start=1, boundary=None)#
Bases:
EnumGender of the patient
- FEMALE = 2#
- MALE = 1#
- OTHER = 3#
- UNKNOWN = 0#
- property frame_of_reference_uid#
Uniquely identifies the Frame of Reference for a Series. Multiple Series within a Study may share a Frame of Reference UID.
- Type:
- property laterality#
Laterality of (paired) body part examined
- Type:
- property orientation_type#
DICOM Anatomical Orientation Type
- property patient_position#
Specifies position of the Patient relative to the imaging equipment.
- Type:
- property patient_sex#
Patient sex
- Type:
- property photometric_interpretation#
Specifies the intended interpretation of the pixel data (e.g. RGB, HSV, …).
- Type:
- property responsible_person#
Name of person with medical or welfare decision making authority for the Patient.
- Type:
- property series_number#
DICOM Series number. The value of this attribute should be unique for all Series in a Study created on the same equipment.
- Type:
- property series_time_exact#
Series time in microseconds. 0 if the original series time was empty.
- Type:
- property study_time_exact#
Study time in microseconds. 0 if the original study time was empty.
- Type:
- class imfusion.data.components.LabelDataComponent(self: LabelDataComponent, label_map: SharedImageSet = None)#
Bases:
DataComponentBaseStores metadata for a label map, supporting up to 255 labels.
Creates a LabelDataComponent. If a label map of type uint8 is provided, detects labels in the label map.
- class LabelConfig(self: LabelConfig, name: str = '', color: Annotated[numpy.typing.ArrayLike, numpy.float64, '[4, 1]'] = array([0., 0., 0., 0.]), is_visible2d: bool = True, is_visible3d: bool = True)#
Bases:
pybind11_objectEncapsulates metadata for a label value in a label map.
Constructor for LabelConfig.
- Parameters:
name – Name of the label.
color – RGBA color used for rendering the label.
is_visible2d – Visibility flag for 2D/MPR views.
is_visible3d – Visibility flag for 3D views.
- property color#
RGBA color used for rendering the label. Values should be in the range [0, 1].
- Type:
Annotated[numpy.typing.NDArray[numpy.float64], ”[4, 1]”]
- property segmentation_algorithm_name#
Name of the algorithm used to generate the segmentation.
- Type:
- property segmentation_algorithm_type#
Type of algorithm used to generate the segmentation.
- property snomed_category_code_value#
SNOMED CT code for the category this label represents.
- Type:
- class SegmentationAlgorithmType(value, names=<not given>, *values, module=None, qualname=None, type=None, start=1, boundary=None)#
Bases:
Enum- AUTOMATIC = 1#
- MANUAL = 3#
- SEMI_AUTOMATIC = 2#
- UNKNOWN = 0#
- detect_labels(self: LabelDataComponent, image: SharedImageSet) None#
Detects labels present in an image of type uint8 and creates configurations for non-existing labels using default configurations.
- has_label(self: LabelDataComponent, pixel_value: SupportsInt | SupportsIndex) bool#
Checks if a label configuration exists for a pixel value.
- label_config(self: LabelDataComponent, pixel_value: SupportsInt | SupportsIndex) LabelConfig | None#
Gets label configuration for a pixel value.
- label_configs(self: LabelDataComponent) dict[int, LabelConfig]#
Returns known label configurations.
- remove_label(self: LabelDataComponent, pixel_value: SupportsInt | SupportsIndex) None#
Removes label configuration for a pixel value.
- remove_unused_labels(self: LabelDataComponent, image: SharedImageSet) None#
Removes configurations for non-existing labels in an image.
- set_default_label_config(self: LabelDataComponent, pixel_value: SupportsInt | SupportsIndex) None#
Sets default label configuration for a pixel value.
- set_label_config(self: LabelDataComponent, pixel_value: SupportsInt | SupportsIndex, config: LabelConfig) None#
Sets label configuration for a pixel value.
- set_label_configs(self: LabelDataComponent, configs: Mapping[SupportsInt | SupportsIndex, LabelConfig]) None#
Sets known label configurations from a dictionary mapping pixel values to LabelConfig objects.
- AUTOMATIC = 1#
- MANUAL = 3#
- SEMI_AUTOMATIC = 2#
- UNKNOWN = 0#
- class imfusion.data.components.RealWorldMappingDataComponent(self: RealWorldMappingDataComponent)#
Bases:
DataComponentBase- class Mapping(self: Mapping)#
Bases:
pybind11_object- original_to_real_world(self: Mapping, value: SupportsFloat | SupportsIndex) float#
- storage_to_real_world(self: Mapping, image_descriptor: ImageDescriptor, value: SupportsFloat | SupportsIndex) float#
- property type#
- Type:
- class MappingType(value, names=<not given>, *values, module=None, qualname=None, type=None, start=1, boundary=None)#
Bases:
Enum- REAL_WORLD_VALUES = 0#
- STANDARDIZED_UPTAKE_VALUES = 1#
- REAL_WORLD_VALUES = 0#
- STANDARDIZED_UPTAKE_VALUES = 1#
- class imfusion.data.components.TransformationStashDataComponent(self: TransformationStashDataComponent)#
Bases:
DataComponentBase
- class imfusion.data.components.VitalsDataComponent#
Bases:
DataComponentBaseDataComponent for storing a collection of time dependent vital signs like ECG, heart rate or pulse oximeter measurements.
- class VitalsKind(value, names=<not given>, *values, module=None, qualname=None, type=None, start=1, boundary=None)#
Bases:
Enum- ECG = 0#
- HEARTH_RATE = 2#
- OTHER = 3#
- PULSE_OXIMETER = 1#
- class VitalsTimeSeries#
Bases:
pybind11_object
- __getitem__(self: VitalsDataComponent, kind: VitalsKind) list[VitalsTimeSeries]#
- ECG = 0#
- HEARTH_RATE = 2#
- OTHER = 3#
- PULSE_OXIMETER = 1#
- property kinds#
- Type:
- imfusion.data.components.create(id: str, properties: Properties = None) object#
Instantiates a DataComponent specified by the given ID.
- Parameters:
id – Unique ID of the DataComponent to create.
properties – Optional Properties object. If not None, it will used to configure the newly created DataComponent.
- imfusion.data.components.field(*, serializer: Callable[[TValueType], str] | None = None, deserializer: Callable[[str], TValueType] | None = None) TValueType#
Create a serializable field descriptor for a Python data component.
Values are stored in a per-instance
imfusion.Propertiesobject. As a result, assigned values are directly validated to ensure they can be stored in :class:imfusion.Properties.Noneis a valid value, distinct from a field being unset. Accessing an unset field raisesAttributeError.Optional
serializeranddeserializercallbacks allow storing types thatPropertiesdoes not natively support (e.g. dicts via JSON). The serializer must return astr. Both must be provided together.Default field values can be assigned in
__init__.Example:
>>> @imfusion.data.components.register(name="my_component")
… class MyComponent: … value: int = imfusion.data.components.field() … … def __init__(self, value=42): … self.value = value
- imfusion.data.components.list_available() list[str]#
Returns the Unique IDs of all DataComponents registered in DataComponentFactory.
- imfusion.data.components.register(*, name: str) Callable[[type[TPyDataComponent]], type[TPyDataComponent]]#
Decorator for registering a Python data component.
The
nameis used as both the factory ID (seecreate()) and named attribute onDataComponentList.Attributes of the component can be defined using
field(). Field values are stored internally in animfusion.Propertiesobject. Types not natively supported byimfusion.Propertiescan be supported using the serialization options provided byfield().The decorated class must be constructible without arguments. Default field values can be assigned in
__init__using default arguments.The decorator injects the following into the registered class to conform to the ImFusion data component interface:
id(str) andname(str): the registration name.configure(properties): applies field values from aPropertiesobject (partial update).configuration(): returns the current field values as aPropertiesobject.
Defining any of the above in the class body raises
TypeErrorat registration time.If
__eq__or__repr__are not defined, field-based implementations are generated automatically. Generated equality compares only attributes declared withfield(). Other instance attributes are ignored. Define__eq__explicitly if those attributes must participate in equality. User-defined versions are preserved.For static type-checker support, the class may optionally inherit from
imfusion.data.components.typing.PyDataComponent. This is not required at runtime. Its sole purpose is to declare the injected methods and attributes for static type checking.Example:
>>> @imfusion.data.components.register(name="my_component") ... class MyComponent(imfusion.data.components.typing.PyDataComponent): # Optional typing base class ... value: int = imfusion.data.components.field() ... ... def __init__(self, value: int = 42): ... self.value = value