cellmap_flow.dashboard.routes.finetune.overlay

What the viewer shows of the annotations: a volume’s editable layer, and boxes around the regions that have annotations in them.

Routes: POST /api/finetune/add-to-viewer (a volume’s paintable layer), POST /api/finetune/refresh-annotated-regions (redraw the boxes) and POST /api/finetune/sync-annotations (pull the annotations from MinIO now).

Attributes

logger

ANNOTATION_TOOL_BINDINGS

Functions

add_annotation_layer(viewer, layer_name, annotation_url, *)

Add the writable layer that paints into a volume, and select it.

refresh_annotation_layer(→ bool)

Make neuroglancer re-read the paint layer of volume_id's volume, and only it.

refresh_annotated_regions_layer([corrections_path])

Draw a box around every region that has annotations in it.

refresh_annotated_regions()

Redraw the annotated-regions boxes because the user asked for it.

add_crop_to_viewer()

sync_annotations_manually()

Module Contents

cellmap_flow.dashboard.routes.finetune.overlay.logger
cellmap_flow.dashboard.routes.finetune.overlay.ANNOTATION_TOOL_BINDINGS
cellmap_flow.dashboard.routes.finetune.overlay.add_annotation_layer(viewer, layer_name, annotation_url, *, keep_existing=False)

Add the writable layer that paints into a volume, and select it.

annotation_url is the volume’s annotation group as MinIO serves it. This is the one builder of that layer: add-to-viewer (after create-volume and resume), load-crops and instance corrections all add it here. So each gets the draw tools pre-bound (ANNOTATION_TOOL_BINDINGS) and is selected with its panel open, ready to paint without hunting for it in the layer list; load-crops and instance corrections used to build their own, with neither. The panel opens on its Draw tab, where the brush and flood fill are.

A layer of that name is replaced, unless keep_existing: then it is left as it is, selection included, and False is returned.

cellmap_flow.dashboard.routes.finetune.overlay.refresh_annotation_layer(viewer, volume_id) → bool

Make neuroglancer re-read the paint layer of volume_id’s volume, and only it.

Labels written behind its back (a seed, a relabel) show only once the layer’s chunks are read again. The layer keeps everything the browser set on it (its paint value, brush size, tool, colours) and only its source moves to a new spelling of the same URL (_respelled_port); rebuilding it with add_annotation_layer reset those. The view, the other layers and their servers are left alone; reloading the viewer re-read every layer and had every server recompute the view. Returns whether a layer was found and refreshed.

cellmap_flow.dashboard.routes.finetune.overlay.refresh_annotated_regions_layer(corrections_path=None)

Draw a box around every region that has annotations in it.

Only ever called for something the user just did: creating a volume, importing crops, resuming a session, clicking “Save Annotations to Disk” or “Show Annotated Regions”. Nothing calls this on a timer: see the note on _last_annotated_regions for why a push the user did not ask for is destructive.

cellmap_flow.dashboard.routes.finetune.overlay.refresh_annotated_regions()

Redraw the annotated-regions boxes because the user asked for it.

This is the only way the boxes update during a session. It pushes viewer state, which rebuilds every layer browser-side, so it is deliberately a button: you click it when you want to see where you have painted, not while you are in the middle of painting.

cellmap_flow.dashboard.routes.finetune.overlay.add_crop_to_viewer()
cellmap_flow.dashboard.routes.finetune.overlay.sync_annotations_manually()