GUI¶
What both toolkits share: helpers for building controls and the models they read. The widgets themselves are on the Qt and anywidget pages.
Image control values¶
cellier.gui.image_control_values ¶
image_control_values(visual: Any, *, fields: list[str] | tuple[str, ...], colormap_names: list[str] | None = None, clim_range: tuple[float, float] | None = None, channel_labels: dict[int, str] | None = None, decimals: int = 2, axis_names: Iterable[str] | None = None, threshold_range: tuple[float, float] | None = None, thickness_range: tuple[float, float] | None = None) -> dict[str, Any]
Everything either front end needs to build the image control.
The result is the values argument of QtImageControls and of the
anywidget image control. The convenience viewers call this for every
ImageControl in a controls= list; call it yourself only when
building the widget directly. The dict's layout is internal: pass it
through unchanged.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
visual
|
BaseImageVisual
|
The representative visual. |
required |
fields
|
sequence of str
|
The appearance fields the config asked for. The shared section's blending and interpolation rows and the mode switch are always shown. |
required |
colormap_names
|
list[str] or None
|
Colormap choices. A curated default when |
None
|
clim_range
|
tuple[float, float] or None
|
Contrast slider bounds. Inferred from the current limits when
|
None
|
channel_labels
|
dict[int, str] or None
|
Per-channel names; |
None
|
decimals
|
int
|
Decimal places for values in data units (the contrast limits and the iso threshold). Fractions such as opacity always show 2. |
2
|
axis_names
|
iterable of str or None
|
The axis names the projection-axis row offers (the store's, which name the world's), when fields asks for it. |
None
|
threshold_range
|
tuple[float, float] or None
|
Iso-threshold slider bounds. |
None
|
thickness_range
|
tuple[float, float] or None
|
A MaskedImage's thickness slider bounds, world units. |
None
|
Returns:
| Type | Description |
|---|---|
dict
|
Plain data, JSON-compatible apart from integer channel keys and
|
Axis values¶
The values a dims slider can take on one world axis: any position in a
range, or only the listed positions (a channel axis, say).
axis_values_from_viewer
derives them from a viewer's data.
cellier.gui.ContinuousAxisValues
pydantic-model
¶
Bases: CellierModel
An axis that can be sliced at any world position in [min, max].
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
min
|
float
|
Lowest world position the slider reaches. Must be finite. |
required |
max
|
float
|
Highest world position the slider reaches. Must be finite and
|
required |
decimals
|
int
|
Decimal places the slider's position readout shows. Default 2. Display only: the slider stays continuous and the model receives the full-precision position. |
required |
step_size
|
float
|
World distance one keyboard step (an arrow key) or one mouse-wheel
notch moves the slider. Default 1.0. Must be finite and |
required |
Config:
frozen:True
Fields:
Validators:
-
_check_bounds
cellier.gui.DiscreteAxisValues
pydantic-model
¶
Bases: CellierModel
An axis that can only be sliced at the listed world positions.
The slider steps through values by position, so irregular spacing is
fine. A position set from elsewhere that falls between two values is
shown as the nearest one (a position exactly halfway between two values
goes to the higher one); it is not written back, because the renderer
resolves it with the same rule.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
values
|
tuple[float, ...]
|
World positions: at least one, all finite, strictly increasing.
A tuple rather than an array
so that equality stays total -- an ndarray field makes |
required |
labels
|
tuple[str, ...] or None
|
Readout text for each value, e.g. channel names; one entry per value.
|
required |
draw_ticks
|
bool
|
Whether the slider marks each value with a tick. Default |
required |
Raises:
| Type | Description |
|---|---|
ValueError
|
When values is empty, not finite or not strictly increasing, or labels does not have one entry per value. |
Config:
frozen:True
Fields:
-
kind(Literal['discrete']) -
values(tuple[float, ...]) -
labels(tuple[str, ...] | None) -
draw_ticks(bool)
Validators:
-
_check_values -
_warn_dense_ticks
Clipping planes helpers¶
What a clipping planes control of either toolkit is built from. See Clip a visual with planes.
cellier.gui.get_clipping_planes_data_from_visual ¶
What a clipping planes control is built with, read off the models.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
visual
|
BaseVisual
|
The visual. For a group of visuals edited together, the first: they read one store, and the visuals of a link group carry the same planes. |
required |
store
|
BaseDataStore
|
The store the visual reads. |
required |
Returns:
| Type | Description |
|---|---|
dict[str, Any]
|
|
cellier.gui.get_axis_bounds_from_store ¶
get_axis_bounds_from_store(controller: Any, data: Mapping[str, Any]) -> Callable[[], list[list[float]]] | None
A reader of a store's current bounds; not the bounds themselves.
The returned function takes no arguments, looks the store up by id and
returns its current [low, high] per axis. A clipping planes
control calls it when the store's extent changes
(DataStoreMetadataChangedEvent) to move its slider ranges. It
exists because a control does not hold the controller.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
controller
|
CellierController or None
|
Looks the store up by id each time, so the reader holds no store. |
required |
data
|
Mapping[str, Any]
|
From |
required |
Returns:
| Type | Description |
|---|---|
Callable or None
|
The |
cellier.gui.ClippingPlaneGizmoTarget ¶
Bases: NamedTuple
Where the gizmo of a clipping planes control is drawn.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
visual_id
|
UUID
|
The visual whose plane the gizmo edits. |
required |
canvas_id
|
UUID
|
The 3D canvas the gizmo is drawn in. |
required |
scene_id
|
UUID
|
That canvas's scene, whose |
required |
cellier.gui.get_clipping_plane_gizmo_data ¶
The gizmo arguments of a clipping planes control, for one visual and canvas.
Selects nothing: the caller names the visual whose plane the gizmo
edits and the canvas it is drawn in, as for
CellierController.add_clipping_plane_gizmo. The canvas must exist:
build the canvas before the control.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
controller
|
CellierController
|
The controller the control is wired to. |
required |
visual_id
|
UUID
|
The visual whose plane the gizmo edits. One of the control's visuals. |
required |
canvas_id
|
UUID
|
A canvas of that visual's scene. |
required |
Returns:
| Type | Description |
|---|---|
dict[str, Any]
|
|
Raises:
| Type | Description |
|---|---|
KeyError
|
If the visual or the canvas is not registered. |
ValueError
|
If the canvas does not show the visual's scene. |
Render planes helpers¶
The planes a visual in the "plane" render mode draws its data on: the
clipping planes rows with the extents added, in world units.
cellier.gui.get_render_planes_data_from_visual ¶
get_render_planes_data_from_visual(controller: Any, visual_id: UUID, *, blocked: Callable[[], str] | None = None) -> dict[str, Any]
What a render planes control is built with, read through the controller.
Unlike a clipping planes control, a render planes control reads the scene as well as the visual: its planes are in world coordinates, a new one is put on the axes the 3D view displays, and the control is disabled while the planes are not drawn.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
controller
|
CellierController
|
The controller the control is wired to. |
required |
visual_id
|
UUID
|
The visual. For a group of visuals edited together, the first. |
required |
blocked
|
Callable[[], str] or None
|
Why the control is disabled now, or |
None
|
Returns:
| Type | Description |
|---|---|
dict[str, Any]
|
Keyword arguments of the control: |
Raises:
| Type | Description |
|---|---|
KeyError
|
If the visual is not registered. |
cellier.gui.RenderPlaneGizmoTarget ¶
Bases: NamedTuple
Where the gizmo of a render planes control is drawn.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
visual_id
|
UUID
|
The visual whose plane the gizmo edits. |
required |
canvas_id
|
UUID
|
The 3D canvas the gizmo is drawn in. |
required |
scene_id
|
UUID
|
That canvas's scene. |
required |
cellier.gui.get_render_plane_gizmo_data ¶
The gizmo arguments of a render planes control, for one visual and canvas.
Selects nothing: the caller names the visual whose plane the gizmo
edits and the canvas it is drawn in, as for
CellierController.add_render_plane_gizmo. The canvas must exist:
build the canvas before the control.
Returns:
| Type | Description |
|---|---|
dict[str, Any]
|
|
Raises:
| Type | Description |
|---|---|
KeyError
|
If the visual or the canvas is not registered. |
ValueError
|
If the canvas does not show the visual's scene. |
Dataset info¶
cellier.gui.dataset_info_from_path ¶
dataset_info_from_path(zarr_path: str, *, multiscale_index: int = 0, series_index: int = 0) -> DatasetInfo
Extract display metadata from an OME-Zarr store by URI.
Uses yaozarrs to validate and read OME metadata, and direct JSON
reads for the per-level array shapes.
Prefer store.dataset_info() when you have a store: this opens the
group, which for a remote URI is a network round trip.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
zarr_path
|
str
|
Root URI of the OME-Zarr group ( |
required |
multiscale_index
|
int
|
Which |
0
|
series_index
|
int
|
For Bf2Raw containers, which child image series to inspect. |
0
|
Returns:
| Type | Description |
|---|---|
DatasetInfo
|
The same sectioned description a store's |