Skip to content

Convenience

The convenience API builds a viewer with little code. It is designed to provide a single way to declare a viewer configuration and launch it on any of the GUI backends (Qt and Anywidget).

Viewers

A Viewer holds one scene; an OrthoViewer holds four that share one world coordinate system (three orthogonal 2D slices and a 3D view).

cellier.convenience.Viewer

Bases: ControlsRegistryMixin, RenderSettingsMixin

Single-scene viewer wrapping a CellierController.

Creates a controller and a single scene pre-wired and ready to receive data and visuals. No Qt objects are constructed here; call add_canvas when you are ready to attach a render surface.

Parameters:

Name Type Description Default
axes WorldAxesLike

The world axes in order: a WorldCoordinateSystem, or a sequence of Axis objects and/or (name, axis_type) pairs. Their number determines the dimensionality of the scene. Axis types are stated, never inferred from the name -- spatial_axes("z", "y", "x") is the shorthand for an all-spatial world, and a mixed one spells the rest out:

Viewer(
    [("t", "time"), *spatial_axes("z", "y", "x")],
    displayed_axes=("y", "x"),
)
required
displayed_axes tuple of str or UUID

The axes the scene displays first, in display order. Required. Two entries start the viewer in 2D and three start it in 3D:

Viewer(spatial_axes("x", "y", "z"), displayed_axes=("x", "y"))

Each entry is an axis name or an axis id (Axis.id); an axis whose name another axis shares is given by id. Any axis can be displayed, whatever its type. The 2D/3D toggle starts from these axes and returns to the last set shown in each mode.

required
render_modes set[str] or None

Which rendering modes the scene (and its visuals) should support. Defaults to {"2d", "3d"} when None.

None
render_config RenderManagerConfig or None

Render pipeline configuration passed through to the controller. Uses controller defaults when None.

None
gui "qt", "anywidget", or "offscreen"

Which GUI toolkit the canvas should target. "qt" (default) renders into a Qt widget; "anywidget" renders into a notebook canvas for Jupyter / marimo; "offscreen" renders with no window at all, for headless capture via screenshot. Fixed at construction. "offscreen" viewers have no embeddable widget, so the layout builders (build_canvas_widget, launch, show, display) reject them.

'qt'
lighting 'none' or 'default'

Lights in the scene. "default" adds an ambient and a directional light, which a mesh with MeshPhongAppearance needs (without lights it renders black). "none" (default) adds none.

'none'
draw_status_overlay bool

Whether every canvas names, in its top-left corner, the visuals its view does not draw and why in one word -- a 2D view whose slice cuts a rotated image at an angle, say. Default True. See draw_status_overlay.

True

render_config property

render_config: RenderManagerConfig

Live rendering configuration.

Mutating a field here changes the model but not the GPU state, and notifies no widget. The named properties below do all three; reach for this to read the whole configuration or to serialise it.

outline_enabled property writable

outline_enabled: bool

Whether the screen-space outline pass is active.

outline_boundaries_enabled property writable

outline_boundaries_enabled: bool

Whether the boundaries layer (every outlined region) draws.

outline_selection_enabled property writable

outline_selection_enabled: bool

Whether the selection layer (regions with a palette slot) draws.

ambient_occlusion_enabled property writable

ambient_occlusion_enabled: bool

Whether the ambient occlusion pass is active. 3D only.

ambient_occlusion_radius property writable

ambient_occlusion_radius: float | None

Occlusion hemisphere radius in scene units, or None for auto.

None derives it from the scene bounding box diagonal, which is the only default that means anything across cellier's coordinate systems. ambient_occlusion_effective_radius reports what that came to.

ambient_occlusion_auto_radius_fraction property writable

ambient_occlusion_auto_radius_fraction: float

Fraction of the scene bounding box diagonal used when radius is auto.

ambient_occlusion_effective_radius property

ambient_occlusion_effective_radius: float | None

The occlusion radius actually in use, in scene units. Read-only.

ambient_occlusion_strength property writable

ambient_occlusion_strength: float

How far the occlusion is applied, 0 (off) to 1 (full).

ambient_occlusion_power property writable

ambient_occlusion_power: float

Contrast exponent applied to the occlusion before the multiply.

ambient_occlusion_bias property writable

ambient_occlusion_bias: float

Depth-comparison bias, as a fraction of the effective radius.

ambient_occlusion_n_samples property writable

ambient_occlusion_n_samples: int

Hemisphere samples per pixel. Changing this recompiles the shader.

ambient_occlusion_blur_radius property writable

ambient_occlusion_blur_radius: int

Occlusion box-blur half-width in internal pixels. Recompiles.

temporal_enabled property writable

temporal_enabled: bool

Whether the temporal accumulation pass is active. 3D only.

temporal_blend_weight property writable

temporal_blend_weight: float

Minimum EMA blend weight for the current frame, in (0, 1].

Lower values give a smoother settled image and take longer to get there after a camera move.

controller property

controller: CellierController

The underlying CellierController.

gui property

gui: str

The GUI toolkit this viewer renders into.

"qt", "anywidget" or "offscreen" (no window: for scripted screenshots and tests).

scene property

scene: Scene

The single scene managed by this viewer.

background property writable

Appearance of the background drawn behind the scene's visuals.

Uniform black by default (a scene built directly with add_scene keeps the gray gradient of BackgroundAppearance). Mutate its fields to update the canvas at runtime:

viewer.background.color = (1.0, 1.0, 1.0, 1.0)
viewer.background.mode = "vertical_gradient"

Assigning a whole new BackgroundAppearance works too.

draw_status_overlay property

draw_status_overlay: DrawStatusOverlay | None

The text overlay naming visuals a canvas's view does not draw.

On by default (Viewer(..., draw_status_overlay=True)); every canvas of this viewer shows it. Its fields are live: set visible to hide it, or change its colour and size. It lists the visuals whose CellierController.draw_status is not drawable -- a 2D view that cuts a rotated image at an angle, say. None when the viewer was built without it. It is not one of overlays.

overlays property

overlays: tuple[CanvasOverlay | SceneOverlay, ...]

Every overlay on this viewer, scene overlays first.

Scene overlays in add order, then the canvas overlays of each canvas in creation order, then any canvas overlay still waiting for a canvas.

startup_state property

startup_state: StartupState

How far this viewer has got through starting up.

Readable at any moment, with no callback, no event loop and no front end -- which is the point. A blank viewer used to be undiagnosable from Python; now it can say whether it is waiting for the canvas to reach the browser, waiting for a first frame, loading data, or done.

StartupState.IDLE until display/launch/show runs.

scene_startup_states property

scene_startup_states: dict[str, StartupState]

Each scene's startup state, keyed as this viewer keys its scenes.

An aggregate hides which panel is stuck; this does not.

canvases property

canvases: tuple[UUID, ...]

IDs of the canvases attached to this viewer's scene, in creation order.

Empty until add_canvas (or a layout builder) has run. A viewer with no canvas is still capturable -- see screenshot.

reset_temporal_accumulation

reset_temporal_accumulation() -> None

Discard the accumulated history on every canvas.

add_scene_overlay

add_scene_overlay(overlay: SceneOverlay) -> SceneOverlay

Add a world-space overlay to this viewer's scene.

A scene overlay is drawn in the scene's world by the scene camera and follows the scene's contents -- see add_scene_overlay. Its fields are live afterwards:

box = viewer.add_scene_overlay(SceneBoundingBox(name="box"))
box.appearance.color = (1.0, 0.0, 0.0, 1.0)
box.visible = False

Parameters:

Name Type Description Default
overlay SceneOverlay

The overlay model, e.g. a SceneBoundingBox.

required

Returns:

Type Description
SceneOverlay

The same model.

Raises:

Type Description
TypeError

If overlay is not a scene overlay.

add_canvas_overlay

add_canvas_overlay(overlay: CanvasOverlay) -> CanvasOverlay

Add a screen-space overlay to this viewer's canvas.

Attached to the viewer's first canvas. Before any canvas exists -- the usual case, since launch / show / display build it -- the overlay is held and attached as soon as the canvas is created. Its fields are live once attached.

Parameters:

Name Type Description Default
overlay CanvasOverlay

The overlay model, e.g. a CenteredAxes2D.

required

Returns:

Type Description
CanvasOverlay

The same model.

Raises:

Type Description
TypeError

If overlay is not a canvas overlay.

remove_overlay

remove_overlay(overlay: CanvasOverlay | SceneOverlay | UUID) -> None

Remove an overlay of either category.

Parameters:

Name Type Description Default
overlay (CanvasOverlay, SceneOverlay or UUID)

The overlay model, or its id.

required

Raises:

Type Description
KeyError

If the overlay is not on this viewer.

on_ready

on_ready(callback: Callable[[], None]) -> SubscriptionHandle

Register a callback fired once the scene's startup data is on the GPU.

The callback runs after the initial reslice triggered by launch / show has committed all visuals (in-memory, multiscale, multichannel, and geometry) to the GPU. Use it to hide a loading indicator, capture a screenshot, or enable controls once the first view is fully loaded.

Fires once, on the first startup. Register it before or after display/launch/show: before startup has finished it waits, and after that it runs at once. For one scene, use on_scene_ready.

Parameters:

Name Type Description Default
callback Callable[[], None]

Zero-argument callback.

required

Returns:

Type Description
SubscriptionHandle

Active until callback fires; its unsubscribe() cancels the callback. Already inactive when startup had finished and callback ran before this returned.

startup_report

startup_report() -> str

A one-line summary of startup progress, for a cell or a log line.

on_scene_ready

on_scene_ready(key: str, callback: Callable[[], None]) -> SubscriptionHandle

Fire callback when one scene's data is on the GPU.

The per-scene counterpart of on_ready, which waits for all of them. Fires once; immediately if that scene is already ready.

Must be called after display/launch, which is when the startup tracker exists.

Parameters:

Name Type Description Default
key str

The scene key -- "scene" for a single-scene viewer, or the panel key ("xy", "xz", "yz", "vol") for an OrthoViewer.

required
callback Callable[[], None]

Zero-argument callback.

required

Returns:

Type Description
SubscriptionHandle

Active until callback fires; its unsubscribe() cancels the callback. Already inactive when the scene was ready and callback ran before this returned.

Raises:

Type Description
RuntimeError

If the viewer has not been started yet.

on_startup_progress

on_startup_progress(callback: Callable[[int, int], None]) -> SubscriptionHandle

Fire callback(scenes_ready, scenes_total) as scenes load.

For a progress bar over a slow or remote dataset, where the gap between "shown" and "loaded" is long enough to need reporting.

Must be called after display/show/launch, which is when the startup tracker exists. launch blocks until the window closes, so with it register from code that runs in the event loop.

Parameters:

Name Type Description Default
callback Callable[[int, int], None]

Called with the number of scenes ready and the total.

required

Returns:

Type Description
SubscriptionHandle

Active until its unsubscribe() is called.

Raises:

Type Description
RuntimeError

If the viewer has not been started yet.

on_startup_stalled

on_startup_stalled(callback: Callable[[dict], None]) -> SubscriptionHandle

Fire callback({scene key: state}) if startup does not finish.

The signal that was missing entirely: startup could only ever report success, so a viewer that never finished looked exactly like one still working. The payload names each unfinished scene and the state it stopped in, so the report can say what it was waiting for.

Stalling is not an error -- slow remote data legitimately takes a while -- it is the cue that something is worth looking at. The window is 30 s by default. display(..., stall_timeout=) tunes it (None turns the check off); run, launch and show take no stall_timeout and always use the default.

Must be called after display/show/launch, which is when the startup tracker exists.

Parameters:

Name Type Description Default
callback Callable[[dict], None]

Called with {scene key: StartupState} for every scene that has not finished.

required

Returns:

Type Description
SubscriptionHandle

Active until its unsubscribe() is called.

Raises:

Type Description
RuntimeError

If the viewer has not been started yet.

on_pick

on_pick(canvas_id: UUID, event_type: type, callback: Callable[[Any], None], *, owner_id: UUID | None = None, weak: bool = False) -> SubscriptionHandle

Register a callback fired when a visual of one kind is picked.

Mirrors CellierController.on_pick; see it for the events, their timing and gating.

Parameters:

Name Type Description Default
canvas_id UUID

The canvas to watch, e.g. one of viewer.canvases.

required
event_type type

One of cellier.events.PICK_EVENT_TYPES.

required
callback Callable

Called with each pick event.

required
owner_id UUID or None

Owner for bulk removal. Defaults to canvas_id, so removing the canvas removes the subscription.

None
weak bool

If True, hold only a weak reference to callback.

False

Returns:

Type Description
SubscriptionHandle

Call its unsubscribe() to remove this subscription.

unsubscribe

unsubscribe(handle: SubscriptionHandle) -> None

Remove one subscription made by an on_* method.

The same as handle.unsubscribe(). Does nothing when the subscription was already removed.

Parameters:

Name Type Description Default
handle SubscriptionHandle

The handle an on_* method returned.

required

loading_progress

loading_progress(visual: object) -> LoadingProgress | None

How far a multiscale visual's data has loaded.

Mirrors CellierController.loading_progress.

Parameters:

Name Type Description Default
visual visual model or UUID

A multiscale image or labels visual.

required

Returns:

Type Description
LoadingProgress or None

None for a visual that is not multiscale, or not planned yet.

on_reslice_progress

on_reslice_progress(visual: object, callback: Callable[[ResliceProgressEvent], None], *, owner_id: UUID | None = None, weak: bool = False) -> SubscriptionHandle

Register a callback fired as a multiscale visual's data loads.

Mirrors CellierController.on_reslice_progress.

Parameters:

Name Type Description Default
visual visual model or UUID

A multiscale image or labels visual.

required
callback Callable

Called with each ResliceProgressEvent.

required
owner_id UUID or None

Owner for controller.unsubscribe_owner. Defaults to the visual's id, so removing the visual removes the subscription.

None
weak bool

If True, hold only a weak reference to callback.

False

Returns:

Type Description
SubscriptionHandle

Call its unsubscribe() to remove this subscription.

on_backstop_complete

on_backstop_complete(visual: object, callback: Callable[[BackstopCompleteEvent], None], *, owner_id: UUID | None = None, weak: bool = False) -> SubscriptionHandle

Register a callback fired when a multiscale visual's backstop is in.

Mirrors CellierController.on_backstop_complete.

Parameters:

Name Type Description Default
visual visual model or UUID

A multiscale image or labels visual.

required
callback Callable

Called with each BackstopCompleteEvent.

required
owner_id UUID or None

Owner for controller.unsubscribe_owner. Defaults to the visual's id, so removing the visual removes the subscription.

None
weak bool

If True, hold only a weak reference to callback.

False

Returns:

Type Description
SubscriptionHandle

Call its unsubscribe() to remove this subscription.

set_loading

set_loading(visual: object, **fields: Any) -> ProgressiveLoadingConfig

Change how a multiscale visual loads, while it is shown.

Mirrors CellierController.set_loading_config: fields are merged into the visual's render_config.loading and applied at once. An invalid combination raises and changes nothing.

Parameters:

Name Type Description Default
visual visual model or UUID

A multiscale image or labels visual.

required
**fields Any

ProgressiveLoadingConfig fields, e.g. backstop_extent="view".

{}

Returns:

Type Description
ProgressiveLoadingConfig

The visual's config after the call.

set_lod_config

set_lod_config(visual: object, **fields: Any) -> GeometryLodConfig

Change the level-of-detail settings of a multiscale mesh.

Mirrors CellierController.set_lod_config. dims_drag_draw and camera_motion choose among the levels already loaded and apply in the next frame; dims_drag decides what the next dims scrub loads.

Parameters:

Name Type Description Default
visual visual model or UUID

A multiscale mesh visual.

required
**fields Any

GeometryLodConfig fields, e.g. camera_motion="full". coarse_level cannot be changed.

{}

Returns:

Type Description
GeometryLodConfig

The visual's config after the call.

add_clipping_plane_gizmo

add_clipping_plane_gizmo(visual: object, plane: ClippingPlane | UUID, *, canvas: UUID | None = None) -> ClippingPlaneGizmoController

Put a gizmo on one clipping plane of a visual, in the 3D view.

Dragging the gizmo moves and tilts the plane. Mirrors CellierController.add_clipping_plane_gizmo: a canvas has one gizmo at a time, and the gizmo closes itself when its plane or its visual is removed or the view leaves 3D.

Parameters:

Name Type Description Default
visual visual model or UUID

The visual the plane belongs to.

required
plane ClippingPlane or UUID

One of visual.clipping_planes, or its id.

required
canvas UUID or None

One of canvases. None (default) is the viewer's single canvas.

None

Returns:

Type Description
ClippingPlaneGizmoController

The session. close() ends it.

Raises:

Type Description
KeyError

If the visual has no plane with that id.

ValueError

If the view is in 2D, the plane has a component on an axis the view does not show, or canvas is omitted while the viewer does not have exactly one canvas.

add_render_plane_gizmo

add_render_plane_gizmo(visual: object, plane: RenderPlane | UUID, *, canvas: UUID | None = None) -> RenderPlaneGizmoController

Put a gizmo on one render plane of a visual, in the 3D view.

Dragging the gizmo moves and turns the plane, and its two in-plane scale handles resize it (an axis with an unbounded side has none). Mirrors CellierController.add_render_plane_gizmo: a canvas has one gizmo at a time, clipping planes included, and the gizmo closes itself when its plane or its visual is removed, the visual leaves the "plane" render mode or the view leaves 3D.

Parameters:

Name Type Description Default
visual visual model or UUID

The visual the plane belongs to, in the "plane" render mode.

required
plane RenderPlane or UUID

One of visual.render_planes, or its id.

required
canvas UUID or None

One of canvases. None (default) is the viewer's single canvas.

None

Returns:

Type Description
RenderPlaneGizmoController

The session. close() ends it.

Raises:

Type Description
KeyError

If the visual has no render plane with that id.

ValueError

If the view is in 2D, the visual is not in plane mode, the plane's axes are not the displayed ones, or canvas is omitted while the viewer does not have exactly one canvas.

remove_plane_gizmo

remove_plane_gizmo(*, canvas: UUID | None = None) -> None

Close a canvas's plane gizmo, of either kind; nothing if it has none.

Parameters:

Name Type Description Default
canvas UUID or None

One of canvases. None (default) is the viewer's single canvas.

None

screenshot

screenshot(*, canvas: UUID | None = None, size: tuple[int, int] | None = None, scale: float = 1.0, frames: int | Literal['converged'] = 1, save: str | Path | None = None, **capture_kwargs) -> ndarray

Capture a reproducible screenshot as an RGBA uint8 array.

The frame is rendered offscreen, so two captures of the same viewer state produce byte-identical arrays and the result does not depend on a window being open, on the display's pixel ratio, or on which GUI toolkit the viewer targets.

The capture shows the data currently resident on the GPU -- it does not reslice. Capture from on_ready (or after launch / show / display have fired it) when a load may still be running.

A viewer with no canvas still renders, fitting the camera to the scene, but it will have no data to show: slice requests are planned per canvas, so a viewer that never called add_canvas has never loaded anything. Add a canvas and let the reslice finish first -- cellier.convenience.capture does this for you.

Parameters:

Name Type Description Default
canvas UUID or None

Which canvas's viewpoint to reproduce, from canvases. This selects a viewpoint, not a surface: the pixels always come from a fresh offscreen canvas. With None (default) the viewer's single canvas is used, the scene is fitted if there is no canvas, and an ambiguous choice raises rather than guessing.

None
size tuple[int, int] or None

(width, height) in pixels before scale. Defaults to the selected canvas's physical size (so the on-screen framing is reproduced), or (600, 600) when there is no canvas.

None
scale float

Multiplier applied to size. scale=2 doubles the resolution.

1.0
frames int or 'converged'

1 (default) draws a single frame with temporal accumulation off. "converged" draws the number of frames the accumulator needs to settle (44 at the default blend weight), which is what you want whenever ambient occlusion is enabled. N draws exactly N accumulated frames.

1
save str, Path, or None

When given, also write the frame to this path as a PNG.

None
**capture_kwargs

Forwarded to the capture helper (max_frames, residual).

{}

Returns:

Type Description
ndarray

RGBA uint8 array of shape (height, width, 4).

Raises:

Type Description
ValueError

If canvas is not one of this viewer's canvases, or if it is omitted while the viewer has more than one canvas.

to_file

to_file(path: str | Path) -> None

Serialize the viewer model state to a JSON file.

The file captures scenes, visuals, data stores, canvases with their camera models, and the render pipeline configuration. Pass the path to from_file to restore an equivalent Viewer.

The cameras are saved with their pose, which from_file restores. The gui toolkit is not saved; pass it to from_file.

Parameters:

Name Type Description Default
path str or Path

Destination file path.

required

from_file classmethod

from_file(path: str | Path, *, gui: Literal['qt', 'anywidget', 'offscreen'] = 'qt') -> Viewer

Restore a Viewer from a previously serialized file.

The render pipeline configuration, scenes, visuals, data stores and canvases are restored from the file, and each camera starts at its saved pose. launch / show / display keep that view (their default fit=None does not fit placed cameras); pass fit="ready" to fit to the data instead. A camera that was never shown before saving (the 3D camera of a viewer saved in 2D) has no pose and is fitted the first time it is shown.

Parameters:

Name Type Description Default
path str or Path

Path to a JSON file written by to_file.

required
gui ('qt', 'anywidget', 'offscreen')

Toolkit to build the canvases with; the file does not record one. The canvases are built during this call, so "qt" (the default) needs a QApplication first.

"qt"

Returns:

Type Description
Viewer

Raises:

Type Description
ValueError

If the file contains zero or more than one scene.

add_canvas

add_canvas(*, render_modes: set[str] | None = None, initial_dim: str | None = None, fov: float = 70.0, depth_range_3d: tuple[float, float] = (1.0, 8000.0), depth_range_2d: tuple[float, float] = (-500.0, 500.0), canvas_size: tuple[int, int] | None = None, fit_view_direction_3d: Mapping[AxisRef, float] | None = None, fit_up_3d: Mapping[AxisRef, float] | None = None) -> QWidget

Create a canvas attached to this viewer's scene.

Parameters:

Name Type Description Default
render_modes set[str] or None

Which camera modes to prepare. Defaults to the scene's own render_modes when None.

None
initial_dim str or None

Which mode is active first. Inferred from the scene's current displayed_axes when None.

None
fov float

Vertical field of view in degrees for the 3D camera. Default 70.

70.0
depth_range_3d tuple[float, float]

(near, far) clip distances for the 3D camera. Far is raised when the scene's data needs more (see fit_camera); near is kept.

(1.0, 8000.0)
depth_range_2d tuple[float, float]

(near, far) clip distances for the 2D camera.

(-500.0, 500.0)
canvas_size tuple[int, int] or None

Initial CSS pixel size for the anywidget canvas. Ignored for the Qt gui. Defaults to (600, 600) for the anywidget gui.

None
fit_view_direction_3d Mapping[AxisRef, float] or None

The view direction and up vector the 3D camera is fitted with, each as the component along named world axes, e.g. {"z": -1.0}. None (default) looks along minus all three displayed axes with the first displayed axis up. See CellierController.add_canvas.

None
fit_up_3d Mapping[AxisRef, float] or None

The view direction and up vector the 3D camera is fitted with, each as the component along named world axes, e.g. {"z": -1.0}. None (default) looks along minus all three displayed axes with the first displayed axis up. See CellierController.add_canvas.

None

Returns:

Type Description
QWidget or AnywidgetRenderCanvas or OffscreenRenderCanvas

The canvas for this viewer's gui. On Qt, embed it with layout.addWidget(widget).

set_displayed_dimensions

set_displayed_dimensions(axis_names: Sequence[AxisRef]) -> None

Set which axes are displayed, by name or by id.

Switches the scene between 2D and 3D rendering by resolving axis_names to axis indices and calling the controller's dims API. Every axis keeps its slice position whether or not it is displayed, so an axis that goes from displayed back to sliced slices where it last was.

Parameters:

Name Type Description Default
axis_names sequence of str or UUID

The axes to display, e.g. ("y", "x") for 2D or ("z", "y", "x") for 3D. 2 or 3 entries, each an axis name or an axis id of the scene's coordinate system. An axis whose name another axis shares is given by id.

required

Raises:

Type Description
TypeError

If an entry is neither a name nor an id.

ValueError

If axis_names does not have 2 or 3 entries, an entry names no axis or an ambiguous one, or an axis is given twice.

set_slice_positions

set_slice_positions(positions: Mapping[int, float], *, interactive: bool = False) -> None

Move the slice position of one or more world axes.

By default a jump: every visual loads in full at once. With interactive=True, or inside dims_interaction, it is a tick of a scrub: visuals with coarsest_while_moving on for the view load their coarse backstop only, and load in full when the scrub ends. See CellierController.update_slice_indices.

Parameters:

Name Type Description Default
positions Mapping[int, float]

World axis index -> world position. Other axes keep theirs.

required
interactive bool

Whether the move is a tick of a scrub.

False

dims_interaction

dims_interaction() -> Generator[None, None, None]

Scrub the dims for the length of a with block.

Every slice-position move inside the block is a scrub tick, so a player or a scripted sweep loads coarse while it runs and in full when the block exits:

with viewer.dims_interaction():
    for t in range(n_frames):
        viewer.set_slice_positions({0: t})

A sweep that wants every position at full resolution does not open one.

transform_interaction

transform_interaction(visual: UUID | object) -> Generator[None, None, None]

Drag a visual's transform for the length of a with block.

Every assignment of the visual's transform inside the block is a tick of one drag (CellierController.transform_interaction):

with viewer.transform_interaction(visual):
    for angle in angles:
        visual.transform = rotated(angle)

Parameters:

Name Type Description Default
visual UUID or visual

The visual, or its id.

required

get_camera_state

get_camera_state(*, canvas: UUID | None = None) -> CameraState

Return a snapshot of a canvas's camera.

Parameters:

Name Type Description Default
canvas UUID or None

One of canvases. None (default) is the viewer's single canvas.

None

Returns:

Type Description
CameraState

Raises:

Type Description
ValueError

If canvas is not this viewer's, or is omitted while the viewer does not have exactly one canvas.

set_camera_state

set_camera_state(state: CameraState, *, canvas: UUID | None = None, interactive: bool = False) -> None

Move a canvas's camera to state.

By default a jump: multiscale image and labels reslice at once for the new view. With interactive=True, or inside camera_interaction, it is a tick of a motion: nothing is resliced until the motion ends. See CellierController.set_camera_state.

Parameters:

Name Type Description Default
state CameraState

The state to apply; get_camera_state returns one.

required
canvas UUID or None

One of canvases. None (default) is the viewer's single canvas.

None
interactive bool

Whether the move is a tick of a motion.

False

Raises:

Type Description
ValueError

If the canvas cannot be resolved (see get_camera_state), state is for the other kind of camera, or its controller_state is for the other kind of controller.

fit_camera

fit_camera(*, canvas: UUID | None = None, interactive: bool = False, only_visible_visuals: bool = False) -> None

Fit the camera to the box the scene's data occupies.

A jump, like set_camera_state. See CellierController.fit_camera for how the box and the far plane are worked out.

Parameters:

Name Type Description Default
canvas UUID or None

One of canvases. None (default) fits every canvas of the viewer.

None
interactive bool

Whether the move is a tick of a camera motion instead of a jump.

False
only_visible_visuals bool

Fit to the visuals that are shown only. The far plane still keeps every visual in view. Default False: hidden visuals count.

False

Raises:

Type Description
ValueError

If canvas is not one of this viewer's canvases.

camera_interaction

camera_interaction(*, canvas: UUID | None = None) -> Generator[None, None, None]

Move a camera as one motion for the length of a with block.

Every camera move inside the block is a tick of a motion, so a fly-through reslices once, when the block exits, instead of at every pose:

with viewer.camera_interaction():
    for pose in path:
        viewer.set_camera_state(pose)

Parameters:

Name Type Description Default
canvas UUID or None

One of canvases. None (default) is the viewer's single canvas.

None

Raises:

Type Description
ValueError

If the canvas cannot be resolved; see get_camera_state.

add_image

add_image(data: ImageMemoryStore | UUID, appearance: InMemoryImageAppearance | None = None, name: str = 'image', controls: list[Control] | None = None, *, single: InMemoryImageSingleAppearance | None = None, channel_axis: int | None = None, composite: bool = False, channels: dict[int, InMemoryImageChannelAppearance] | None = None, max_channels: int = 4, transform: BaseTransform | None = None, outline: VisualOutline | None = None, ambient_occlusion: bool | None = None, pick_write: bool = True, clipping_planes: Sequence[ClippingPlane] = (), render_planes: Sequence[RenderPlane] = (), render_config: InMemoryImageRenderConfig | None = None) -> ImageVisual

Add an in-memory image visual.

One visual draws the image single-channel or composited; see cellier.controller.CellierController.add_image.

Parameters:

Name Type Description Default
data ImageMemoryStore or UUID

Backing data store or the UUID of an already-registered store.

required
appearance InMemoryImageAppearance or None

Shared by both modes. None uses the defaults.

None
name str

Human-readable label. Default "image".

'image'
controls list[Control] or None

The controls to show for this visual in the layout's docks: a list of control models, drawn in the order of the list. The image's fields are chosen with ImageControl(fields=[...]). None (default) or an empty list shows none. The models are Control and the *Control classes beside it.

None
single single appearance or None

Single mode's appearance. None uses the defaults.

None
channel_axis int or None

The data axis a composite draws channels along; it must map to a world axis. None (default) gives an image with no channels.

None
composite bool

Start in composite mode. Requires channel_axis.

False
channels dict[int, channel appearance] or None

Composite mode's per-channel appearances.

None
max_channels int

The most channels the visual may hold. Default 4.

4
transform BaseTransform or None

Data-to-world transform. Identity when None.

None
outline VisualOutline or None

Screen-space outline assignment.

None
ambient_occlusion bool or None

Whether this visual receives ambient occlusion.

None
pick_write bool

Whether the visual writes to the pick buffer. Default True.

True
clipping_planes Sequence[ClippingPlane]

Clipping planes, in the store's level-0 data coordinates: the visual is drawn only on the kept side of every enabled plane. Build them from data.data_coordinate_systems[0]. They can be changed later by assigning visual.clipping_planes. Default none.

()
render_planes Sequence[RenderPlane]

The planes the "plane" render mode draws the data on, in the scene's world coordinates (RenderPlane.from_point_normal(viewer.scene.dims. world_coordinate_system, ...)). Ignored in every other render mode. They can be changed later with controller.set_render_planes. Default none.

()
render_config InMemoryImageRenderConfig or None

The GPU configuration of the brick route, which draws a tilted 2D view of the image. None uses the defaults.

None

Returns:

Type Description
ImageVisual

add_labels

add_labels(data: LabelMemoryStore | UUID, appearance: BaseLabelsAppearance | None = None, name: str = 'labels', transform: BaseTransform | None = None, controls: list[Control] | None = None, outline: VisualOutline | None = None, ambient_occlusion: bool | None = None, pick_write: bool = True, outline_selected_labels: dict[int, int] | None = None, outline_mode: OutlineMode = 'per_label', outline_depth_range: tuple[float, float] | None = None, clipping_planes: Sequence[ClippingPlane] = (), render_planes: Sequence[RenderPlane] = (), render_config: InMemoryLabelRenderConfig | None = None) -> LabelMemoryVisual

Add an in-memory label visual.

Parameters:

Name Type Description Default
data LabelMemoryStore or UUID

Backing data store or the UUID of an already-registered store.

required
appearance BaseLabelsAppearance or None

Appearance parameters. Defaults to InMemoryLabelsAppearance() when None.

None
name str

Human-readable label. Default "labels".

'labels'
transform BaseTransform or None

Data-to-world transform. Defaults to identity when None.

None
controls list[Control] or None

The controls to show for this visual in the layout's docks: a list of control models, drawn in the order of the list. The visual's fields are chosen with FieldControls([...]). None (default) or an empty list shows none. The models are Control and the *Control classes beside it.

None
outline VisualOutline or None

Screen-space outline assignment. None (default) leaves the visual unoutlined. Requires the outline pass to be enabled; see outline_enabled.

None
ambient_occlusion bool or None

Whether this visual receives ambient occlusion. None (default) is automatic: excluded while it renders in a MIP-family mode, included otherwise.

None
pick_write bool

Whether the visual writes to the pick buffer. True (default) makes it pickable. False keeps it out -- say, a volume drawn over outlined visuals, whose pick ids would otherwise erase their outlines. Outlines and ambient-occlusion exclusions are both derived from the pick buffer, so turning it off stops them on this visual; asking for an outline as well turns it back on, with a warning.

True
outline_selected_labels dict[int, int] or None

Maps a label value to the palette slot the selection layer draws it in. None (default) selects no label, so an outlined labels visual shows boundaries only.

None
outline_mode str

How the labels are outlined: "per_label", "whole_object", "all_boundaries" or "depth_threshold". "per_label" (default) outlines the label values in outline_selected_labels, each in its own slot's colour. "whole_object" outlines the volume as one silhouette and "all_boundaries" every label's boundary, both in the colour of the outline slot. "depth_threshold" is "all_boundaries" and also a line where one part of a label passes in front of another part of the same label.

'per_label'
outline_depth_range tuple[float, float] or None

(start, solid) of the depth lines of "depth_threshold" mode, as fractions of the distance from the camera: a jump in depth of start is where a line begins and from solid up it is drawn in full. None (default) keeps the model's default, (0.01, 0.06). No effect in the other modes.

None
clipping_planes Sequence[ClippingPlane]

Clipping planes, in the store's level-0 data coordinates: the visual is drawn only on the kept side of every enabled plane. Build them from data.data_coordinate_systems[0]. They can be changed later by assigning visual.clipping_planes. Default none.

()
render_planes Sequence[RenderPlane]

The planes the "plane" render mode draws the data on, in the scene's world coordinates (RenderPlane.from_point_normal(viewer.scene.dims. world_coordinate_system, ...)). Ignored in every other render mode. They can be changed later with controller.set_render_planes. Default none.

()
render_config InMemoryLabelRenderConfig or None

The GPU configuration of the brick route, which draws a tilted 2D view of the labels. None uses the defaults.

None

Returns:

Type Description
LabelMemoryVisual

add_mesh

add_mesh(data: MeshMemoryStore | UUID, appearance: MeshAppearance, name: str = 'mesh', transform: BaseTransform | None = None, controls: list[Control] | None = None, outline: VisualOutline | None = None, ambient_occlusion: bool | None = None, pick_write: bool = True, section: MeshSectionConfig | None = None, clipping_planes: Sequence[ClippingPlane] = ()) -> MeshVisual

Add a mesh visual.

Parameters:

Name Type Description Default
data MeshMemoryStore or UUID

Backing data store or the UUID of an already-registered store.

required
appearance MeshFlatAppearance or MeshPhongAppearance

Appearance parameters.

required
name str

Human-readable label. Default "mesh".

'mesh'
transform BaseTransform or None

Data-to-world transform. Defaults to identity when None.

None
controls list[Control] or None

The controls to show for this visual in the layout's docks: a list of control models, drawn in the order of the list. The visual's fields are chosen with FieldControls([...]). None (default) or an empty list shows none. The models are Control and the *Control classes beside it.

None
outline VisualOutline or None

Screen-space outline assignment. None (default) leaves the visual unoutlined. Requires the outline pass to be enabled; see outline_enabled.

None
ambient_occlusion bool or None

Whether this visual receives ambient occlusion. None (default) is automatic: excluded while it renders in a MIP-family mode, included otherwise.

None
pick_write bool

Whether the visual writes to the pick buffer. True (default) makes it pickable. False keeps it out -- say, a volume drawn over outlined visuals, whose pick ids would otherwise erase their outlines. Outlines and ambient-occlusion exclusions are both derived from the pick buffer, so turning it off stops them on this visual; asking for an outline as well turns it back on, with a warning.

True
section MeshSectionConfig or None

How the mesh is drawn in a 2D view: the outline and fill of its cross-section, and whether the cut is the slice plane (mode="cut") or the scene's slab (mode="slab"). None (default) is an outline and a fill of the cut.

None
clipping_planes Sequence[ClippingPlane]

Clipping planes, in the store's level-0 data coordinates: the visual is drawn only on the kept side of every enabled plane. Build them from data.data_coordinate_systems[0]. They can be changed later by assigning visual.clipping_planes. Default none.

()

Returns:

Type Description
MeshVisual

add_multiscale_mesh

add_multiscale_mesh(data: MultiscaleMeshStore | UUID, appearance: MeshAppearance, name: str = 'mesh', transform: BaseTransform | None = None, controls: list[Control] | None = None, outline: VisualOutline | None = None, ambient_occlusion: bool | None = None, pick_write: bool = True, section: MeshSectionConfig | None = None, lod: GeometryLodConfig | None = None, clipping_planes: Sequence[ClippingPlane] = ()) -> MultiscaleMeshVisual

Add a mesh with levels of detail.

Two levels are kept loaded, the finest and one coarse level. A new position shows the coarse level first and the finest when it has loaded; a dims scrub loads the coarse level only until it ends.

Parameters:

Name Type Description Default
data MultiscaleMeshStore or UUID

The mesh's levels, finest first, or the UUID of an already-registered store.

required
appearance MeshFlatAppearance or MeshPhongAppearance

Appearance parameters, shared by both levels.

required
name str

Human-readable label. Default "mesh".

'mesh'
transform BaseTransform or None

Data-to-world transform. Defaults to identity when None.

None
controls list[Control] or None

The controls to show for this visual in the layout's docks: a list of control models, drawn in the order of the list. The visual's fields are chosen with FieldControls([...]). None (default) or an empty list shows none. The models are Control and the *Control classes beside it.

None
outline VisualOutline or None

Screen-space outline assignment; see add_mesh.

None
ambient_occlusion bool or None

Whether this visual receives ambient occlusion; see add_mesh.

None
pick_write bool

Whether the visual writes to the pick buffer; see add_mesh.

True
section MeshSectionConfig or None

How the mesh is drawn in a 2D view; see add_mesh.

None
lod GeometryLodConfig or None

Which coarse level is kept (the coarsest by default), and what a dims scrub loads and draws.

None
clipping_planes Sequence[ClippingPlane]

Clipping planes, in the store's level-0 data coordinates: the visual is drawn only on the kept side of every enabled plane. Build them from data.data_coordinate_systems[0]. They can be changed later by assigning visual.clipping_planes. Default none.

()

Returns:

Type Description
MultiscaleMeshVisual

add_points

add_points(data: PointsMemoryStore | UUID, appearance: PointsMarkerAppearance | None = None, name: str = 'points', transform: BaseTransform | None = None, controls: list[Control] | None = None, outline: VisualOutline | None = None, ambient_occlusion: bool | None = None, pick_write: bool = True, clipping_planes: Sequence[ClippingPlane] = ()) -> PointsVisual

Add a points visual.

Parameters:

Name Type Description Default
data PointsMemoryStore or UUID

Backing data store or the UUID of an already-registered store.

required
appearance PointsMarkerAppearance or None

Appearance parameters. Defaults to PointsMarkerAppearance() when None.

None
name str

Human-readable label. Default "points".

'points'
transform BaseTransform or None

Data-to-world transform. Defaults to identity when None.

None
controls list[Control] or None

The controls to show for this visual in the layout's docks: a list of control models, drawn in the order of the list. The visual's fields are chosen with FieldControls([...]). None (default) or an empty list shows none. The models are Control and the *Control classes beside it.

None
outline VisualOutline or None

Screen-space outline assignment. None (default) leaves the visual unoutlined. Requires the outline pass to be enabled; see outline_enabled.

None
ambient_occlusion bool or None

Whether this visual receives ambient occlusion. None (default) is automatic: excluded while it renders in a MIP-family mode, included otherwise.

None
pick_write bool

Whether the visual writes to the pick buffer. True (default) makes it pickable. False keeps it out -- say, a volume drawn over outlined visuals, whose pick ids would otherwise erase their outlines. Outlines and ambient-occlusion exclusions are both derived from the pick buffer, so turning it off stops them on this visual; asking for an outline as well turns it back on, with a warning.

True
clipping_planes Sequence[ClippingPlane]

Clipping planes, in the store's level-0 data coordinates: the visual is drawn only on the kept side of every enabled plane. Build them from data.data_coordinate_systems[0]. They can be changed later by assigning visual.clipping_planes. Default none.

()

Returns:

Type Description
PointsVisual

add_graph

add_graph(data: GraphMemoryStore | UUID, appearance: GraphAppearance | None = None, name: str = 'graph', transform: BaseTransform | None = None, trail: dict[int, TrailConfig] | None = None, controls: list[Control] | None = None, outline: VisualOutline | None = None, ambient_occlusion: bool | None = None, pick_write: bool = True, clipping_planes: Sequence[ClippingPlane] = ()) -> GraphVisual

Add a spatial-graph visual.

Parameters:

Name Type Description Default
data GraphMemoryStore or UUID

Backing data store or the UUID of an already-registered store.

required
appearance GraphAppearance or None

Appearance parameters. Defaults to GraphAppearance() when None.

None
name str

Human-readable label. Default "graph".

'graph'
trail dict[int, TrailConfig] or None

Axis index -> window configuration. Extends the slab on that axis and optionally fades elements by distance from the current slice index. An out-of-range axis raises ValueError.

None
transform BaseTransform or None

Data-to-world transform. When None the store's own transform is used if it has one (a geff file's per-axis scale and offset), and identity otherwise.

None
controls list[Control] or None

The controls to show for this visual in the layout's docks: a list of control models, drawn in the order of the list. The visual's fields are chosen with FieldControls([...]). None (default) or an empty list shows none. The models are Control and the *Control classes beside it.

None
outline VisualOutline or None

Screen-space outline assignment. None (default) leaves the visual unoutlined. Requires the outline pass to be enabled; see outline_enabled.

None
ambient_occlusion bool or None

Whether this visual receives ambient occlusion. None (default) is automatic: excluded while it renders in a MIP-family mode, included otherwise.

None
pick_write bool

Whether the visual writes to the pick buffer. True (default) makes it pickable. False keeps it out -- say, a volume drawn over outlined visuals, whose pick ids would otherwise erase their outlines. Outlines and ambient-occlusion exclusions are both derived from the pick buffer, so turning it off stops them on this visual; asking for an outline as well turns it back on, with a warning.

True
clipping_planes Sequence[ClippingPlane]

Clipping planes, in the store's level-0 data coordinates: the visual is drawn only on the kept side of every enabled plane. Build them from data.data_coordinate_systems[0]. They can be changed later by assigning visual.clipping_planes. Default none.

()

Returns:

Type Description
GraphVisual

add_lines

add_lines(data: LinesMemoryStore | UUID, appearance: LinesMemoryAppearance | None = None, name: str = 'lines', transform: BaseTransform | None = None, controls: list[Control] | None = None, outline: VisualOutline | None = None, ambient_occlusion: bool | None = None, pick_write: bool = True, clipping_planes: Sequence[ClippingPlane] = ()) -> LinesVisual

Add a lines visual.

Parameters:

Name Type Description Default
data LinesMemoryStore or UUID

Backing data store or the UUID of an already-registered store.

required
appearance LinesMemoryAppearance or None

Appearance parameters. Defaults to LinesMemoryAppearance() when None.

None
name str

Human-readable label. Default "lines".

'lines'
transform BaseTransform or None

Data-to-world transform. Defaults to identity when None.

None
controls list[Control] or None

The controls to show for this visual in the layout's docks: a list of control models, drawn in the order of the list. The visual's fields are chosen with FieldControls([...]). None (default) or an empty list shows none. The models are Control and the *Control classes beside it.

None
outline VisualOutline or None

Screen-space outline assignment. None (default) leaves the visual unoutlined. Requires the outline pass to be enabled; see outline_enabled.

None
ambient_occlusion bool or None

Whether this visual receives ambient occlusion. None (default) is automatic: excluded while it renders in a MIP-family mode, included otherwise.

None
pick_write bool

Whether the visual writes to the pick buffer. True (default) makes it pickable. False keeps it out -- say, a volume drawn over outlined visuals, whose pick ids would otherwise erase their outlines. Outlines and ambient-occlusion exclusions are both derived from the pick buffer, so turning it off stops them on this visual; asking for an outline as well turns it back on, with a warning.

True
clipping_planes Sequence[ClippingPlane]

Clipping planes, in the store's level-0 data coordinates: the visual is drawn only on the kept side of every enabled plane. Build them from data.data_coordinate_systems[0]. They can be changed later by assigning visual.clipping_planes. Default none.

()

Returns:

Type Description
LinesVisual

add_image_multiscale

add_image_multiscale(data: BaseDataStore | UUID, appearance: MultiscaleImageAppearance | None = None, name: str = 'image', render_config: MultiscaleImageRenderConfig | None = None, transform: BaseTransform | None = None, controls: list[Control] | None = None, *, single: MultiscaleImageSingleAppearance | None = None, channel_axis: int | None = None, composite: bool = False, channels: dict[int, MultiscaleImageChannelAppearance] | None = None, max_channels: int = 4, outline: VisualOutline | None = None, ambient_occlusion: bool | None = None, pick_write: bool = True, clipping_planes: Sequence[ClippingPlane] = (), render_planes: Sequence[RenderPlane] = ()) -> MultiscaleImageVisual

Add a multiscale image visual.

Parameters:

Name Type Description Default
data BaseDataStore or UUID

Backing multiscale data store or UUID of an already-registered store.

required
appearance MultiscaleImageAppearance or None

Shared by both modes, including the LOD settings.

None
name str

Human-readable label. Default "image".

'image'
render_config MultiscaleImageRenderConfig or None

GPU cache configuration. Uses defaults when None.

None
transform BaseTransform or None

Data-to-world transform. Defaults to identity when None.

None
controls list[Control] or None

The controls to show for this visual in the layout's docks: a list of control models, drawn in the order of the list. The image's fields are chosen with ImageControl(fields=[...]). None (default) or an empty list shows none. The models are Control and the *Control classes beside it.

None
single single appearance or None

Single mode's appearance. None uses the defaults.

None
channel_axis int or None

The data axis a composite draws channels along; it must map to a world axis. None (default) gives an image with no channels.

None
composite bool

Start in composite mode. Requires channel_axis.

False
channels dict[int, channel appearance] or None

Composite mode's per-channel appearances.

None
max_channels int

The most channels the visual may hold. Default 4.

4
outline VisualOutline or None

Screen-space outline assignment.

None
ambient_occlusion bool or None

Whether this visual receives ambient occlusion.

None
pick_write bool

Whether the visual writes to the pick buffer. Default True.

True
clipping_planes Sequence[ClippingPlane]

Clipping planes, in the store's level-0 data coordinates: the visual is drawn only on the kept side of every enabled plane. Build them from data.data_coordinate_systems[0]. They can be changed later by assigning visual.clipping_planes. Default none.

()
render_planes Sequence[RenderPlane]

The planes the "plane" render mode draws the data on, in the scene's world coordinates (RenderPlane.from_point_normal(viewer.scene.dims. world_coordinate_system, ...)). Ignored in every other render mode. They can be changed later with controller.set_render_planes. Default none.

()

Returns:

Type Description
MultiscaleImageVisual

add_masked_image

add_masked_image(mask: BaseDataStore | UUID, value: BaseDataStore | UUID, value_to_mask: AffineTransform | ndarray | None = None, transform: AffineTransform | None = None, appearance: MaskedImageAppearance | None = None, single: MaskedImageSingleAppearance | None = None, render_config: MaskedImageRenderConfig | None = None, name: str = 'masked image', controls: list[Control] | None = None, *, outline: VisualOutline | None = None, ambient_occlusion: bool | None = None, pick_write: bool = True, clipping_planes: Sequence[ClippingPlane] = ()) -> MaskedImageVisual

Add a MaskedImage: a mask's isosurface coloured by a value image.

The surface is found and lit in mask at single.iso_threshold and coloured from value. In 3D the colour is the max, mean or min of the value along the surface normal over single.surface_thickness; in 2D the thickness is the width of a contour band, each pixel showing its own value. See cellier.controller.CellierController.add_masked_image.

Parameters:

Name Type Description Default
mask BaseDataStore or UUID

The image whose isosurface is drawn, in memory or multiscale, or the UUID of a registered store.

required
value BaseDataStore or UUID

The image the surface is coloured from, in memory or multiscale, on its own grid, or the UUID of a registered store.

required
value_to_mask (AffineTransform, array - like or None)

Value level-0 data coordinates to mask level-0 data coordinates. None (default): the two share a grid.

None
transform AffineTransform or None

The mask's data-to-world transform; the value follows it. Defaults to the identity.

None
appearance MaskedImageAppearance or None

Shared appearance, including each image's level of detail.

None
single MaskedImageSingleAppearance or None

The surface's appearance: the value's colour map, clim and opacity, the mask's iso_threshold, and the thickness and band fields.

None
render_config MaskedImageRenderConfig or None

Block size and each image's GPU budget (1,100 MiB each by default, allocated whatever the image's size).

None
name str

Human-readable label. Default "masked image".

'masked image'
controls list[Control] or None

The controls to show for this visual in the layout's docks, in the order of the list. ImageControl(fields=[...]) takes the surface and band rows (surface_thickness, surface_placement, surface_projection, surface_min_width_px, band_rays, band_cap) and the 3D target_bricks row beside visible, color_map, clim, opacity and iso_threshold. None (default) or an empty list shows none.

None
outline VisualOutline | None

As add_image_multiscale; clipping planes are in the mask store's level-0 data coordinates.

None
ambient_occlusion VisualOutline | None

As add_image_multiscale; clipping planes are in the mask store's level-0 data coordinates.

None
pick_write VisualOutline | None

As add_image_multiscale; clipping planes are in the mask store's level-0 data coordinates.

None
clipping_planes VisualOutline | None

As add_image_multiscale; clipping planes are in the mask store's level-0 data coordinates.

None

Returns:

Type Description
MaskedImageVisual

add_labels_multiscale

add_labels_multiscale(data: BaseDataStore | UUID, appearance: MultiscaleLabelsAppearance | None = None, name: str = 'labels', render_config: MultiscaleLabelRenderConfig | None = None, transform: BaseTransform | None = None, controls: list[Control] | None = None, outline: VisualOutline | None = None, ambient_occlusion: bool | None = None, pick_write: bool = True, outline_selected_labels: dict[int, int] | None = None, outline_mode: OutlineMode = 'per_label', outline_depth_range: tuple[float, float] | None = None, clipping_planes: Sequence[ClippingPlane] = (), render_planes: Sequence[RenderPlane] = ()) -> MultiscaleLabelVisual

Add a multiscale label visual.

Parameters:

Name Type Description Default
data BaseDataStore or UUID

Backing multiscale label store or UUID of an already-registered store.

required
appearance MultiscaleLabelsAppearance or None

Visual appearance parameters. Defaults to MultiscaleLabelsAppearance() when None.

None
name str

Human-readable label. Default "labels".

'labels'
render_config MultiscaleLabelRenderConfig or None

LOD and rendering configuration. Uses defaults when None.

None
transform BaseTransform or None

Data-to-world transform. Defaults to identity when None.

None
controls list[Control] or None

The controls to show for this visual in the layout's docks: a list of control models, drawn in the order of the list. The visual's fields are chosen with FieldControls([...]). None (default) or an empty list shows none. The models are Control and the *Control classes beside it.

None
outline VisualOutline or None

Screen-space outline assignment. None (default) leaves the visual unoutlined. Requires the outline pass to be enabled; see outline_enabled.

None
ambient_occlusion bool or None

Whether this visual receives ambient occlusion. None (default) is automatic: excluded while it renders in a MIP-family mode, included otherwise.

None
pick_write bool

Whether the visual writes to the pick buffer. True (default) makes it pickable. False keeps it out -- say, a volume drawn over outlined visuals, whose pick ids would otherwise erase their outlines. Outlines and ambient-occlusion exclusions are both derived from the pick buffer, so turning it off stops them on this visual; asking for an outline as well turns it back on, with a warning.

True
outline_selected_labels dict[int, int] or None

Maps a label value to the palette slot the selection layer draws it in. None (default) selects no label, so an outlined labels visual shows boundaries only.

None
outline_mode str

How the labels are outlined: "per_label", "whole_object", "all_boundaries" or "depth_threshold". "per_label" (default) outlines the label values in outline_selected_labels, each in its own slot's colour. "whole_object" outlines the volume as one silhouette and "all_boundaries" every label's boundary, both in the colour of the outline slot. "depth_threshold" is "all_boundaries" and also a line where one part of a label passes in front of another part of the same label.

'per_label'
outline_depth_range tuple[float, float] or None

(start, solid) of the depth lines of "depth_threshold" mode, as fractions of the distance from the camera: a jump in depth of start is where a line begins and from solid up it is drawn in full. None (default) keeps the model's default, (0.01, 0.06). No effect in the other modes.

None
clipping_planes Sequence[ClippingPlane]

Clipping planes, in the store's level-0 data coordinates: the visual is drawn only on the kept side of every enabled plane. Build them from data.data_coordinate_systems[0]. They can be changed later by assigning visual.clipping_planes. Default none.

()
render_planes Sequence[RenderPlane]

The planes the "plane" render mode draws the data on, in the scene's world coordinates (RenderPlane.from_point_normal(viewer.scene.dims. world_coordinate_system, ...)). Ignored in every other render mode. They can be changed later with controller.set_render_planes. Default none.

()

Returns:

Type Description
MultiscaleLabelVisual

cellier.convenience.OrthoViewer

Bases: ControlsRegistryMixin, RenderSettingsMixin

Four-panel orthoviewer wrapping a single CellierController.

Creates a controller and four pre-wired scenes that share one world coordinate system: three orthogonal 2D slice panels (xy, xz, yz) and one 3D volume panel (vol). No Qt objects are constructed here; build canvases with cellier.convenience.gui.build_ortho_grid_widget when ready.

The three spatial axes (default: the last three axis labels, treated as z, y, x) define the slice planes. Any remaining axes are "extra" axes (e.g. channel or time). By default every axis's slice position, thickness and slider override is mirrored across the four panels, so the panels share one world point.

Every panel starts with a uniform black background; see set_background.

Appearance controls come in two groups per added visual: one drives the three 2D panels together, the other the 3D panel. An AppearanceControls() dock offers both, labelled "{name} (2D views)" and "{name} (3D view)".

Clipping planes controls are not in the appearance docks. A visual whose controls= list holds ClippingPlanesControl() is shown in the OrthoClippingControls() dock, which holds the link mode selector (see link_clipping_planes) and one clipping planes control per group of linked panels.

Parameters:

Name Type Description Default
axes WorldAxesLike

The world axes in order: a WorldCoordinateSystem, or a sequence of Axis objects and/or (name, axis_type) pairs. Their number sets the dimensionality; at least 3 are required. Axis types are stated, never inferred -- a 4-D ortho viewer over a channel stack is OrthoViewer([("c", "channel"), *spatial_axes("z", "y", "x")]).

required
spatial_axes tuple[str, ...], tuple[int, ...], or None

The three axes (names or indices, in z, y, x order) that form the orthogonal planes. Defaults to the last three axes when None.

None
link_axes bool

When True (default), every axis's slice position, thickness and slider override is mirrored across the four panels.

True
link_clipping_planes ('all', '2d')

Which panels of one add_* call carry one tuple of clipping planes: all four (default), the three 2D panels (the 3D panel is independent), or none. It applies to every dataset added, and is the starting clipping_controller mode, which can be set later.

"all"
render_config RenderManagerConfig or None

Render pipeline configuration passed through to the controller.

None
gui "qt", "anywidget", or "offscreen"

Which GUI toolkit the canvases should target. "qt" (default) renders into Qt widgets; "anywidget" renders into notebook canvases for Jupyter / marimo; "offscreen" renders with no window at all, for headless capture via screenshot. Fixed at construction. "offscreen" orthoviewers have no embeddable widgets, so the grid builders reject them.

'qt'
draw_status_overlay bool

Whether every panel names, in its top-left corner, the visuals its view does not draw. Default True. See draw_status_overlay.

True

render_config property

render_config: RenderManagerConfig

Live rendering configuration.

Mutating a field here changes the model but not the GPU state, and notifies no widget. The named properties below do all three; reach for this to read the whole configuration or to serialise it.

outline_enabled property writable

outline_enabled: bool

Whether the screen-space outline pass is active.

outline_boundaries_enabled property writable

outline_boundaries_enabled: bool

Whether the boundaries layer (every outlined region) draws.

outline_selection_enabled property writable

outline_selection_enabled: bool

Whether the selection layer (regions with a palette slot) draws.

ambient_occlusion_enabled property writable

ambient_occlusion_enabled: bool

Whether the ambient occlusion pass is active. 3D only.

ambient_occlusion_radius property writable

ambient_occlusion_radius: float | None

Occlusion hemisphere radius in scene units, or None for auto.

None derives it from the scene bounding box diagonal, which is the only default that means anything across cellier's coordinate systems. ambient_occlusion_effective_radius reports what that came to.

ambient_occlusion_auto_radius_fraction property writable

ambient_occlusion_auto_radius_fraction: float

Fraction of the scene bounding box diagonal used when radius is auto.

ambient_occlusion_effective_radius property

ambient_occlusion_effective_radius: float | None

The occlusion radius actually in use, in scene units. Read-only.

ambient_occlusion_strength property writable

ambient_occlusion_strength: float

How far the occlusion is applied, 0 (off) to 1 (full).

ambient_occlusion_power property writable

ambient_occlusion_power: float

Contrast exponent applied to the occlusion before the multiply.

ambient_occlusion_bias property writable

ambient_occlusion_bias: float

Depth-comparison bias, as a fraction of the effective radius.

ambient_occlusion_n_samples property writable

ambient_occlusion_n_samples: int

Hemisphere samples per pixel. Changing this recompiles the shader.

ambient_occlusion_blur_radius property writable

ambient_occlusion_blur_radius: int

Occlusion box-blur half-width in internal pixels. Recompiles.

temporal_enabled property writable

temporal_enabled: bool

Whether the temporal accumulation pass is active. 3D only.

temporal_blend_weight property writable

temporal_blend_weight: float

Minimum EMA blend weight for the current frame, in (0, 1].

Lower values give a smoother settled image and take longer to get there after a camera move.

draw_status_overlay property

draw_status_overlay: DrawStatusOverlay | None

The text overlay naming visuals a panel's view does not draw.

On by default (OrthoViewer(..., draw_status_overlay=True)); every panel canvas shows it. Under a rotation not about one view axis, a 2D panel whose slice cuts an image at an angle draws nothing of it and lists it here. Its fields are live. None when the viewer was built without it.

controller property

controller: CellierController

The underlying CellierController.

gui property

gui: str

The GUI toolkit this viewer renders into.

"qt", "anywidget" or "offscreen" (no window: for scripted screenshots and tests).

scenes property

scenes: dict[str, Scene]

The four panel scenes keyed "xy", "xz", "yz", "vol".

startup_state property

startup_state: StartupState

How far this viewer has got through starting up.

Readable at any moment, with no callback, no event loop and no front end -- which is the point. A blank viewer used to be undiagnosable from Python; now it can say whether it is waiting for the canvas to reach the browser, waiting for a first frame, loading data, or done.

StartupState.IDLE until display/launch/show runs.

scene_startup_states property

scene_startup_states: dict[str, StartupState]

Each scene's startup state, keyed as this viewer keys its scenes.

An aggregate hides which panel is stuck; this does not.

spatial_axes property

spatial_axes: tuple[int, int, int]

The three spatial axis indices in (z, y, x) order.

extra_axes property

extra_axes: set[int]

Indices of the non-spatial (extra) axes.

dims_controller property

dims_controller: OrthoDimsController | None

The controller mirroring dims across the panels, if linked.

clipping_controller property

clipping_controller: OrthoClippingController

The controller linking clipping planes across the panels.

Its mode ("all", "2d" or None) says which panels of one add_* call carry one tuple of planes, and can be set at any time:

ortho.clipping_controller.mode = "2d"

plane_controller property

plane_controller: OrthoPlaneController

The controller tying the 3D panel's render planes to the 2D panels.

Its mode is None (the default: no link) or "slices": every image and labels visual of the 3D panel then carries three render planes, one per 2D panel, at that panel's slice position, and a 2D slider moves its plane:

ortho.add_image_multiscale(
    store, single=MultiscaleImageSingleAppearance(render_mode="plane")
)
ortho.plane_controller.mode = "slices"

The planes are drawn by the visuals that are in the "plane" render mode.

axis_sync_enabled property writable

axis_sync_enabled: bool

Whether dims edits are mirrored across the panels.

reset_temporal_accumulation

reset_temporal_accumulation() -> None

Discard the accumulated history on every canvas.

set_background

set_background(background: BackgroundAppearance) -> None

Apply one background appearance to all four panels.

Each panel is its own Scene and so owns its own background; use viewer.scenes["xy"].background to change just one. A copy is given to each panel so that later edits to one panel's background do not leak into the others.

Parameters:

Name Type Description Default
background BackgroundAppearance

The background appearance to apply to every panel.

required

startup_report

startup_report() -> str

A one-line summary of startup progress, for a cell or a log line.

on_pick

on_pick(canvas_id: UUID, event_type: type, callback: Callable[[Any], None], *, owner_id: UUID | None = None, weak: bool = False) -> SubscriptionHandle

Register a callback fired when a visual of one kind is picked.

Mirrors CellierController.on_pick; see it for the events, their timing and gating.

Parameters:

Name Type Description Default
canvas_id UUID

The canvas to watch, e.g. one of a panel scene's canvases.

required
event_type type

One of cellier.events.PICK_EVENT_TYPES.

required
callback Callable

Called with each pick event.

required
owner_id UUID or None

Owner for bulk removal. Defaults to canvas_id, so removing the canvas removes the subscription.

None
weak bool

If True, hold only a weak reference to callback.

False

Returns:

Type Description
SubscriptionHandle

Call its unsubscribe() to remove this subscription.

unsubscribe

unsubscribe(handle: SubscriptionHandle) -> None

Remove one subscription made by an on_* method.

The same as handle.unsubscribe(). Does nothing when the subscription was already removed.

Parameters:

Name Type Description Default
handle SubscriptionHandle

The handle an on_* method returned.

required

on_scene_ready

on_scene_ready(key: str, callback: Callable[[], None]) -> SubscriptionHandle

Fire callback when one scene's data is on the GPU.

The per-scene counterpart of on_ready, which waits for all of them. Fires once; immediately if that scene is already ready.

Must be called after display/launch, which is when the startup tracker exists.

Parameters:

Name Type Description Default
key str

The scene key -- "scene" for a single-scene viewer, or the panel key ("xy", "xz", "yz", "vol") for an OrthoViewer.

required
callback Callable[[], None]

Zero-argument callback.

required

Returns:

Type Description
SubscriptionHandle

Active until callback fires; its unsubscribe() cancels the callback. Already inactive when the scene was ready and callback ran before this returned.

Raises:

Type Description
RuntimeError

If the viewer has not been started yet.

on_startup_progress

on_startup_progress(callback: Callable[[int, int], None]) -> SubscriptionHandle

Fire callback(scenes_ready, scenes_total) as scenes load.

For a progress bar over a slow or remote dataset, where the gap between "shown" and "loaded" is long enough to need reporting.

Must be called after display/show/launch, which is when the startup tracker exists. launch blocks until the window closes, so with it register from code that runs in the event loop.

Parameters:

Name Type Description Default
callback Callable[[int, int], None]

Called with the number of scenes ready and the total.

required

Returns:

Type Description
SubscriptionHandle

Active until its unsubscribe() is called.

Raises:

Type Description
RuntimeError

If the viewer has not been started yet.

on_startup_stalled

on_startup_stalled(callback: Callable[[dict], None]) -> SubscriptionHandle

Fire callback({scene key: state}) if startup does not finish.

The signal that was missing entirely: startup could only ever report success, so a viewer that never finished looked exactly like one still working. The payload names each unfinished scene and the state it stopped in, so the report can say what it was waiting for.

Stalling is not an error -- slow remote data legitimately takes a while -- it is the cue that something is worth looking at. The window is 30 s by default. display(..., stall_timeout=) tunes it (None turns the check off); run, launch and show take no stall_timeout and always use the default.

Must be called after display/show/launch, which is when the startup tracker exists.

Parameters:

Name Type Description Default
callback Callable[[dict], None]

Called with {scene key: StartupState} for every scene that has not finished.

required

Returns:

Type Description
SubscriptionHandle

Active until its unsubscribe() is called.

Raises:

Type Description
RuntimeError

If the viewer has not been started yet.

screenshot

screenshot(*, panel: str | None = None, size: tuple[int, int] | None = None, scale: float = 1.0, frames: int | Literal['converged'] = 1, save: str | Path | None = None, **capture_kwargs) -> ndarray

Capture one panel, or all four as a 2x2 grid, as RGBA uint8.

Each panel is rendered offscreen, so the result is reproducible and does not need a window.

The capture shows the data currently resident on the GPU -- it does not reslice. Capture from on_ready when a load may still be running. A panel with no canvas renders empty, because slice requests are planned per canvas: give every panel a canvas (the grid builder does, and so does cellier.convenience.capture) and let the reslice finish before capturing.

Parameters:

Name Type Description Default
panel str or None

Which panel to capture: "xy", "xz", "yz" or "vol". With None (default) all four are captured and composited into a 2x2 grid laid out the way build_ortho_grid_widget arranges them -- XY and XZ on the top row, YZ and the 3D volume below.

None
size tuple[int, int] or None

(width, height) per panel, before scale, so a grid capture comes back at twice this in each direction. Defaults to each panel canvas's physical size, or (600, 600) when a panel has no canvas. A grid capture requires one size for all four, so it falls back to (600, 600) unless the panels agree.

None
scale float

Multiplier applied to size.

1.0
frames int or 'converged'

1 (default) draws a single frame with temporal accumulation off. "converged" draws the number of frames the accumulator needs to settle. This matters more here than elsewhere: the vol panel has accumulation enabled while the three slice panels do not, so a fixed frames=N is right for one panel and wrong for three.

1
save str, Path, or None

When given, also write the frame to this path as a PNG.

None
**capture_kwargs

Forwarded to the capture helper.

{}

Returns:

Type Description
ndarray

RGBA uint8 array: (height, width, 4) for one panel, or (2 * height, 2 * width, 4) for the grid.

Raises:

Type Description
ValueError

If panel is not one of the four panel keys.

Notes

The grid composite is canvases only. The Qt grid carries XY / XZ / YZ / 3D labels above the panels; those are chrome and do not appear here. Use screenshot_window for a picture with the labels and docks in it.

on_ready

on_ready(callback: Callable[[], None]) -> SubscriptionHandle

Register a callback fired once all panels' startup data is on the GPU.

The callback runs after the initial reslice triggered by launch / show has committed every visual across all four panel scenes. Use it to hide a loading indicator, capture a screenshot, or enable controls once the first view is fully loaded.

Fires once, on the first startup. Register it before or after display/launch/show: before startup has finished it waits, and after that it runs at once. For one panel, use on_scene_ready.

Parameters:

Name Type Description Default
callback Callable[[], None]

Zero-argument callback.

required

Returns:

Type Description
SubscriptionHandle

Active until callback fires; its unsubscribe() cancels the callback. Already inactive when startup had finished and callback ran before this returned.

to_file

to_file(path: str | Path) -> None

Serialize the orthoviewer model state to a JSON file.

Captures the four scenes (dims, slice positions), visuals, data stores, canvases with their camera models, and the render pipeline configuration. The live dims mirroring is not serialized -- the panels are saved in agreement -- and from_file re-establishes it. The cameras are saved with their poses, which from_file restores; the gui toolkit is not saved.

Parameters:

Name Type Description Default
path str or Path

Destination file path.

required

from_file classmethod

from_file(path: str | Path, *, link_axes: bool = True, link_clipping_planes: ClippingLinkMode = 'all', render_config: RenderManagerConfig | None = None, gui: Literal['qt', 'anywidget', 'offscreen'] = 'qt') -> OrthoViewer

Restore an OrthoViewer from a previously serialized file.

The four panels are rebound by scene name (xy, xz, yz, vol) and the spatial axes are recovered from the vol panel's displayed axes -- no extra metadata is stored. Dims mirroring is re-established when link_axes is True.

The clipping plane links are rebuilt too. The panel visuals of each dataset are found by name and type (f"{name}_{key}", as image_group does; datasets of one name and type are paired in the order they were added) and linked as link_clipping_planes says. The mode is not in the file. A load does not rewrite what was saved: a file whose panels differ where the mode would link them (saved in "2d" with the 3D panel's planes moved, loaded with "all") is refused.

Each panel camera starts at its saved pose, which launch / show / display keep with their default fit=None.

Parameters:

Name Type Description Default
path str or Path

Path to a JSON file written by to_file.

required
link_axes bool

Re-establish the cross-panel dims mirroring. Default True.

True
link_clipping_planes ('all', '2d')

The clipping link mode; see OrthoViewer. Pass the mode the viewer was saved in.

"all"
render_config RenderManagerConfig or None

Override the serialized render pipeline configuration.

None
gui ('qt', 'anywidget', 'offscreen')

Toolkit to build the canvases with; the file does not record one. The canvases are built during this call, so "qt" (the default) needs a QApplication first.

"qt"

Returns:

Type Description
OrthoViewer

Raises:

Type Description
ValueError

If the file does not contain exactly the four expected panels, or the panels of a dataset carry different clipping planes where link_clipping_planes links them.

center_slices

center_slices() -> None

Move the three spatial slice positions to the middle of the data.

Reads the world-space extent of the loaded visuals and sets every panel's position on each spatial axis to its midpoint -- once, through the dims controller when the panels are linked. Extra-axis positions are left unchanged. Call after adding data.

Raises:

Type Description
ValueError

If no visuals with known shapes have been added yet.

set_slice_positions

set_slice_positions(positions: Mapping[int, float], *, interactive: bool = False) -> None

Move the slice position of one or more world axes on every panel.

Once, through the dims controller, when the panels are linked. By default a jump: every visual loads in full at once. With interactive=True, or inside dims_interaction, it is a tick of a scrub; see CellierController.update_slice_indices.

Parameters:

Name Type Description Default
positions Mapping[int, float]

World axis index -> world position. Other axes keep theirs.

required
interactive bool

Whether the move is a tick of a scrub.

False

dims_interaction

dims_interaction() -> Generator[None, None, None]

Scrub the dims of all four panels for the length of a with block.

Every slice-position move inside the block is a scrub tick on every panel it changes, so a player loads coarse while it runs and in full when the block exits:

with viewer.dims_interaction():
    for t in range(n_frames):
        viewer.set_slice_positions({0: t})

transform_interaction

transform_interaction(visual: UUID | object | dict[str, object]) -> Generator[None, None, None]

Drag one visual's transform in every panel for a with block.

Opens CellierController.transform_interaction on every panel's copy of the visual, so each panel plans coarse while the transform changes (when its view's moving setting is on) and in full when the block exits, and a tilted 2D panel switches onto the brick route with about a one-frame gap:

with viewer.transform_interaction(visuals):
    for angle in angles:
        for copy in visuals.values():
            copy.transform = rotated(copy, angle)

Parameters:

Name Type Description Default
visual (UUID, visual or dict[str, visual])

Any panel's copy (or its id), or the dict a fanned-out add_* returned.

required

get_camera_state

get_camera_state(panel: str) -> CameraState

Return a snapshot of one panel's camera.

Parameters:

Name Type Description Default
panel ('xy', 'xz', 'yz', 'vol')

The panel.

"xy"

Raises:

Type Description
ValueError

If panel is not a panel key, or the panel has no canvas yet.

set_camera_state

set_camera_state(panel: str, state: CameraState, *, interactive: bool = False) -> None

Move one panel's camera to state.

The four cameras are independent. By default a jump; with interactive=True, or inside camera_interaction, a tick of a motion. See CellierController.set_camera_state.

Parameters:

Name Type Description Default
panel ('xy', 'xz', 'yz', 'vol')

The panel.

"xy"
state CameraState

The state to apply; get_camera_state returns one.

required
interactive bool

Whether the move is a tick of a motion.

False

Raises:

Type Description
ValueError

If panel is not a panel key, the panel has no canvas yet, state is for the other kind of camera, or its controller_state is for the other kind of controller.

fit_camera

fit_camera(panel: str | None = None, *, interactive: bool = False, only_visible_visuals: bool = False) -> None

Fit a panel's camera, or every panel's, to its scene.

Parameters:

Name Type Description Default
panel ('xy', 'xz', 'yz', 'vol')

The panel to fit. None (default) fits all four.

"xy"
interactive bool

Whether the move is a tick of a camera motion instead of a jump.

False
only_visible_visuals bool

Fit to the visuals that are shown only. The far plane still keeps every visual in view. Default False: hidden visuals count.

False

Raises:

Type Description
ValueError

If panel is not a panel key.

camera_interaction

camera_interaction(panel: str) -> Generator[None, None, None]

Move one panel's camera as one motion for a with block.

Parameters:

Name Type Description Default
panel ('xy', 'xz', 'yz', 'vol')

The panel whose camera moves.

"xy"

Raises:

Type Description
ValueError

If panel is not a panel key, or the panel has no canvas yet.

add_image

add_image(data: ImageMemoryStore | UUID, appearance: InMemoryImageAppearance | None = None, name: str = 'image', controls: list[Control] | None = None, *, single: InMemoryImageSingleAppearance | None = None, channel_axis: int | None = None, composite: bool = False, channels: dict[int, InMemoryImageChannelAppearance] | None = None, max_channels: int = 4, outline: VisualOutline | None = None, ambient_occlusion: bool | None = None, clipping_planes: Sequence[ClippingPlane] = (), render_planes: Sequence[RenderPlane] = (), transform: BaseTransform | None = None, render_config: InMemoryImageRenderConfig | None = None) -> dict[str, ImageVisual]

Add an in-memory image to every panel from a single data store.

Each panel gets its own visual model with its own copy of the appearances. set_image_composite, update_image_single_field and update_image_channel_field set all four panels at once. The image controls instead drive the 2D panels and the 3D panel separately, so the two can differ. A composited axis cannot be one of the spatial axes, since some panel always displays it.

Parameters:

Name Type Description Default
data ImageMemoryStore or UUID

Backing data store or the UUID of an already-registered store.

required
appearance InMemoryImageAppearance or None

Shared by both modes.

None
name str

Base label; each panel's visual is named f"{name}_{key}".

'image'
controls list[Control] or None

The controls to show for this visual: a list of control models, drawn in the order of the list. The image's fields are chosen with ImageControl(fields=[...]). The list is used for two groups of controls: one drives the three 2D panels' visuals together, the other the 3D panel's. RenderPlanesControl() is drawn for the 3D group only, and ClippingPlanesControl() in the OrthoClippingControls() dock. None (default) or an empty list shows none.

None
single single appearance or None

Single mode's appearance. None uses the defaults.

None
channel_axis int or None

The data axis a composite draws channels along; it must map to a world axis. None (default) gives an image with no channels.

None
composite bool

Start in composite mode. Requires channel_axis.

False
channels dict[int, channel appearance] or None

Composite mode's per-channel appearances.

None
max_channels int

The most channels the visual may hold. Default 4.

4
outline VisualOutline or None

Screen-space outline assignment.

None
ambient_occlusion bool or None

Whether this visual receives ambient occlusion.

None
clipping_planes Sequence[ClippingPlane]

Clipping planes, in the store's level-0 data coordinates: the visual is drawn only on the kept side of every enabled plane. Build them from data.data_coordinate_systems[0]. They can be changed later by assigning visual.clipping_planes. Default none.

()
render_planes Sequence[RenderPlane]

The planes the "plane" render mode draws the data on, in the scene's world coordinates (RenderPlane.from_point_normal(viewer.scene.dims. world_coordinate_system, ...)). Ignored in every other render mode. They can be changed later with controller.set_render_planes. Default none. Given to the 3D panel's visual only: the 2D panels show their slices. Replaced by the slice planes while plane_controller.mode is "slices".

()
transform BaseTransform or None

The data -> world transform, shared by every panel's visual. None (default) is the identity.

None
render_config InMemoryImageRenderConfig or None

The GPU configuration of the brick route, which draws a tilted 2D view of the image. None uses the defaults.

None

Returns:

Type Description
dict[str, ImageVisual]

The per-panel visuals keyed "xy", "xz", "yz", "vol".

add_labels

add_labels(data: LabelMemoryStore | UUID, appearance: BaseLabelsAppearance | None = None, name: str = 'labels', transform: BaseTransform | None = None, controls: list[Control] | None = None, outline: VisualOutline | None = None, ambient_occlusion: bool | None = None, outline_selected_labels: dict[int, int] | None = None, clipping_planes: Sequence[ClippingPlane] = (), render_planes: Sequence[RenderPlane] = (), render_config: InMemoryLabelRenderConfig | None = None) -> dict[str, LabelMemoryVisual]

Add an in-memory label image to every panel from one data store.

Parameters:

Name Type Description Default
data LabelMemoryStore or UUID

Backing data store or the UUID of an already-registered store.

required
appearance BaseLabelsAppearance or None

Appearance parameters. Defaults to InMemoryLabelsAppearance() when None.

None
name str

Base label; each panel's visual is named f"{name}_{key}".

'labels'
transform BaseTransform or None

Data-to-world transform. Defaults to identity when None.

None
controls list[Control] or None

The controls to show for this visual: a list of control models, drawn in the order of the list. The visual's fields are chosen with FieldControls([...]). The list is used for two groups of controls: one drives the three 2D panels' visuals together, the other the 3D panel's. RenderPlanesControl() is drawn for the 3D group only, and ClippingPlanesControl() in the OrthoClippingControls() dock. None (default) or an empty list shows none.

None
outline VisualOutline or None

Screen-space outline assignment. None (default) leaves the visual unoutlined. Requires the outline pass to be enabled; see outline_enabled.

None
ambient_occlusion bool or None

Whether this visual receives ambient occlusion. None (default) is automatic: excluded while it renders in a MIP-family mode, included otherwise.

None
outline_selected_labels dict[int, int] or None

Maps a label value to the palette slot the selection layer draws it in. None (default) selects no label, so an outlined labels visual shows boundaries only.

None
clipping_planes Sequence[ClippingPlane]

Clipping planes, in the store's level-0 data coordinates: the visual is drawn only on the kept side of every enabled plane. Build them from data.data_coordinate_systems[0]. They can be changed later by assigning visual.clipping_planes. Default none.

()
render_planes Sequence[RenderPlane]

The planes the "plane" render mode draws the data on, in the scene's world coordinates (RenderPlane.from_point_normal(viewer.scene.dims. world_coordinate_system, ...)). Ignored in every other render mode. They can be changed later with controller.set_render_planes. Default none. Given to the 3D panel's visual only: the 2D panels show their slices. Replaced by the slice planes while plane_controller.mode is "slices".

()
render_config InMemoryLabelRenderConfig or None

The GPU configuration of the brick route, which draws a tilted 2D view of the labels. None uses the defaults.

None

Returns:

Type Description
dict[str, LabelMemoryVisual]

add_mesh

add_mesh(data: MeshMemoryStore | UUID, appearance: MeshAppearance, name: str = 'mesh', transform: BaseTransform | None = None, controls: list[Control] | None = None, outline: VisualOutline | None = None, ambient_occlusion: bool | None = None, section: MeshSectionConfig | None = None, clipping_planes: Sequence[ClippingPlane] = ()) -> dict[str, MeshVisual]

Add a mesh to every panel from a single data store.

Parameters:

Name Type Description Default
data MeshMemoryStore or UUID

Backing data store or the UUID of an already-registered store.

required
appearance MeshFlatAppearance or MeshPhongAppearance

Appearance parameters. When passing a dict, include the appearance_type key ("flat" or "phong").

required
name str

Base label; each panel's visual is named f"{name}_{key}".

'mesh'
transform BaseTransform or None

Data-to-world transform. Defaults to identity when None.

None
controls list[Control] or None

The controls to show for this visual: a list of control models, drawn in the order of the list. The visual's fields are chosen with FieldControls([...]). The list is used for two groups of controls: one drives the three 2D panels' visuals together, the other the 3D panel's. RenderPlanesControl() is drawn for the 3D group only, and ClippingPlanesControl() in the OrthoClippingControls() dock. None (default) or an empty list shows none.

None
outline VisualOutline or None

Screen-space outline assignment. None (default) leaves the visual unoutlined. Requires the outline pass to be enabled; see outline_enabled.

None
ambient_occlusion bool or None

Whether this visual receives ambient occlusion. None (default) is automatic: excluded while it renders in a MIP-family mode, included otherwise.

None
section MeshSectionConfig or None

How the mesh is drawn in a 2D view: the outline and fill of its cross-section, and whether the cut is the slice plane (mode="cut") or the scene's slab (mode="slab"). None (default) is an outline and a fill of the cut. Each panel's visual gets its own copy.

None
clipping_planes Sequence[ClippingPlane]

Clipping planes, in the store's level-0 data coordinates: the visual is drawn only on the kept side of every enabled plane. Build them from data.data_coordinate_systems[0]. They can be changed later by assigning visual.clipping_planes. Default none.

()

Returns:

Type Description
dict[str, MeshVisual]

add_multiscale_mesh

add_multiscale_mesh(data: MultiscaleMeshStore | UUID, appearance: MeshAppearance, name: str = 'mesh', transform: BaseTransform | None = None, controls: list[Control] | None = None, outline: VisualOutline | None = None, ambient_occlusion: bool | None = None, section: MeshSectionConfig | None = None, lod: GeometryLodConfig | None = None, clipping_planes: Sequence[ClippingPlane] = ()) -> dict[str, MultiscaleMeshVisual]

Add a mesh with levels of detail to every panel, from one store.

Each panel keeps two levels loaded, the finest and one coarse level. The three 2D panels draw the cross-section of the level; the 3D panel draws the surface. A dims scrub loads the coarse level only until it ends, and the 3D panel draws the coarse level while its camera moves.

Parameters:

Name Type Description Default
data MultiscaleMeshStore or UUID

The mesh's levels, finest first, or the UUID of an already-registered store.

required
appearance MeshFlatAppearance or MeshPhongAppearance

Appearance parameters, shared by both levels.

required
name str

Base label; each panel's visual is named f"{name}_{key}".

'mesh'
transform BaseTransform or None

Data-to-world transform. Defaults to identity when None.

None
controls list[Control] or None

The controls to show for this visual: a list of control models, drawn in the order of the list. The visual's fields are chosen with FieldControls([...]). The list is used for two groups of controls: one drives the three 2D panels' visuals together, the other the 3D panel's. RenderPlanesControl() is drawn for the 3D group only, and ClippingPlanesControl() in the OrthoClippingControls() dock. None (default) or an empty list shows none.

None
outline VisualOutline or None

Screen-space outline assignment; see add_mesh.

None
ambient_occlusion bool or None

Whether this visual receives ambient occlusion; see add_mesh.

None
section MeshSectionConfig or None

How the mesh is drawn in a 2D view; see add_mesh. Each panel's visual gets its own copy.

None
lod GeometryLodConfig or None

Which coarse level is kept (the coarsest by default), what a dims scrub loads and draws, and what a moving camera draws. The same for every panel; change it later with set_lod_config.

None
clipping_planes Sequence[ClippingPlane]

Clipping planes, in the store's level-0 data coordinates: the visual is drawn only on the kept side of every enabled plane. Build them from data.data_coordinate_systems[0]. They can be changed later by assigning visual.clipping_planes. Default none.

()

Returns:

Type Description
dict[str, MultiscaleMeshVisual]

add_points

add_points(data: PointsMemoryStore | UUID, appearance: PointsMarkerAppearance | None = None, name: str = 'points', transform: BaseTransform | None = None, controls: list[Control] | None = None, outline: VisualOutline | None = None, ambient_occlusion: bool | None = None, clipping_planes: Sequence[ClippingPlane] = ()) -> dict[str, PointsVisual]

Add a points visual to every panel from a single data store.

Parameters:

Name Type Description Default
data PointsMemoryStore or UUID

Backing data store or the UUID of an already-registered store.

required
appearance PointsMarkerAppearance or None

Appearance parameters. Defaults to PointsMarkerAppearance() when None.

None
name str

Base label; each panel's visual is named f"{name}_{key}".

'points'
transform BaseTransform or None

Data-to-world transform. Defaults to identity when None.

None
controls list[Control] or None

The controls to show for this visual: a list of control models, drawn in the order of the list. The visual's fields are chosen with FieldControls([...]). The list is used for two groups of controls: one drives the three 2D panels' visuals together, the other the 3D panel's. RenderPlanesControl() is drawn for the 3D group only, and ClippingPlanesControl() in the OrthoClippingControls() dock. None (default) or an empty list shows none.

None
outline VisualOutline or None

Screen-space outline assignment. None (default) leaves the visual unoutlined. Requires the outline pass to be enabled; see outline_enabled.

None
ambient_occlusion bool or None

Whether this visual receives ambient occlusion. None (default) is automatic: excluded while it renders in a MIP-family mode, included otherwise.

None
clipping_planes Sequence[ClippingPlane]

Clipping planes, in the store's level-0 data coordinates: the visual is drawn only on the kept side of every enabled plane. Build them from data.data_coordinate_systems[0]. They can be changed later by assigning visual.clipping_planes. Default none.

()

Returns:

Type Description
dict[str, PointsVisual]

add_graph

add_graph(data: GraphMemoryStore | UUID, appearance: GraphAppearance | None = None, name: str = 'graph', transform: BaseTransform | None = None, trail: dict[int, TrailConfig] | None = None, controls: list[Control] | None = None, outline: VisualOutline | None = None, ambient_occlusion: bool | None = None, clipping_planes: Sequence[ClippingPlane] = ()) -> dict[str, GraphVisual]

Add a spatial-graph visual to every panel from a single data store.

Parameters:

Name Type Description Default
data GraphMemoryStore or UUID

Backing data store or the UUID of an already-registered store.

required
appearance GraphAppearance or None

Appearance parameters. Defaults to GraphAppearance() when None.

None
name str

Base label; each panel's visual is named f"{name}_{key}".

'graph'
transform BaseTransform or None

Data-to-world transform. Falls back to the store's own transform, then to identity.

None
trail dict[int, TrailConfig] or None

Axis index -> window configuration, applied to every panel.

None
controls list[Control] or None

The controls to show for this visual: a list of control models, drawn in the order of the list. The visual's fields are chosen with FieldControls([...]). The list is used for two groups of controls: one drives the three 2D panels' visuals together, the other the 3D panel's. RenderPlanesControl() is drawn for the 3D group only, and ClippingPlanesControl() in the OrthoClippingControls() dock. None (default) or an empty list shows none.

None
outline VisualOutline or None

Screen-space outline assignment. None (default) leaves the visual unoutlined. Requires the outline pass to be enabled; see outline_enabled.

None
ambient_occlusion bool or None

Whether this visual receives ambient occlusion. None (default) is automatic: excluded while it renders in a MIP-family mode, included otherwise.

None
clipping_planes Sequence[ClippingPlane]

Clipping planes, in the store's level-0 data coordinates: the visual is drawn only on the kept side of every enabled plane. Build them from data.data_coordinate_systems[0]. They can be changed later by assigning visual.clipping_planes. Default none.

()

Returns:

Type Description
dict[str, GraphVisual]

add_lines

add_lines(data: LinesMemoryStore | UUID, appearance: LinesMemoryAppearance | None = None, name: str = 'lines', transform: BaseTransform | None = None, controls: list[Control] | None = None, outline: VisualOutline | None = None, ambient_occlusion: bool | None = None, clipping_planes: Sequence[ClippingPlane] = ()) -> dict[str, LinesVisual]

Add a lines visual to every panel from a single data store.

Parameters:

Name Type Description Default
data LinesMemoryStore or UUID

Backing data store or the UUID of an already-registered store.

required
appearance LinesMemoryAppearance or None

Appearance parameters. Defaults to LinesMemoryAppearance() when None.

None
name str

Base label; each panel's visual is named f"{name}_{key}".

'lines'
transform BaseTransform or None

Data-to-world transform. Defaults to identity when None.

None
controls list[Control] or None

The controls to show for this visual: a list of control models, drawn in the order of the list. The visual's fields are chosen with FieldControls([...]). The list is used for two groups of controls: one drives the three 2D panels' visuals together, the other the 3D panel's. RenderPlanesControl() is drawn for the 3D group only, and ClippingPlanesControl() in the OrthoClippingControls() dock. None (default) or an empty list shows none.

None
outline VisualOutline or None

Screen-space outline assignment. None (default) leaves the visual unoutlined. Requires the outline pass to be enabled; see outline_enabled.

None
ambient_occlusion bool or None

Whether this visual receives ambient occlusion. None (default) is automatic: excluded while it renders in a MIP-family mode, included otherwise.

None
clipping_planes Sequence[ClippingPlane]

Clipping planes, in the store's level-0 data coordinates: the visual is drawn only on the kept side of every enabled plane. Build them from data.data_coordinate_systems[0]. They can be changed later by assigning visual.clipping_planes. Default none.

()

Returns:

Type Description
dict[str, LinesVisual]

add_image_multiscale

add_image_multiscale(data: BaseDataStore | UUID, appearance: MultiscaleImageAppearance | None = None, name: str = 'image', render_config: MultiscaleImageRenderConfig | None = None, transform: BaseTransform | None = None, controls: list[Control] | None = None, *, single: MultiscaleImageSingleAppearance | None = None, channel_axis: int | None = None, composite: bool = False, channels: dict[int, MultiscaleImageChannelAppearance] | None = None, max_channels: int = 4, outline: VisualOutline | None = None, ambient_occlusion: bool | None = None, clipping_planes: Sequence[ClippingPlane] = (), render_planes: Sequence[RenderPlane] = ()) -> dict[str, MultiscaleImageVisual]

Add a multiscale image to every panel from a single data store.

See add_image for the modes and the group methods.

Parameters:

Name Type Description Default
data BaseDataStore or UUID

Backing multiscale store or UUID of an already-registered store.

required
appearance MultiscaleImageAppearance or None

Shared by both modes.

None
name str

Base label; each panel's visual is named f"{name}_{key}".

'image'
render_config MultiscaleImageRenderConfig or None

GPU cache configuration. Uses defaults when None.

None
transform BaseTransform or None

Data-to-world transform. Defaults to identity when None.

None
controls list[Control] or None

The controls to show for this visual: a list of control models, drawn in the order of the list. The image's fields are chosen with ImageControl(fields=[...]). The list is used for two groups of controls: one drives the three 2D panels' visuals together, the other the 3D panel's. RenderPlanesControl() is drawn for the 3D group only, and ClippingPlanesControl() in the OrthoClippingControls() dock. None (default) or an empty list shows none.

None
single single appearance or None

Single mode's appearance. None uses the defaults.

None
channel_axis int or None

The data axis a composite draws channels along; it must map to a world axis. None (default) gives an image with no channels.

None
composite bool

Start in composite mode. Requires channel_axis.

False
channels dict[int, channel appearance] or None

Composite mode's per-channel appearances.

None
max_channels int

The most channels the visual may hold. Default 4.

4
outline VisualOutline or None

Screen-space outline assignment.

None
ambient_occlusion bool or None

Whether this visual receives ambient occlusion.

None
clipping_planes Sequence[ClippingPlane]

Clipping planes, in the store's level-0 data coordinates: the visual is drawn only on the kept side of every enabled plane. Build them from data.data_coordinate_systems[0]. They can be changed later by assigning visual.clipping_planes. Default none.

()
render_planes Sequence[RenderPlane]

The planes the "plane" render mode draws the data on, in the scene's world coordinates (RenderPlane.from_point_normal(viewer.scene.dims. world_coordinate_system, ...)). Ignored in every other render mode. They can be changed later with controller.set_render_planes. Default none. Given to the 3D panel's visual only: the 2D panels show their slices. Replaced by the slice planes while plane_controller.mode is "slices".

()

Returns:

Type Description
dict[str, MultiscaleImageVisual]

add_labels_multiscale

add_labels_multiscale(data: BaseDataStore | UUID, appearance: MultiscaleLabelsAppearance | None = None, name: str = 'labels', render_config: MultiscaleLabelRenderConfig | None = None, transform: BaseTransform | None = None, controls: list[Control] | None = None, outline: VisualOutline | None = None, ambient_occlusion: bool | None = None, outline_selected_labels: dict[int, int] | None = None, clipping_planes: Sequence[ClippingPlane] = (), render_planes: Sequence[RenderPlane] = ()) -> dict[str, MultiscaleLabelVisual]

Add a multiscale label image to every panel from one data store.

Parameters:

Name Type Description Default
data BaseDataStore or UUID

Backing multiscale label store or UUID of an already-registered store.

required
appearance MultiscaleLabelsAppearance or None

Appearance parameters. Defaults to MultiscaleLabelsAppearance() when None, one per panel.

None
name str

Base label; each panel's visual is named f"{name}_{key}".

'labels'
render_config MultiscaleLabelRenderConfig or None

LOD and rendering configuration. Uses defaults when None.

None
transform BaseTransform or None

Data-to-world transform. Defaults to identity when None.

None
controls list[Control] or None

The controls to show for this visual: a list of control models, drawn in the order of the list. The visual's fields are chosen with FieldControls([...]). The list is used for two groups of controls: one drives the three 2D panels' visuals together, the other the 3D panel's. RenderPlanesControl() is drawn for the 3D group only, and ClippingPlanesControl() in the OrthoClippingControls() dock. None (default) or an empty list shows none.

None
outline VisualOutline or None

Screen-space outline assignment. None (default) leaves the visual unoutlined. Requires the outline pass to be enabled; see outline_enabled.

None
ambient_occlusion bool or None

Whether this visual receives ambient occlusion. None (default) is automatic: excluded while it renders in a MIP-family mode, included otherwise.

None
outline_selected_labels dict[int, int] or None

Maps a label value to the palette slot the selection layer draws it in. None (default) selects no label, so an outlined labels visual shows boundaries only.

None
clipping_planes Sequence[ClippingPlane]

Clipping planes, in the store's level-0 data coordinates: the visual is drawn only on the kept side of every enabled plane. Build them from data.data_coordinate_systems[0]. They can be changed later by assigning visual.clipping_planes. Default none.

()
render_planes Sequence[RenderPlane]

The planes the "plane" render mode draws the data on, in the scene's world coordinates (RenderPlane.from_point_normal(viewer.scene.dims. world_coordinate_system, ...)). Ignored in every other render mode. They can be changed later with controller.set_render_planes. Default none. Given to the 3D panel's visual only: the 2D panels show their slices. Replaced by the slice planes while plane_controller.mode is "slices".

()

Returns:

Type Description
dict[str, MultiscaleLabelVisual]

image_group

image_group(visual: object) -> list[UUID]

The four panel siblings of an image added with add_image*.

Parameters:

Name Type Description Default
visual UUID, visual model, or dict

Any panel's visual (or its id), or the dict add_image* returned.

required

Returns:

Type Description
list[UUID]

The sibling visual ids, in panel order.

Raises:

Type Description
KeyError

If visual is not a panel image of this viewer.

loading_progress

loading_progress(visual: object) -> LoadingProgress | None

How far a multiscale visual's four panels have loaded, summed.

Mirrors CellierController.loading_progress over the panel group: counts are added and the completion flags hold only when they hold for every panel.

Parameters:

Name Type Description Default
visual UUID, visual model, or dict

Any panel's multiscale visual; see image_group.

required

Returns:

Type Description
LoadingProgress or None

None while no panel has been planned.

on_reslice_progress

on_reslice_progress(visual: object, callback: Callable[[ResliceProgressEvent], None], *, owner_id: UUID | None = None, weak: bool = False) -> SubscriptionHandle

Register a callback fired as a multiscale visual's panels load.

Mirrors CellierController.on_reslice_progress over the panel group. The callback gets each panel's event with progress replaced by the group sum (loading_progress); visual_id and scene_id name the panel whose change triggered it.

Parameters:

Name Type Description Default
visual UUID, visual model, or dict

Any panel's multiscale visual; see image_group.

required
callback Callable

Called with a ResliceProgressEvent.

required
owner_id UUID or None

Owner for controller.unsubscribe_owner. Defaults to each panel visual's id, so removing a panel's visual removes its subscription.

None
weak bool

If True, hold only a weak reference to callback.

False

Returns:

Type Description
SubscriptionHandle

One handle for the subscriptions on every panel: its unsubscribe() removes them all, and it reads as active while any panel's is left. With weak=True it goes inactive at the first event after callback is garbage-collected.

on_backstop_complete

on_backstop_complete(visual: object, callback: Callable[[BackstopCompleteEvent], None], *, owner_id: UUID | None = None, weak: bool = False) -> SubscriptionHandle

Register a callback fired when every panel's backstop is in.

Mirrors CellierController.on_backstop_complete over the panel group: fires on the panel event that completes the group, with that panel's event.

Parameters:

Name Type Description Default
visual UUID, visual model, or dict

Any panel's multiscale visual; see image_group.

required
callback Callable

Called with a BackstopCompleteEvent.

required
owner_id UUID or None

Owner for controller.unsubscribe_owner. Defaults to each panel visual's id.

None
weak bool

If True, hold only a weak reference to callback.

False

Returns:

Type Description
SubscriptionHandle

One handle for the subscriptions on every panel: its unsubscribe() removes them all, and it reads as active while any panel's is left. With weak=True it goes inactive at the first event after callback is garbage-collected.

set_loading

set_loading(visual: object, **fields: Any) -> ProgressiveLoadingConfig

Change how every panel of a multiscale visual loads.

Mirrors CellierController.set_loading_config, applied to each panel. The merged config is validated before any panel changes, so an invalid combination raises and changes nothing.

Parameters:

Name Type Description Default
visual UUID, visual model, or dict

Any panel's multiscale visual; see image_group.

required
**fields Any

ProgressiveLoadingConfig fields, e.g. backstop_extent="view".

{}

Returns:

Type Description
ProgressiveLoadingConfig

The first panel's config after the call.

set_lod_config

set_lod_config(visual: object, **fields: Any) -> GeometryLodConfig

Change the level-of-detail settings of every panel of a mesh.

Mirrors CellierController.set_lod_config, applied to each panel. The merged config is validated before any panel changes, so an invalid value raises and changes nothing.

Parameters:

Name Type Description Default
visual UUID, visual model, or dict

Any panel's multiscale mesh, or the dict add_multiscale_mesh returned.

required
**fields Any

GeometryLodConfig fields, e.g. camera_motion="full". coarse_level cannot be changed.

{}

Returns:

Type Description
GeometryLodConfig

The first panel's config after the call.

add_clipping_plane_gizmo

add_clipping_plane_gizmo(visual: object, plane: ClippingPlane | UUID) -> ClippingPlaneGizmoController

Put a gizmo on one clipping plane of a visual, in the 3D panel.

Dragging the gizmo moves and tilts the plane. The 2D panels follow when the panels' planes are linked (clipping_controller.mode "all", the default). Mirrors CellierController.add_clipping_plane_gizmo: the 3D panel has one gizmo at a time.

Parameters:

Name Type Description Default
visual UUID, visual model, or dict

Any panel's visual, or the dict an add_* method returned.

required
plane ClippingPlane or UUID

One of the 3D panel's visual's clipping_planes, or its id. With the mode "2d" or None the 3D panel has its own planes, and a plane of a 2D panel only is not one of them.

required

Returns:

Type Description
ClippingPlaneGizmoController

The session. close() ends it.

Raises:

Type Description
KeyError

If the 3D panel's visual has no plane with that id.

ValueError

If the 3D panel has no canvas yet, or the plane has a component on an axis the 3D panel does not show.

add_render_plane_gizmo

add_render_plane_gizmo(visual: object, plane: RenderPlane | UUID) -> RenderPlaneGizmoController

Put a gizmo on one render plane of a visual, in the 3D panel.

Dragging the gizmo moves, turns and resizes the plane. Mirrors CellierController.add_render_plane_gizmo: the 3D panel has one gizmo at a time, clipping planes included.

Parameters:

Name Type Description Default
visual UUID, visual model, or dict

Any panel's visual, or the dict an add_* method returned.

required
plane RenderPlane or UUID

One of the 3D panel's visual's render_planes, or its id.

required

Returns:

Type Description
RenderPlaneGizmoController

The session. close() ends it.

Raises:

Type Description
KeyError

If the 3D panel's visual has no render plane with that id.

ValueError

If plane_controller.mode is "slices" (the slice planes follow the 2D sliders and have no gizmo), the 3D panel has no canvas yet, or its visual is not in the "plane" render mode.

remove_plane_gizmo

remove_plane_gizmo() -> None

Close the 3D panel's plane gizmo, of either kind; nothing if none.

set_image_composite

set_image_composite(visual: object, composite: bool) -> None

Switch every panel's image between single and composite mode.

Parameters:

Name Type Description Default
visual UUID, visual model, or dict

Any panel's visual; see image_group.

required
composite bool

True for composite mode.

required

update_image_single_field

update_image_single_field(visual: object, field: str, value) -> None

Set one single-mode field on every panel's image.

Parameters:

Name Type Description Default
visual UUID, visual model, or dict

Any panel's visual; see image_group.

required
field str

Field name on single.

required
value

New value.

required

update_image_channel_field

update_image_channel_field(visual: object, channel_index: int, field: str, value) -> None

Set one channel field on every panel's image.

Parameters:

Name Type Description Default
visual UUID, visual model, or dict

Any panel's visual; see image_group.

required
channel_index int

The channel.

required
field str

Field name on the channel appearance.

required
value

New value.

required

Launching and display

Use run as the entry point for launching a configured viewer. It picks the host from the viewer's gui= argument, constructs the GUI, and launches the application.

cellier.convenience.run

run(viewer: ViewerLike, layout: Layout, *, fit: FitMode | None = None, on_ready: Callable[[], None] | None = None) -> object

Show a viewer, dispatching to the right host based on viewer.gui.

The portable entry point: replaces separate display / launch calls so notebook and script code can be identical up to the gui= argument on Viewer.

  • gui="anywidget" -- calls display (non-blocking; returns a DisplayHandle for Jupyter or the renderable for marimo).
  • gui="qt" -- calls launch (blocking; returns None after the window is closed).

Parameters:

Name Type Description Default
viewer Viewer or OrthoViewer

The viewer whose gui attribute selects the dispatch target.

required
layout Layout

Declarative layout spec.

required
fit ('ready', 'immediate', 'none' or None)

Camera-fit policy applied at startup. None (the default) is "ready", except for a scene whose cameras were all placed from their models (a viewer loaded with from_file), which keeps its view.

None
on_ready Callable[[], None] or None

Optional zero-argument callback fired once every scene's startup data has committed to the GPU.

None

Returns:

Type Description
object

DisplayHandle (or marimo renderable) for anywidget; None for Qt (after the window closes).

Raises:

Type Description
ValueError

If viewer.gui is "offscreen", which has no window to show.

cellier.convenience.launch

launch(viewer: ViewerLike, layout_or_window: object, *, fit: FitMode | None = None, on_ready: Callable[[], None] | None = None, handle_sigint: bool = True) -> None

Show layout_or_window and block until it is closed.

Creates a QApplication if one does not already exist, then starts the Qt + asyncio event loop via PySide6.QtAsyncio. Intended for scripts and the CLI. For interactive / Jupyter use, call show instead.

The initial camera fit and data load are deferred to the canvas's first rendered frame (see CellierController.on_canvas_first_frame), so they run only once the canvas has its final size and the event loop is live — no timer required.

Parameters:

Name Type Description Default
viewer Viewer or OrthoViewer

The viewer whose controller is used for fit_camera / on_scene_ready.

required
layout_or_window Layout or QMainWindow or QWidget

Either a Layout spec (rendered to a QMainWindow by the Qt renderer) or a pre-built top-level Qt window.

required
fit ('ready', 'immediate', 'none' or None)

Camera-fit policy applied at startup. "ready" fits the camera on the first frame and again once the startup data has loaded; "immediate" fits on the first frame only; "none" never fits. Both fit to the box measured from the stores (see CellierController.fit_camera), so they differ only when that box changes while the data loads. None (the default) is "ready", except for a scene whose cameras were all placed from their models (a viewer loaded with from_file), which keeps its view.

None
on_ready Callable[[], None] or None

Optional zero-argument callback fired once, after every scene's startup data has committed to the GPU. Fires in addition to any callbacks registered via viewer.on_ready.

None
handle_sigint bool

Pass True (default) to let QtAsyncio install a SIGINT handler so that Ctrl-C closes the window cleanly.

True

cellier.convenience.show

show(viewer: ViewerLike, layout_or_window: object, *, fit: FitMode | None = None, on_ready: Callable[[], None] | None = None) -> None

Show a viewer window without blocking.

Requires a Qt event loop that is already running (e.g. inside IPython / Jupyter after %gui qt). The initial camera fit and data load are deferred to the canvas's first rendered frame.

Parameters:

Name Type Description Default
viewer Viewer or OrthoViewer

The viewer whose controller is used for fit_camera / on_scene_ready.

required
layout_or_window Layout or QMainWindow or QWidget

Either a Layout spec (rendered to a QMainWindow by the Qt renderer) or a pre-built top-level Qt window.

required
fit ('ready', 'immediate', 'none' or None)

Camera-fit policy applied at startup. "ready" fits the camera on the first frame and again once the startup data has loaded; "immediate" fits on the first frame only; "none" never fits. Both fit to the box measured from the stores (see CellierController.fit_camera), so they differ only when that box changes while the data loads. None (the default) is "ready", except for a scene whose cameras were all placed from their models (a viewer loaded with from_file), which keeps its view.

None
on_ready Callable[[], None] or None

Optional zero-argument callback fired once, after every scene's startup data has committed to the GPU.

None

Raises:

Type Description
RuntimeError

If no QApplication instance is running.

cellier.convenience.display

display(viewer: ViewerLike, layout: Layout, *, fit: FitMode | None = None, on_ready: Callable[[], None] | None = None, host: str | None = None, sidecar: bool | SidecarOptions | None = None, stall_timeout: float | None = _DEFAULT_STALL_TIMEOUT) -> object

Compose and present an anywidget viewer non-blockingly.

The notebook counterpart of launch. Resolves the anywidget host (Jupyter or marimo), renders the layout spec for that host, presents the result, and arms first-frame startup.

Parameters:

Name Type Description Default
viewer Viewer or OrthoViewer

The viewer whose controller drives fit / reslice.

required
layout Layout

Declarative layout spec -- center canvas(es) plus optional dock controls. Build with Layout or its preset (Layout.single).

required
fit ('ready', 'immediate', 'none' or None)

Camera-fit policy applied at startup. "ready" fits the camera on the first frame and again once the startup data has loaded; "immediate" fits on the first frame only; "none" never fits. Both fit to the box measured from the stores (see CellierController.fit_camera), so they differ only when that box changes while the data loads. None (the default) is "ready", except for a scene whose cameras were all placed from their models (a viewer loaded with from_file), which keeps its view.

None
on_ready Callable[[], None] or None

Optional zero-argument callback fired once every scene's startup data has committed to the GPU.

None
host "jupyter", "marimo", or None

Explicit host override; auto-detected when None.

None
stall_timeout float or None

Seconds before startup is reported stalled through viewer.on_startup_stalled. None disables the check.

_DEFAULT_STALL_TIMEOUT
sidecar True, SidecarOptions, or None

Present the viewer in a jupyterlab-sidecar tab instead of below the cell. True uses SidecarOptions defaults. Requires the optional sidecar package and the Jupyter host (not marimo, which already places cell output in its own tab).

None

Returns:

Type Description
object

For imperative hosts (Jupyter) an inert DisplayHandle whose DisplayHandle.close tears down the controls, cancels pending slices, and closes the sidecar panel (if any). For return-value hosts (marimo) the host-native renderable (so the cell renders it), with a best-effort close attached.

cellier.convenience.DisplayHandle

Inert teardown handle returned by display.

Rendering is performed imperatively by the host inside present(); this handle is the cell's return value but has no representation of its own (its _repr_mimebundle_ is empty), so the viewer is rendered exactly once.

Call close to unsubscribe the control panel(s) from the bus, cancel any pending slices, and close the sidecar panel (if any) -- e.g. before re-running a cell so the prior panel and in-flight reads do not leak.

close

close() -> None

Tear down the controls and close the sidecar.

cellier.convenience.SidecarOptions dataclass

Config for opening an anywidget viewer in a jupyterlab-sidecar tab.

Passed as the sidecar= argument to display. Mirrors the constructor of sidecar.Sidecar.

Parameters:

Name Type Description Default
title str or None

Tab title. Defaults to "Cellier"; pass None explicitly to fall back to the sidecar package's own default title.

'Cellier'
anchor SidecarAnchor

Placement of the sidecar panel. "right" (default) docks in the existing right-hand panel; the "split-*" / "tab-*" values open a new, freely re-arrangeable JupyterLab panel instead.

'right'
ref SidecarOptions, DisplayHandle, or None

Anchor the new sidecar relative to another sidecar's panel instead of the notebook. Pass the DisplayHandle returned by a previous display(..., sidecar=...) call.

None

cellier.convenience.StartupState

Bases: str, Enum

How far a scene (or a whole viewer) has got through startup.

Read it from Viewer.startup_state (the whole viewer) or Viewer.scene_startup_states (per scene; one per panel of an OrthoViewer). A scene goes IDLE -> WAITING_FOR_CANVAS -> WAITING_FOR_FRAME -> LOADING -> READY, or ends in STALLED when it makes no progress within the stall window: 30 s by default, set with display(..., stall_timeout=). run, launch and show always use the default.

Ordered: a viewer's aggregate state is the least-advanced of its scenes, so one stuck panel is never hidden behind three finished ones.

IDLE class-attribute instance-attribute

IDLE = 'idle'

Nothing armed yet -- display/launch has not run.

WAITING_FOR_CANVAS class-attribute instance-attribute

WAITING_FOR_CANVAS = 'waiting_for_canvas'

Armed, waiting for the front end to report the canvas is live.

The state an anywidget viewer sits in when the browser never mounted its canvas. On Qt it is normally over in a single event-loop turn.

WAITING_FOR_FRAME class-attribute instance-attribute

WAITING_FOR_FRAME = 'waiting_for_frame'

The canvas is live; waiting for it to render its first frame.

Startup defers the camera fit and the initial load to the first frame, because only then does the canvas have its final size.

LOADING class-attribute instance-attribute

LOADING = 'loading'

The first frame arrived; the initial reslice is in flight.

READY class-attribute instance-attribute

READY = 'ready'

Data is committed to the GPU and the camera has been fitted.

STALLED class-attribute instance-attribute

STALLED = 'stalled'

No progress within the timeout. Records where it stopped.

Not an error -- slow remote data legitimately takes a while -- but the signal that something is worth looking at. A stalled scene keeps its StartupTracker.stalled_at state so the report can say what it was waiting for.

Layout

A Layout describes what goes in the centre of the window and in each dock.

cellier.convenience.Layout dataclass

Full layout specification (the model).

Describes what goes in the center region and each optional dock. Pass to display (anywidget) or launch / show (Qt) to render.

Parameters:

Name Type Description Default
center canvas view or HStack or VStack or Grid

Main content. Typically a single AnywidgetCanvasView / QtCanvasWidget, or a composed layout of multiple canvas views. The 2D/3D toggle is part of the dims control embedded in the canvas view, so it does not need a dock of its own.

required
left_dock object

Content for each dock region. Accepts AppearanceControls, OverlayControls, RenderControls, OrthoClippingControls (ortho viewers), or a stack of those. None hides the dock.

The items of a visual's controls= list need the dock that shows them: an AppearanceControls dock, except that on an OrthoViewer ClippingPlanesControl() needs an OrthoClippingControls dock. Rendering a layout without it raises ValueError, as does adding such a visual afterwards. A dock with no visual to show is fine: it shows a placeholder.

None
right_dock object

Content for each dock region. Accepts AppearanceControls, OverlayControls, RenderControls, OrthoClippingControls (ortho viewers), or a stack of those. None hides the dock.

The items of a visual's controls= list need the dock that shows them: an AppearanceControls dock, except that on an OrthoViewer ClippingPlanesControl() needs an OrthoClippingControls dock. Rendering a layout without it raises ValueError, as does adding such a visual afterwards. A dock with no visual to show is fine: it shows a placeholder.

None
top_dock object

Content for each dock region. Accepts AppearanceControls, OverlayControls, RenderControls, OrthoClippingControls (ortho viewers), or a stack of those. None hides the dock.

The items of a visual's controls= list need the dock that shows them: an AppearanceControls dock, except that on an OrthoViewer ClippingPlanesControl() needs an OrthoClippingControls dock. Rendering a layout without it raises ValueError, as does adding such a visual afterwards. A dock with no visual to show is fine: it shows a placeholder.

None
bottom_dock object

Content for each dock region. Accepts AppearanceControls, OverlayControls, RenderControls, OrthoClippingControls (ortho viewers), or a stack of those. None hides the dock.

The items of a visual's controls= list need the dock that shows them: an AppearanceControls dock, except that on an OrthoViewer ClippingPlanesControl() needs an OrthoClippingControls dock. Rendering a layout without it raises ValueError, as does adding such a visual afterwards. A dock with no visual to show is fine: it shows a placeholder.

None
left_dock_min_width int or None

The narrowest the left / right dock may be, in logical pixels, on both toolkits. Must be at least DOCK_MIN_WIDTH (260 px); a smaller value raises ValueError. None (default) uses DOCK_MIN_WIDTH. It is a floor, not a fixed width: a dock is never narrower than its controls need, so content that needs more widens the dock, and on Qt the dock separator can still drag it wider. A width needs a dock on its side. Top and bottom docks span the window, so they have no width setting.

None
right_dock_min_width int or None

The narrowest the left / right dock may be, in logical pixels, on both toolkits. Must be at least DOCK_MIN_WIDTH (260 px); a smaller value raises ValueError. None (default) uses DOCK_MIN_WIDTH. It is a floor, not a fixed width: a dock is never narrower than its controls need, so content that needs more widens the dock, and on Qt the dock separator can still drag it wider. A width needs a dock on its side. Top and bottom docks span the window, so they have no width setting.

None

__post_init__

__post_init__() -> None

Reject a dock width that is not an int, is too narrow, or has no dock.

dock_min_widths

dock_min_widths() -> dict[str, int | None]

The side docks' minimum widths, keyed "left" / "right".

single classmethod

single(canvas, *, appearance: Literal['left', 'right', 'top', 'bottom'] | bool = False, render: Literal['left', 'right', 'top', 'bottom'] | bool = False) -> Layout

Single-canvas preset.

Controls placed in the same dock stack top to bottom in the order appearance, render.

Parameters:

Name Type Description Default
canvas

Canvas view returned by build_canvas_widget.

required
appearance dock name or False

Where to place appearance controls. False (default) omits them.

False
render dock name or False

Where to place the renderer settings panels (outlines, ambient occlusion, temporal accumulation). False (default) omits them.

False

cellier.convenience.HStack dataclass

Items side by side, left to right.

In Layout.center the items are canvas views or nested HStack/VStack/Grid containers. In a dock the items are dock specs (AppearanceControls, OverlayControls, RenderControls, OrthoClippingControls) or nested stacks; an item that builds nothing is dropped.

Parameters:

Name Type Description Default
items list

The items, in order.

required

cellier.convenience.VStack dataclass

Items one above the other, top to bottom.

Takes the same items as HStack: canvas views or containers in Layout.center, dock specs or stacks in a dock.

Parameters:

Name Type Description Default
items list

The items, in order.

required

cellier.convenience.Grid dataclass

2-D grid of center items.

Parameters:

Name Type Description Default
cells list[list]

Row-major grid; None leaves a cell empty.

required

Dock specs

cellier.convenience.AppearanceControls dataclass

Dock spec: appearance controls for the viewer's configured visuals.

The dock follows the viewer as visuals configured through controls= are added and removed.

Parameters:

Name Type Description Default
presentation 'selector' or 'collapsible_sections'

How the dock presents several visuals. "selector" (default) shows one visual's controls at a time, with a selector above them once two or more visuals are configured. "collapsible_sections" shows every configured visual at once, each in a collapsible section titled with its name. The first section the dock builds starts expanded and every later one collapsed, so adding a visual never pushes open controls down the dock.

'selector'

__post_init__

__post_init__() -> None

Reject an unknown presentation here rather than at render time.

cellier.convenience.OverlayControls dataclass

Dock spec: appearance controls for the viewer's overlays.

One target per overlay -- scene overlays and canvas overlays alike, in the order Viewer.overlays lists them -- each titled with the overlay's name. The dock follows the viewer as overlays are added and removed through add_scene_overlay / add_canvas_overlay / remove_overlay.

Parameters:

Name Type Description Default
presentation 'selector' or 'collapsible_sections'

How the dock presents several overlays; see AppearanceControls. Defaults to "collapsible_sections": overlays have few controls each, so showing them all at once costs little.

'collapsible_sections'

__post_init__

__post_init__() -> None

Reject an unknown presentation here rather than at render time.

cellier.convenience.RenderControls dataclass

Dock spec: one panel per renderer post-processing feature.

Renders the Qt (cellier.gui.qt.render) or anywidget (cellier.gui.anywidget.render) panel for each named section, wired to the viewer's controller. Unlike AppearanceControls this needs no configured visual: render settings belong to the renderer, so the dock is available on any viewer.

Parameters:

Name Type Description Default
sections tuple[str, ...]

Which panels to show, in order. Any of "outline", "ambient_occlusion" and "temporal". Defaults to all three.

('ambient_occlusion', 'outline', 'temporal')

cellier.convenience.OrthoClippingControls dataclass

Dock spec: the clipping planes controls of an OrthoViewer.

At the top, a selector of how the panels' clipping planes are linked ("All views", "2D views", "Not linked"), bound both ways to ortho.clipping_controller.mode. Under it, for every visual whose controls= list holds ClippingPlanesControl(), one clipping planes control per group of linked panels, titled with the visual's name:

============== ================================= ================== Mode Controls per visual Gizmo toggle ============== ================================= ================== "All views" "All views" Yes "2D views" "2D views", "3D view" Only "3D view" "Not linked" "XY", "XZ", "YZ", "3D view" Only "3D view" ============== ================================= ==================

The dock follows the viewer as visuals are added and removed. A visual that has lost some of its panels keeps controls for the panels that are left. With no such visual it shows the selector and a placeholder.

Only for an OrthoViewer; on a Viewer the clipping planes control is part of AppearanceControls. On an OrthoViewer this is the only place the clipping planes controls are shown, so a visual added with ClippingPlanesControl() needs this node in the layout.

Canvas builders

For an application that lays out its own window instead of using Layout: each builder makes a viewer's canvas with its dims sliders, wired to the viewer, on the viewer's toolkit.

cellier.convenience.gui.build_canvas_widget

build_canvas_widget(viewer: Viewer, axis_values: Mapping[int, AxisValues], *, gui: GuiName | None = None, render_modes: set[str] | None = None, initial_dim: str | None = None, fov: float = 70.0, depth_range_3d: tuple[float, float] = (1.0, 8000.0), depth_range_2d: tuple[float, float] = (-500.0, 500.0), canvas_size: tuple[int, int] | None = None, fit_view_direction_3d: Mapping[AxisRef, float] | None = None, fit_up_3d: Mapping[AxisRef, float] | None = None) -> QtCanvasWidget | AnywidgetCanvasView

Build a canvas widget with wired dims sliders for the viewer.

Reuses the viewer's scene's canvas if it has one -- one restored by from_file, or added with add_canvas -- with its camera state, and otherwise creates one. Either way the dims sliders are connected to the controller event bus. For gui="qt" this returns a QtCanvasWidget (canvas above a dims slider panel); for gui="anywidget" it returns an AnywidgetCanvasView holding the canvas and control-panel leaves plus a compose(host) method.

Parameters:

Name Type Description Default
viewer Viewer

The viewer to attach the canvas to.

required
axis_values Mapping[int, AxisValues]

Axis index to the values that axis's slider can take: a ContinuousAxisValues for a free slider or a DiscreteAxisValues for one that steps through listed values. Typically obtained from cellier.convenience.axis_values_from_viewer, with any discrete axes replaced by the caller.

required
gui "qt", "anywidget", or None

GUI toolkit. Defaults to viewer.gui when None; raises if it conflicts with viewer.gui.

None
render_modes set[str] or None

Which camera modes to prepare on a new canvas. Defaults to the scene's own render_modes. This and the arguments below up to fit_up_3d are ignored when an existing canvas is reused, except canvas_size, which still sizes the anywidget view.

None
initial_dim str or None

Which mode is active first on a new canvas. Inferred from the scene's current displayed_axes when None.

None
fov float

Vertical field-of-view in degrees for the 3D perspective camera. Default 70.0.

70.0
depth_range_3d tuple[float, float]

(near, far) clip distances for the 3D camera. Default (1.0, 8000.0). Far is raised when the scene's data needs more; near is kept.

(1.0, 8000.0)
depth_range_2d tuple[float, float]

(near, far) clip distances for the 2D camera. Default (-500.0, 500.0).

(-500.0, 500.0)
canvas_size tuple[int, int] or None

Initial CSS pixel size for the anywidget canvas. Ignored for the Qt gui. Defaults to (600, 600) for the anywidget gui.

None
fit_view_direction_3d Mapping[AxisRef, float] or None

The view direction and up vector the 3D camera is fitted with, each as the component along named world axes, e.g. {"z": -1.0}. None (default) looks along minus all three displayed axes with the first displayed axis up. See CellierController.add_canvas.

None
fit_up_3d Mapping[AxisRef, float] or None

The view direction and up vector the 3D camera is fitted with, each as the component along named world axes, e.g. {"z": -1.0}. None (default) looks along minus all three displayed axes with the first displayed axis up. See CellierController.add_canvas.

None

Returns:

Type Description
QtCanvasWidget or AnywidgetCanvasView

For gui="qt", a widget composing the render surface and dims slider panel (embed canvas_widget.widget). For gui="anywidget", an AnywidgetCanvasView.

Raises:

Type Description
ValueError

If gui conflicts with viewer.gui or is not recognised.

cellier.convenience.gui.AnywidgetCanvasView dataclass

An anywidget canvas leaf plus its dims panel leaf.

Returned by build_canvas_widget for gui="anywidget". Composes to a single column: canvas above the dims sliders.

Appearance controls are not part of this view; put them beside the canvas with Layout(left_dock=AppearanceControls()).

Attributes:

Name Type Description
canvas object

The rendercanvas anywidget canvas.

dims AnywidgetDimsPanel

Axis slice sliders plus the 2D/3D toggle button, below the canvas.

canvas_size tuple[int, int]

The CSS pixel size the canvas was constructed with. Reused by compose as the column's responsive min-width floor.

dims_control property

dims_control: AnywidgetDimsPanel

The bus-facing dims widget, under the name every leaf uses.

QtCanvasWidget spells it dims_control; this spells it dims. One name lets the shared canvas builder wire either without asking which toolkit it is holding.

compose

compose(host: LayoutHost) -> object

Arrange canvas above dims, floored at canvas_size[0].

Called by the viewer's layout, which supplies host (an internal layout backend); not meant to be called from user code.

close

close() -> None

Unsubscribe the dims panel from the bus.

cellier.convenience.gui.build_ortho_grid_widget

build_ortho_grid_widget(ortho: OrthoViewer, axis_values: Mapping[int, AxisValues], *, gui: GuiName | None = None, fov: float = 70.0, depth_range_3d: tuple[float, float] = (1.0, 8000.0), depth_range_2d: tuple[float, float] = (-500.0, 500.0), canvas_size: tuple[int, int] | None = None, fit_view_direction_3d: Mapping[AxisRef, float] | None = None, fit_up_3d: Mapping[AxisRef, float] | None = None) -> OrthoCanvasGrid

Build the 2x2 canvas grid for an OrthoViewer.

Creates (or reuses) a canvas per panel with wired dims sliders, and returns a leaf whose compose(host) lays them out as a labelled grid -- XY and XZ on the top row, YZ and the 3D volume on the bottom.

Parameters:

Name Type Description Default
ortho OrthoViewer

The orthoviewer whose four scenes are attached.

required
axis_values Mapping[int, AxisValues]

Axis index to the values that axis's slider can take, typically from cellier.convenience.axis_values_from_ortho.

required
gui "qt", "anywidget", or None

Defaults to ortho.gui; raises if it conflicts with it.

None
fov float

Vertical field of view in degrees for the 3D camera.

70.0
depth_range_3d tuple[float, float]

(near, far) clip distances for the 3D / 2D cameras. The 3D far is raised when the scene's data needs more.

(1.0, 8000.0)
depth_range_2d tuple[float, float]

(near, far) clip distances for the 3D / 2D cameras. The 3D far is raised when the scene's data needs more.

(1.0, 8000.0)
canvas_size tuple[int, int] or None

Initial CSS pixel size per panel. Meaningful to anywidget only.

None
fit_view_direction_3d Mapping[AxisRef, float] or None

The view direction and up vector the 3D panel's camera is fitted with, each as the component along named world axes, e.g. {"z": -1.0}. None (default) looks along minus all three displayed axes with the first displayed axis up. See CellierController.add_canvas.

None
fit_up_3d Mapping[AxisRef, float] or None

The view direction and up vector the 3D panel's camera is fitted with, each as the component along named world axes, e.g. {"z": -1.0}. None (default) looks along minus all three displayed axes with the first displayed axis up. See CellierController.add_canvas.

None

Returns:

Type Description
OrthoCanvasGrid

Raises:

Type Description
ValueError

If gui conflicts with ortho.gui, or names a front end with no widgets ("offscreen").

cellier.convenience.gui.OrthoCanvasGrid

The four ortho panel canvas leaves, arranged 2x2 on any toolkit.

compose(host) builds the grid through the host, so the arrangement -- which panel sits where, and what each is called -- is written once and both front ends draw it the same way.

Attributes:

Name Type Description
canvases dict[str, object]

Per-panel canvas leaves keyed "xy", "xz", "yz", "vol".

widget property

widget

The composed Qt grid, for embedding in a hand-built Qt layout.

Qt only, and a convenience: the layout system reaches the grid through compose like any other center leaf.

compose

compose(host: LayoutHost) -> object

Arrange the four panels as a labelled 2x2 grid via host.

Called by the viewer's layout, which supplies host (an internal layout backend); not meant to be called from user code.

close

close() -> None

Unsubscribe every panel's dims control from the bus.

Controls

The Controls are models to declare GUI widgets for updating model properties.

viewer.add_image_multiscale(
    store,
    controls=[
        ImageControl(fields=["visible", "color_map", "clim"], decimals=0),
        LevelOfDetailControl(),
        BoundingBoxControl(),
        ClippingPlanesControl(),
    ],
)

cellier.convenience.Control dataclass

Base class of the control models.

Every item of a controls= list is an instance of one of its subclasses, and each subclass names one control of the appearance dock. The base class has no fields and is not listed itself; which subclasses a visual accepts depends on its kind, and add_* raises on a model the visual has no control for.

Appearance fields

cellier.convenience.ImageControl dataclass

Bases: Control

The image control: every image field in one widget.

A shared section, a composite switch when the visual has a channel axis, and a page per mode. The blending and interpolation rows and the switch are always there.

Parameters:

Name Type Description Default
fields list[str]

The rows to show, e.g. ["visible", "color_map", "clim"]. Required and not empty. The list chooses rows; it does not order them: the control has its own layout. Names: visible, opacity, color_map, clim, render_mode, iso_threshold, and on a multiscale image attenuation. A MaskedImage has no render_mode or attenuation and adds surface_thickness, surface_placement, surface_projection (shown in 3D), and the 2D band's surface_min_width_px, band_rays and band_cap.

required
colormap_names list[str] or None

Names available in the colormap dropdowns. A curated list when None.

None
clim_range tuple[float, float] or None

(min, max) bounds of the contrast-limits sliders. Inferred from the current limits when None.

None
channel_labels dict[int, str] or None

Per-channel names on the composite page. "Channel {i}" when None.

None
decimals int

Decimal places shown for values in data units: the contrast limits and the iso threshold. Default 2. Set it to suit the data, e.g. 0 for integer images; fractions such as opacity always show 2.

2
threshold_range tuple[float, float] or None

(min, max) bounds of the iso-threshold slider. None uses the contrast limits' bounds, which are in the same units, except on a MaskedImage: its threshold is in the mask's units, and None gives a window of max(1, |t|) either side of the threshold t.

None
thickness_range tuple[float, float] or None

(min, max) bounds of a MaskedImage's thickness slider, in world units. None gives (0, max(10, 4 * thickness)). Ignored on other images.

None

__post_init__

__post_init__() -> None

Check the shape of fields and decimals.

cellier.convenience.FieldControls dataclass

Bases: Control

One control per appearance field, for every visual but an image.

Parameters:

Name Type Description Default
fields list[str]

The fields to show, one control each, drawn in the order of this list. Required and not empty. The names a visual accepts depend on its kind (see FIELD_KINDS); a mesh carries the flat fields (wireframe, wireframe_thickness) or the phong fields (shininess, flat_shading), not both, and a field the visual's appearance model lacks warns and is not built.

required
Notes

On labels, render_mode is the labels render mode (iso_categorical / flat_categorical), not the image one.

__post_init__

__post_init__() -> None

Check the shape of fields.

Planes

cellier.convenience.ClippingPlanesControl dataclass

Bases: Control

The visual's clipping planes control.

A row per plane (on or off, the normal, a position slider along it) and a button to add one. Values are in the visual's data coordinates.

On a Viewer it is drawn in the appearance dock, at its place in the list. On an OrthoViewer it is drawn in the OrthoClippingControls() dock, one control per group of linked panels, and its place in the list is ignored.

cellier.convenience.RenderPlanesControl dataclass

Bases: Control

The control of the planes of the "plane" render mode.

A row per plane (on or off, the normal, a position slider, the extents) and a button to add one. Values are in world units. It is disabled, with the reason shown, while the visual is not in plane mode or the view is 2D.

On an OrthoViewer it is drawn for the 3D view's group only: the 2D views draw no render planes.

Drawing and picking

cellier.convenience.BoundingBoxControl dataclass

Bases: Control

The bounding box control.

A checkbox, a line-width slider and a colour picker for the visual's aabb (AABBParams): the box drawn round the visual's data. Every kind of visual has one. It has no options.

cellier.convenience.OutlineControl dataclass

Bases: Control

The visual's outline control.

The palette slot it is outlined in and the placement; for a labels visual, the per-label selection. The outline reads the pick buffer: choosing a slot turns pick_write on with a warning. List PickingControl to show that flag.

cellier.convenience.AmbientOcclusionControl dataclass

Bases: Control

The visual's ambient-occlusion checkbox.

Ambient occlusion reads the pick buffer. List PickingControl to show that flag.

cellier.convenience.PickingControl dataclass

Bases: Control

The pick_write checkbox: whether the visual is in the pick buffer.

A visual out of the pick buffer cannot be picked in the canvas, and cannot be outlined or ambient-occluded, since both passes read that buffer. List it beside OutlineControl or AmbientOcclusionControl to show the flag those controls turn on. For every kind of visual. It has no options.

Level of detail and loading

cellier.convenience.LevelOfDetailControl dataclass

Bases: Control

The level-of-detail control of an image or labels visual.

A slider for the appearance's settled_lod_bias (higher is coarser) and checkboxes for coarsest_while_moving_3d and coarsest_while_moving_2d (draw only the coarsest level while the visual moves). For an in-memory or multiscale image, a MaskedImage, and in-memory or multiscale labels. It has no options.

cellier.convenience.LoadingIndicator dataclass

Bases: Control

How far the visual's data has loaded: a bar and a status line.

For an image or labels visual, whose data loads progressively, brick by brick, and for a mesh, which is not drawn while a new position loads (its status is worded in levels). It has no options.

cellier.convenience.LoadingConfigControl dataclass

Bases: Control

A control for every ProgressiveLoadingConfig field.

Advanced settings of how an image or labels visual loads its data progressively: the visual's render_config.loading (ProgressiveLoadingConfig). For an in-memory or multiscale image, a MaskedImage, and in-memory or multiscale labels. It has no options.

Meshes and graphs

cellier.convenience.MeshSectionControl dataclass

Bases: Control

The "2D section" group of a mesh.

How the mesh is drawn in a 2D view: outline, fill, outline width, and whether the cut is the slice plane or the scene's slab (see MeshSectionConfig).

cellier.convenience.MeshLodControl dataclass

Bases: Control

The "LOD" group of a multiscale mesh.

What a dims scrub loads and draws, and what a moving camera draws (see GeometryLodConfig). A multiscale mesh with one level has no such settings and gets no group.

cellier.convenience.TrailControl dataclass

Bases: Control

The trail-window controls of a graph.

On or off, the extent before and after the slice position, and fade, for one or more of the graph's data axes.

Parameters:

Name Type Description Default
axes list[int | str] or None

None (default) offers the axes that already have a window in GraphVisual.trail, or the store's time axes when none do. A list names the axes by data-axis index or name, which is how to offer an axis that has no window yet. A name or index is resolved against the store when the dock is built.

None

__post_init__

__post_init__() -> None

Check the shape of axes.

Only the shape: whether an axis exists depends on the graph's store, which is checked when the dock is built.

Dataset info

cellier.convenience.DatasetInfoControl dataclass

Bases: Control

The read-only dataset-info block.

Parameters:

Name Type Description Default
info None or DatasetInfo or Sequence[tuple[str, str]]

None (default) asks the visual's data store to describe itself via BaseDataStore.dataset_info(): it stays correct as the store changes and costs no array reads. A DatasetInfo is displayed as given. A sequence of (label, value) pairs is for rows that no store knows about; both halves are coerced to str.

Values are displayed, never interpreted as markup.

None

Axis values

Utility functions to derive the values each dims slider can take from data a viewer holds. They return ContinuousAxisValues and DiscreteAxisValues, keyed by world axis index.

cellier.convenience.axis_values_from_viewer

axis_values_from_viewer(viewer: Viewer, *, draw_ticks: Iterable[str] = (), step_size: Mapping[str, float] | None = None) -> dict[int, ContinuousAxisValues | DiscreteAxisValues]

Compute every world axis's slider values from the viewer's visuals.

Transforms each visual's data extent into world space and takes the union per world axis, so the slider covers every visual. Extents run to the voxel edges: a gridded axis of n voxels spans [-0.5, n - 0.5].

A non-space axis gets a DiscreteAxisValues when every visual reaching it maps a discretely sampled data axis onto it -- an OME-Zarr channel or time axis, or a tracking graph's frame column. Its values are the union of those samples' world positions, labelled with the channel names when every store that names its channels agrees on them. One continuous contributor, or more than 10,000 samples, keeps the axis continuous. Space axes are always continuous.

Parameters:

Name Type Description Default
viewer Viewer

The viewer to inspect. Must have at least one visual whose store holds data.

required
draw_ticks Iterable[str]

Names of world axes whose sliders mark each value with a tick, e.g. ["c"]. Empty (default) draws none. Each named axis must come out discrete. Ticks cost per mark on every repaint, so name short axes such as a channel axis: ticks on an axis of more than 50 values raise a UserWarning.

()
step_size Mapping[str, float] or None

World axis name to the world distance one arrow key or wheel notch moves that axis's slider, e.g. {"z": 2.0} for 2.0 world units per plane. An axis not named steps by 1.0. Nothing is read from the data: name every axis whose voxel spacing is not 1.0. Each named axis must come out continuous and each step must be finite and > 0. None (default) names none.

None

Returns:

Type Description
dict[int, ContinuousAxisValues | DiscreteAxisValues]

Mapping of axis index to that axis's slider values.

Raises:

Type Description
ValueError

If no visual holds any data, if draw_ticks or step_size names an axis the world does not have, if a draw_ticks axis comes out continuous, if a step_size axis comes out discrete, or if a step is not finite and > 0.

TypeError

If draw_ticks is a single string or holds something other than axis names, or if step_size is not a mapping of axis names to numbers.

cellier.convenience.axis_values_from_ortho

axis_values_from_ortho(ortho: OrthoViewer, *, draw_ticks: Iterable[str] = (), step_size: Mapping[str, float] | None = None) -> dict[int, ContinuousAxisValues | DiscreteAxisValues]

Compute every world axis's slider values for an OrthoViewer.

The four panels share their data stores, so the values are identical across panels. The first panel that has visuals with data is used.

Parameters:

Name Type Description Default
ortho OrthoViewer

The orthoviewer to inspect. Must have at least one visual whose store holds data on some panel.

required
draw_ticks Iterable[str]

Names of world axes whose sliders mark each value with a tick. See axis_values_from_viewer.

()
step_size Mapping[str, float] or None

World axis name to that axis's slider step, in world units. See axis_values_from_viewer.

None

Returns:

Type Description
dict[int, ContinuousAxisValues | DiscreteAxisValues]

Mapping of axis index to that axis's slider values.

Raises:

Type Description
ValueError

If no panel has a visual with data, or for a bad draw_ticks or step_size entry as in axis_values_from_viewer.

TypeError

If draw_ticks is a single string or holds something other than axis names, or if step_size is not a mapping of axis names to numbers.

Window capture

To render a viewer to a PNG without a window, see Capture screenshots.

cellier.convenience.screenshot_window

screenshot_window(window: object, controller: CellierController, *, frames: int | Literal['converged'] = 1, save: str | Path | None = None, **capture_kwargs) -> ndarray

Capture a Qt window, canvases included, as an RGBA uint8 array.

Works headless (QT_QPA_PLATFORM=offscreen), which is the setting it exists for: on a real display the OS screenshot tool already does this.

Parameters:

Name Type Description Default
window QWidget

The top-level window to capture, e.g. a QMainWindow you built and passed to show (launch and show return None).

required
controller CellierController

The controller owning the canvases inside window. Every canvas whose widget belongs to this window and is visible is composited in.

required
frames int or 'converged'

Passed to each canvas capture; see screenshot.

1
save str, Path, or None

When given, also write the composite to this path as a PNG.

None
**capture_kwargs

Forwarded to each canvas capture.

{}

Returns:

Type Description
ndarray

RGBA uint8 array of shape (height, width, 4) in physical pixels, so a window on a 2x display comes back at twice its logical size -- matching what grab() produces.

Notes

Only the canvas regions are reproducible. Chrome depends on the platform's widget style and font rendering, so this is a picture of a window rather than a value to assert on byte-for-byte.