medkit.core.attribute_container#

Classes:

AttributeContainer(ann_id)

Manage a list of attributes attached to an annotation.

class AttributeContainer(ann_id)[source]#

Manage a list of attributes attached to an annotation.

This behaves more or less like a list: calling len() and iterating are supported. Additional filtering is available through the get() method.

The attributes will be stored in a Store, which can rely on a simple dict or something more complicated like a database.

This global store may be initialized using :class:~medkit.core.GlobalStore. Otherwise, a default one (i.e. dict store) is used.

Methods:

add(attr)

Attach an attribute to the annotation.

get(*[, label])

Return a list of the attributes of the annotation, optionally filtering by label.

get(*, label=None)[source]#

Return a list of the attributes of the annotation, optionally filtering by label.

Parameters

label (Optional[str]) – Label to use to filter attributes.

Return type

List[Attribute]

add(attr)[source]#

Attach an attribute to the annotation.

Parameters

attr (Attribute) – Attribute to add.

Raises

ValueError – If the attribute is already attached to the annotation (based on attr.uid).