meerkat.interactive.app.src.lib.component.core.ImageAnnotator¶

class ImageAnnotator(data, *, categories=None, segmentations=None, points=None, boxes=None, opacity: float = 0.85, selected_category: str = '', on_add_category: meerkat.interactive.endpoint.EndpointProperty[meerkat.interactive.app.src.lib.component.core.image_annotator.AddCategoryInterface] = None, on_add_box: meerkat.interactive.endpoint.EndpointProperty[meerkat.interactive.app.src.lib.component.core.image_annotator.AddBoxInterface] = None, on_add_point: meerkat.interactive.endpoint.EndpointProperty[meerkat.interactive.app.src.lib.component.core.image_annotator.AddPointInterface] = None)[source]¶
__init__(data, *, categories=None, segmentations=None, points=None, boxes=None, opacity: float = 0.85, selected_category: str = '', on_add_category: Optional[meerkat.interactive.endpoint.EndpointProperty[meerkat.interactive.app.src.lib.component.core.image_annotator.AddCategoryInterface]] = None, on_add_box: Optional[meerkat.interactive.endpoint.EndpointProperty[meerkat.interactive.app.src.lib.component.core.image_annotator.AddBoxInterface]] = None, on_add_point: Optional[meerkat.interactive.endpoint.EndpointProperty[meerkat.interactive.app.src.lib.component.core.image_annotator.AddPointInterface]] = None)[source]¶
Parameters
  • data – The base image. Strings must be base64 encoded or a filepath to the image.

  • categories – The categories in the image. These categories will be used for all annotations. Can either be a list of category names, a dictionary mapping category names to colors, or a DataFrame with two columns (“name” and “color”).

  • segmentations – A list of (mask, category) tuples.

  • opacity – The initial opacity of the segmentation masks.

  • on_select – An endpoint to call when the user clicks on the image.

Methods

__init__(data, *[, categories, ...])

param data

The base image.

append(other)

clear_annotations([annotation_type])

construct([_fields_set])

Creates a new model setting __dict__ and __fields_set__ from trusted or pre-validated data.

copy(*[, include, exclude, update, deep])

Duplicate a model, optionally choose which fields to include, exclude and change.

dict(*[, include, exclude, by_alias, ...])

Generate a dictionary representation of the model, optionally specifying which fields to include or exclude.

from_id(id)

from_orm(obj)

get_components()

json(*[, include, exclude, by_alias, ...])

Generate a JSON representation of the model, include and exclude arguments as per dict().

parse_file(path, *[, content_type, ...])

parse_obj(obj)

parse_raw(b, *[, content_type, encoding, ...])

prepare_categories(categories)

prepare_data(data)

prepend_meerkat_id_prefix(id)

schema([by_alias, ref_template])

schema_json(*[, by_alias, ref_template])

update_forward_refs(**localns)

Try to update ForwardRefs on fields based on this Model, globalns and localns.

validate(value)

Attributes

alias

component_name

event_names

events

frontend

Returns a Pydantic model that can be should be sent to the frontend.

frontend_alias

id

identifiable_group

library

namespace

path

prop_bindings

prop_names

props

slots

slottable

virtual_props

Props, and all events (as_*) as props.

wrapper_import_style

data

categories

segmentations

points

boxes

opacity

selected_category

on_add_category

on_add_box

on_add_point