Skip to content

flimari.core.napari

LayerManager #

A singleton class for managing image layers created by FLIMari.

add_layer(data, *, name, kind, display_name='', overwrite=False, **kwargs) #

Add a new napari layer or overwrite an existing one.

Parameters:

Name Type Description Default
data ndarray

The data to display.

required
name str

Name of the data, stored in layer metadata.

required
kind LayerType

The layer's LayerType.

required
display_name str

Name of the layer shown in the UI.

''
overwrite bool

Whether to overwrite if a layer with the same LayerType and name already exists.

False
**kwargs

Optional arguments for the add layer call to napari.

{}

add_image(data, *, name, overwrite=False, **kwargs) #

Add an image layer to the viewer. Wrapper function for add_layer.

Parameters:

Name Type Description Default
data ndarray

The image to display.

required
name str

Name of the data, stored in layer metadata.

required
overwrite bool

Whether to overwrite if layer already exists.

False
**kwargs

Optional arguments for napari.Viewer.add_image.

{}

add_label(data, *, name, cdict=None, overwrite=False, **kwargs) #

Add a label layer to the viewer. Wrapper function for add_layer.

Parameters:

Name Type Description Default
data ndarray

The labels to display.

required
name str

Name of the data, stored in layer metadata.

required
cdict dict

Color dictionary for DirectLabelColormap, used to color the labels.

None
overwrite bool

Whether to overwrite if layer already exists.

False
**kwargs

Optional arguments for napari.Viewer.add_image.

{}

get_layer_data(name, kind) #

Parameters:

Name Type Description Default
name str

Name of the data (in metadata, not display name).

required
kind LayerType

LayerType of the layer.

required

Returns:

Type Description
ndarray

Data stored in the layer. If no data is stored, return None.

focus_on_layers(name) #

Make all layers related to name visible and hide others.

remove_layer(name, kind) #

Remove the first layer with the given metadata key.

Parameters:

Name Type Description Default
name str

Name of the data.

required
kind LayerType

Target LayerType.

required