yarrow.yarrow_cls.MultilayerImage

class yarrow.yarrow_cls.MultilayerImage(images: Optional[List[Image]] = None, name: Optional[str] = None, meta: Optional[dict] = None, id: Optional[str] = None, split: Optional[str] = None)

Bases: object

__init__(images: Optional[List[Image]] = None, name: Optional[str] = None, meta: Optional[dict] = None, id: Optional[str] = None, split: Optional[str] = None) None

MultilayerImage class. Represents a collection of Image that should be considered as one element.

Here is an example on how to insert it in an Annotation

```python images = [Image(…), …] multi_layer = MultiLayer(images=images, …)

annot = Annotation(images = images, …) # or annot = Annotation(images = multi_layer.images, …)

yar_set = YarrowDataset(info=Info(…))

yar_set.add_annotation(annot) yar_set.add_multilayer(multi_layer) ```

Args:

id (str, optional): unique id of the object, will generate a uuid if None. Defaults to uuid4().hex. images (List[Image], optional): Defaults to []. name (str, optional): Name of the collection. Defaults to “”. meta (dict, optional): Metadata. Defaults to {}. split(str, optional): string to specify to which split the image belong, used to assign images to “train”, “validate” or “test” when training models for example.

Methods

__init__([images, name, meta, id, split])

MultilayerImage class.

pydantic([reset])

Returns the pydantic object mapping this class.

set_split(split)

Set the split for the current MultilayerImage and all its Images

pydantic(reset: bool = False)

Returns the pydantic object mapping this class. After the first call_ the object reference is kept. Pass reset=True to reinstantiate the object

Args:

reset (bool, optional): Pass True to reinstantiate the object, previous object will be lost. Defaults to False.

Returns:

Image_pydantic: pydantic image class

set_split(split: str)

Set the split for the current MultilayerImage and all its Images

Args:

split (str): The split value to assign