Plexora

view

Open a notebook-displayable viewer on datasource.

Generated from Plexora 0.0.55View source
from plexora import view
view(datasource=None, **kwargs)

In a Jupyter cell, making this the last expression starts a server and displays the viewer in an iframe.

datasource may be left out when data is given: the project is named after the image file, as the Import dialog would name it, and calling again with the same data refreshes that project. Only opening an existing project needs its name.

Called with a name alone, it opens a project that already exists. Called with data as well -- an image, a table, an AnnData, a SpatialData object -- it registers that data under datasource first, exactly as plexora.register_memory_datasource does, and then opens the viewer on it. Each of image, segmentation and the table may be a path or an in-memory object; a path is read from disk as it always was, and an object is served out of this kernel, so nothing is written and viewer.refresh(adata) shows the next round of annotation.

**kwargs accepts two kinds of keyword, freely mixed:

  • Data arguments -- image, segmentation, adata, table, sdata, sdata_table, sdata_image, sdata_labels, channel_names, coordinate_source, obsm_key, x, y, feature_source, layer, feature_obs_columns, obs_id_field, celltype_column, subset_by, subset_value, apply_log_transform, pixel_size, image_type, segmentation_mode, axes, z_step, frame_interval -- are what plexora.register_memory_datasource accepts, and documents. to_disk=True writes a live AnnData to an .h5ad and registers that file instead of serving the object from memory -- worth asking for when the project should outlive this kernel.
  • Viewer options -- tool, overlay, channels, height, width, proxy, base_url, plugins, data_dir, start -- are what plexora.PlexoraViewer accepts, and documents.

tool, overlay and channels say what the viewer should already be showing when it appears -- which plugin panel is open, which column is drawn over the cells, which image channels are on. All three are EPHEMERAL: they belong to this one viewer and are never written to the project, so the project's saved channels and overlay are exactly what a plain plexora.view(name) restores.

Parameters

datasourcestrdefault None

The project's name. Registered first when **kwargs includes a data argument; opened as-is otherwise.

**kwargs

Data arguments and viewer options, described above.

Returns

PlexoraViewer

The viewer. Its server starts, and it displays, when it is shown or returned as a cell's last expression.

Examples

import plexora

viewer = plexora.view("quicklook", image="slide.ome.tif", start=False)

Guides

On this page