DataContainer#

class DataContainer(base_color=(0.7, 0.7, 0.7), highlight_color=(0.8, 0.2, 0.2))[source]#

Bases: object

Container for managing and manipulating point cloud data collections.

Parameters:
base_colortuple of float, optional

Default color for points in RGB format in range 0-1. Default is (0.7, 0.7, 0.7).

highlight_colortuple of float, optional

Highlight color for points in RGB format in range 0-1. Default is (0.8, 0.2, 0.2).

Methods

DataContainer.add([points, color])

Add a new geometry object to the container.

DataContainer.clear()

Remove all data associated with the container.

DataContainer.get(index_or_uuid)

Retrieve the Geometry object by index or UUID.

DataContainer.get_actors()

Get VTK actors from all geometries.

DataContainer.highlight(uuids_or_geometries)

Highlight specified geometries.

DataContainer.highlight_points(...)

Highlight specific points in a cloud.

DataContainer.remove(uuids_or_geometries)

Remove geometries at specified indices or by geometry objects.

DataContainer.update(uuid_or_geometry, ...)

Update a geometry by UUID or geometry object.

DataContainer.update_appearance(...)

Update appearance parameters for specified geometries.

DataContainer.uuid_to_index(uuid)

Convert a uuid to an index in self.data.

add(points=None, color=None, **kwargs)[source]#

Add a new geometry object to the container.

Parameters:
points_or_geometrynp.ndarray or Geometry or SegmentationGeometry

Points to add to the container, or an existing geometry object.

colortuple of float, optional

RGB color values for the point cloud.

Returns:
int

Index of the new point cloud.

clear()[source]#

Remove all data associated with the container.

get(index_or_uuid)[source]#

Retrieve the Geometry object by index or UUID.

Parameters:
index_or_uuidint or str

Geometry index or UUID to retrieve.

Returns:
geometrymosaic.geometry.Geometry

Selected geometry or None if not found.

get_actors()[source]#

Get VTK actors from all geometries.

highlight(uuids_or_geometries)[source]#

Highlight specified geometries.

Parameters:
uuids_or_geometrieslist of str or list of Geometry

UUIDs or geometry objects to highlight.

highlight_points(uuid_or_geometry, point_ids, color)[source]#

Highlight specific points in a cloud.

Parameters:
uuid_or_geometryint or str

UUID of geometry to update, or the geometry object itself

point_idsset

IDs of points to highlight.

colortuple of float

RGB color for highlighting.

remove(uuids_or_geometries)[source]#

Remove geometries at specified indices or by geometry objects.

Parameters:
uuids_or_geometriesstr, list of str, Geometry, or list of Geometry

UUIDs of geometries to remove or geometry objects to remove.

update(uuid_or_geometry, new_geometry)[source]#

Update a geometry by UUID or geometry object.

Parameters:
uuid_or_geometrystr or Geometry

UUID of geometry to update, or the geometry object itself

new_geometryGeometry

New geometry to replace the old one

Returns:
bool

True if update succeeded, False if UUID not found

update_appearance(uuids_or_geometries, parameters)[source]#

Update appearance parameters for specified geometries.

Parameters:
uuids_or_geometrieslist of str or list of Geometry

UUIDs or geometry objects to update

parametersdict

Appearance parameters to update

Returns:
bool

True if full render required (actor was replaced)

uuid_to_index(uuid)[source]#

Convert a uuid to an index in self.data.