napari_spatialdata.Interactive#

class napari_spatialdata.Interactive(sdata, headless=False)#

Interactive visualization of spatial data.

Parameters:
sdata SpatialData | list[SpatialData]

SpatialData object.

headless bool (default: False)

Run napari in headless mode, default False.

Returns:

None

Methods table#

add_element(element, element_coordinate_system)

Add an element of a spatial data object being visualized with interactive to the viewer.

add_text_to_polygons(layer_name, ...)

Add text annotations to a polygon layer.

get_layer(layer_name)

Get a layer by name.

run()

Run the napari application.

screenshot()

Take a screenshot of the viewer in its current state.

switch_coordinate_system(coordinate_system)

Switch to a coordinate system present in the spatialdata object(s).

Methods#

add_element#

Interactive.add_element(element, element_coordinate_system, view_element_system=False)#

Add an element of a spatial data object being visualized with interactive to the viewer.

Parameters:
element str

The name of the element in the spatial data object to add as napari layer.

element_coordinate_system str

The coordinate system in which the layer should be visualized.

view_element_system bool (default: False)

Whether to switch to element_coordinate_system or to switch back to current active coordinate system after adding an element as layer.

Return type:

None

add_text_to_polygons#

Interactive.add_text_to_polygons(layer_name, text_annotations)#

Add text annotations to a polygon layer.

Return type:

None

get_layer#

Interactive.get_layer(layer_name)#

Get a layer by name.

Return type:

Image | Labels | Points | Shapes | None

run#

Interactive.run()#

Run the napari application.

Return type:

None

screenshot#

Interactive.screenshot()#

Take a screenshot of the viewer in its current state.

Return type:

Union[ndarray[Any, dtype[float64]], Any]

switch_coordinate_system#

Interactive.switch_coordinate_system(coordinate_system)#

Switch to a coordinate system present in the spatialdata object(s).

Return type:

None