Widgets API#

napari_flim_phasor_plotter.widgets.make_flim_phasor_plot(image_layer, laser_frequency=40, harmonic=1, threshold=10, apply_median=False, median_n=1, apply_calibration=False, calibration_image_layer=None, calibration_lifetime=None, napari_viewer=None)

Calculate phasor components from FLIM image and plot them.

Parameters#

image_layernapari.layers.Image

napari image layer with FLIM data with dimensions (ut, time, z, y, x). microtime must be the first dimension. time and z are optional.

laser_frequencyfloat, optional

laser frequency in MHz. If using ‘.ptu’ or ‘.sdt’ files, this field is filled afterwards from the file metadata. By default 40.

harmonicint, optional

the harmonic to display in the phasor plot, by default 1

thresholdint, optional

pixels with summed intensity below this threshold will be discarded, by default 10

apply_medianbool, optional

apply median filter to image before phasor calculation, by default False (median_n is ignored)

median_nint, optional

number of iterations of median filter, by default 1

apply_calibrationbool, optional

if True, apply calibration to phasor coordinates (if calibration image and lifetime are also given), by default False

calibration_image_layernapari.layers.Image, optional

napari image layer with calibration FLIM data (microtime first axis). If not given, no calibration is applied

calibration_lifetimefloat, optional

lifetime (in ns) of calibration sample. If not given or 0, no calibration is applied

napari_viewernapari.Viewer, optional

napari viewer instance, by default None

napari_flim_phasor_plotter.widgets.apply_binning_widget(image_layer, bin_size=2, binning_3D=True)

Apply binning to image layer.

Parameters#

image_layernapari.layers.Image

napari image layer with FLIM data with dimensions (ut, time, z, y, x). microtime must be the first dimension. time and z are optional.

bin_sizeint, optional

bin kernel size, by default 2

binning_3Dbool, optional

if True, bin in 3D, otherwise bin each slice in 2D, by default True

Returns#

napari.layers.Image

binned layer

napari_flim_phasor_plotter.widgets.manual_label_extract(cluster_labels_layer: napari.layers.Labels, label_number: int = 1) napari.layers.Labels#

Extracts single label from labels layer

Parameters:
  • cluster_labels_layer (napari.layers.Labels) – layer with labelled regions based on clusters

  • label_number (int, optional) – chosen label number to be extracted, by default 1

Returns:

layer with single label

Return type:

napari.layers.Labels

napari_flim_phasor_plotter.widgets.get_n_largest_cluster_labels(features_table: pandas.DataFrame, n: int = 1, clustering_id: str = 'MANUAL_CLUSTER_ID') List[int]#

Get the labels of the n largest clusters in a features table

Parameters:
  • features_table (pd.DataFrame) – table of features

  • n (int, optional) – number of clusters to return, by default 1

  • clustering_id (str, optional) – cluster id column name, by default ‘MANUAL_CLUSTER_ID’

Returns:

list of cluster labels

Return type:

List[int]

napari_flim_phasor_plotter.widgets.split_n_largest_cluster_labels(labels_layer: napari.layers.Labels, clusters_labels_layer: napari.layers.Labels, clustering_id: str, n: int = 1) List[napari.layers.Labels]#

Split the n largest clusters from a labels layer inot new layers

Parameters:
  • labels_layer (napari.layers.Labels) – labels layer with features table

  • clusters_labels_layer (napari.layers.Labels) – labels layer with clusters

  • clustering_id (str) – cluster id column name

  • n (int, optional) – number of clusters to extract, by default 1

Returns:

list of labels layers

Return type:

List[napari.layers.Labels]

napari_flim_phasor_plotter.widgets.smooth_cluster_mask(cluster_mask_layer: napari.layers.Labels, fill_area_px: int = 64, smooth_radius: int = 3) napari.layers.Labels#

Smooths a mask from a labels layer with morphological operations

Parameters:
  • cluster_mask_layer (napari.layers.Labels) – labels layer with cluster mask

  • fill_area_px (int, optional) – threshold for area to fill, by default 64

  • smooth_radius (int, optional) – radius of morphological operations (isotropic closing and opening), by default 3

Returns:

layer with smoothed labels

Return type:

napari.layers.Labels

class napari_flim_phasor_plotter.widgets.Split_N_Largest_Cluster_Labels(viewer: napari.viewer.Viewer)#

Bases: Container

Widget to split the n largest clusters from a labels layer

Methods Summary

_get_layers(widget)

Get layers of a certain type

_get_valid_clusters_column_names(widget)

Get valid column names for clustering id

_on_run_clicked()

Run the widget