image_viewer
image_viewer ¶
image_viewer(
image_path: str,
data,
overlay: str = None,
flip_y: bool = True,
overlay_category: list = None,
markers: list = None,
channel_names="default",
x_coordinate: str = "X_centroid",
y_coordinate: str = "Y_centroid",
point_size: int = 10,
point_color=None,
subset: str = None,
imageid: str = "imageid",
seg_mask: str = None,
umap_settings: dict = None,
sdataTable: str = None,
**kwargs
)
Open the raw image in napari with cells overlaid and a linked UMAP.
Loads the image as a lazy pyramid, adds one napari layer per channel, and
scatters the cells on top at their real coordinates. When the object has a UMAP
embedding, a dock widget shows it alongside: click legend entries to toggle
categories, lasso a region to select those cells, and save the selection into a
new obs column from the widget's UI.
The function blocks until the napari window is closed, and then returns the (possibly edited) object together with the viewer.
This function keeps scimap's snake_case parameters
Unlike the rest of scimappro, image_viewer uses x_coordinate,
y_coordinate, imageid, seg_mask, and so on, matching scimap so that
viewer calls port across unchanged. data and sdataTable follow the
scimappro convention.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
image_path
|
(str, required)
|
Path to the OME-TIFF, TIFF, or Zarr image. |
required |
data
|
(AnnData | SpatialData | str, required)
|
The cell table. An |
required |
overlay
|
str
|
Column in |
None
|
flip_y
|
bool
|
Flip the y axis so the points line up with the image. |
True
|
overlay_category
|
list
|
Draw only these categories of |
None
|
markers
|
list
|
Channels to add as image layers. All of them when |
None
|
channel_names
|
list | str
|
Names for the image channels. |
'default'
|
x_coordinate
|
str
|
Column in |
'X_centroid'
|
y_coordinate
|
str
|
Column in |
'Y_centroid'
|
point_size
|
int
|
Size of the overlaid cell markers. |
10
|
point_color
|
str | dict
|
One colour for all points, or a |
None
|
subset
|
str | list
|
Restrict to these values of |
None
|
imageid
|
str
|
Column in |
'imageid'
|
seg_mask
|
str
|
Path to a segmentation mask to add as a napari labels layer. |
None
|
umap_settings
|
dict
|
Options for the docked UMAP widget. |
None
|
sdataTable
|
str
|
Which |
None
|
**kwargs
|
dict
|
Forwarded to |
{}
|
Returns:
| Name | Type | Description |
|---|---|---|
data |
AnnData | SpatialData
|
The object, carrying any |
viewer |
Viewer
|
The napari viewer, so you can keep scripting against it. |