Visuals¶
Visuals describe how a data store is rendered, together with the appearance models that configure their look.
Images¶
One image visual draws single-channel or composited. channel_axis names
the data axis channels lie along; composite picks the mode. The shared
appearance applies to both modes, single to single mode, and channels
to composite mode (one appearance per channel index).
cellier.visuals.BaseImageAppearance ¶
Bases: BaseDrawAppearance
Appearance shared by both modes of an image visual.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
visible
|
bool
|
The master switch. In single mode it is the only visibility; in
composite mode each channel's |
required |
transparency_mode
|
str or None
|
The pygfx alpha mode for every drawn channel. |
required |
interpolation
|
str
|
Texture sampler filter. |
required |
cellier.visuals.effective_transparency_mode ¶
The alpha mode an image visual draws its channels with.
appearance.transparency_mode when set; otherwise "add" in
composite mode and "blend" in single mode.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
visual
|
BaseImageVisual
|
The image visual. |
required |
Returns:
| Type | Description |
|---|---|
str
|
A pygfx alpha mode. |
In-memory image¶
cellier.visuals.ImageVisual ¶
Bases: BaseImageVisual
Model-layer visual for a single-resolution in-memory image.
Backed by an ImageMemoryStore. Camera movement does not trigger a
reslice because the data is not view-dependent -- the whole slice is
always loaded.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
visual_type
|
Literal['image_memory']
|
Discriminator field; always |
required |
appearance
|
InMemoryImageAppearance
|
Shared by both modes. |
required |
single
|
InMemoryImageSingleAppearance
|
Single mode's appearance. |
required |
channels
|
dict[int, InMemoryImageChannelAppearance]
|
Composite mode's per-channel appearances. |
required |
requires_camera_reslice
|
bool
|
Always |
required |
__setattr__ ¶
Keep the old channels when a new dict is refused.
The rules on channels (one render mode, max_channels) are
checked after pydantic has assigned the field, and a failed check
does not undo the assignment.
plans_coarse_while_moving ¶
Whether an interactive dims tick plans this visual BACKSTOP_ONLY.
While the scene's dims are being scrubbed, the controller plans a
visual that returns True coarse only, and plans it in full once
when the scrub ends. A subclass derives the answer from its own
explicit config; the base answer is False.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
n_displayed_dims
|
int
|
Displayed dimensions of the view being planned (2 or 3): a visual may have a setting for each. |
required |
drawn_channels ¶
The channel indices composite mode draws, ascending.
D = {k in channels : appearance.visible and channels[k].visible and
0 <= k < size} (design 3.3). Empty when the visual is hidden.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
size
|
int or None
|
The length of the channel axis. |
None
|
Returns:
| Type | Description |
|---|---|
tuple[int, ...]
|
The drawn indices. |
cellier.visuals.InMemoryImageAppearance ¶
Bases: BaseImageAppearance
Shared appearance of an in-memory image visual.
Every field has a default, so a plain image needs no appearance=.
cellier.visuals.InMemoryImageSingleAppearance ¶
Bases: BaseImageSingleAppearance
Single-mode appearance of an in-memory image visual.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
render_mode
|
str
|
Rendering mode for the 3D view: |
required |
cellier.visuals.InMemoryImageChannelAppearance ¶
Bases: InMemoryImageSingleAppearance
One channel's appearance on an in-memory image, in composite mode.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
visible
|
bool
|
Whether composite mode draws this channel. Gated by the shared
|
required |
Multiscale image¶
cellier.visuals.MultiscaleImageVisual ¶
Bases: BaseImageVisual
Model for a multiscale image visual.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
visual_type
|
Literal['multiscale_image']
|
Discriminator field. Always |
required |
level_transforms
|
list[AffineTransform]
|
Per-level transforms mapping level-k voxel coords to level-0 voxel coords. Copied from the data store by the controller. |
required |
appearance
|
MultiscaleImageAppearance
|
Shared by both modes. |
required |
single
|
MultiscaleImageSingleAppearance
|
Single mode's appearance. |
required |
channels
|
dict[int, MultiscaleImageChannelAppearance]
|
Composite mode's per-channel appearances. |
required |
render_config
|
MultiscaleImageRenderConfig
|
GPU cache configuration. |
required |
__setattr__ ¶
Keep the old channels when a new dict is refused.
The rules on channels (one render mode, max_channels) are
checked after pydantic has assigned the field, and a failed check
does not undo the assignment.
drawn_channels ¶
The channel indices composite mode draws, ascending.
D = {k in channels : appearance.visible and channels[k].visible and
0 <= k < size} (design 3.3). Empty when the visual is hidden.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
size
|
int or None
|
The length of the channel axis. |
None
|
Returns:
| Type | Description |
|---|---|
tuple[int, ...]
|
The drawn indices. |
plane_mode ¶
plane_mode() -> bool
Whether a 3D view draws this visual on its render_planes.
Single mode reads single.render_mode. Composite mode reads its
drawn channels, which share one render mode like all the channels.
draws_nothing ¶
Whether the visual draws nothing and so needs no slicing (3.3).
Hidden, or in composite mode with no drawn channel.
cellier.visuals.MultiscaleImageAppearance ¶
Bases: BaseImageAppearance
Shared appearance of a multiscale image visual.
Adds the fields both modes share on a brick-streamed visual.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
attenuation
|
float
|
Depth attenuation coefficient for |
required |
settled_lod_bias
|
float
|
Level-of-detail bias of a settled view, 2D and 3D. Divisor on the screen-space LOD threshold: higher is coarser. Default 1.0. |
required |
coarsest_while_moving_3d
|
bool
|
In a 3D view, plan no target while the visual moves. A visual moves
while its scene's dims are scrubbed, or while its clipping planes
are dragged ( |
required |
coarsest_while_moving_2d
|
bool
|
The same, for a 2D view, whose only motion is a dims scrub.
|
required |
force_level
|
int or None
|
Overrides automatic LOD selection when set. Default None. |
required |
frustum_cull
|
bool
|
Skip bricks outside the camera frustum. Default True. |
required |
ray_steps_per_voxel
|
float
|
3D ray-march samples per voxel of the drawn level, measured along
the ray. Lower is faster but can skip features a voxel or two
thick and dims MIP peaks (a one-voxel spot can lose up to
|
required |
cellier.visuals.MultiscaleImageSingleAppearance ¶
Bases: BaseImageSingleAppearance
Single-mode appearance of a multiscale image visual.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
render_mode
|
str
|
|
required |
iso_threshold
|
float
|
Isosurface threshold. Default 0.2. |
required |
cellier.visuals.MultiscaleImageChannelAppearance ¶
Bases: MultiscaleImageSingleAppearance
One channel's appearance on a multiscale image, in composite mode.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
visible
|
bool
|
Whether composite mode draws this channel. Default |
required |
cellier.visuals.MultiscaleImageRenderConfig
pydantic-model
¶
Bases: BaseModel
Render-layer configuration for a multiscale image visual.
These parameters control GPU resource allocation. They are stored in the model so they round-trip through serialization.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
block_size
|
int
|
Brick / tile side length in voxels. Default 32. |
required |
gpu_budget_bytes
|
int
|
Maximum GPU memory for the 3-D brick caches, split evenly between the
channels the visual can draw -- its |
required |
gpu_budget_bytes_2d
|
int
|
Maximum GPU memory for the 2-D tile caches, split likewise. Default 64 MiB. |
required |
loading
|
ProgressiveLoadingConfig
|
The coarse backstop loaded ahead of the target level. Changing only this reslices; the other fields reallocate GPU resources. |
required |
Config:
frozen:True
Fields:
-
block_size(int) -
gpu_budget_bytes(int) -
gpu_budget_bytes_2d(int) -
loading(ProgressiveLoadingConfig)
cellier.visuals.ProgressiveLoadingConfig
pydantic-model
¶
Bases: BaseModel
How a multiscale visual loads: a coarse backstop, then the target.
A coarse backstop level is always loaded ahead of the target level, so the view is blurry rather than blank (or showing the previous slice) while the target loads. Backstop reads go before every target read, from every visual.
Every setting is explicit, with a fixed default, and never changed by the
library at runtime. Replacing a visual's render_config with one that
differs only here reslices the visual without reallocating its atlases.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
backstop_level
|
int or None
|
1-based level of the backstop, like |
required |
backstop_extent
|
('full', 'view')
|
|
"full"
|
backstop_max_slot_fraction
|
float
|
At most this share of an atlas's slots holds backstop bricks, filled
nearest the camera (3D) or canvas centre (2D) first. Only shallow
pyramids reach it; when it truncates, one INFO line per visual on
|
required |
Config:
frozen:True
Fields:
-
backstop_level(int | None) -
backstop_extent(Literal['full', 'view']) -
backstop_max_slot_fraction(float)
Validators:
-
_refuse_removed_fields
cellier.visuals.GeometryLodConfig
pydantic-model
¶
Bases: BaseModel
How a multiscale geometry visual uses its levels of detail.
Two levels are kept loaded: the finest, and one coarse level. Every setting is explicit, with a fixed default, and never changed by the library at runtime. The config is frozen: replace it to change it.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
coarse_level
|
int or None
|
1-based level kept beside the finest (1 is the finest, so the
smallest value is 2). |
required |
dims_drag
|
('coarse', 'full')
|
What a dims scrub loads for each new position. |
"coarse"
|
dims_drag_draw
|
('coarse', 'full')
|
What a dims scrub draws of a visual the scrub does not change (a
static mesh next to a time series). |
"coarse"
|
camera_motion
|
('coarse', 'full')
|
What is drawn while the camera moves in a 3D view. |
"coarse"
|
Config:
frozen:True
Fields:
-
coarse_level(int | None) -
dims_drag(Literal['coarse', 'full']) -
dims_drag_draw(Literal['coarse', 'full']) -
camera_motion(Literal['coarse', 'full'])
coarse_scale_index ¶
The 0-based level kept beside the finest, for a store's levels.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
level_count
|
int
|
How many levels the store has. |
required |
Returns:
| Type | Description |
|---|---|
int or None
|
|
Raises:
| Type | Description |
|---|---|
ValueError
|
If |
In-memory labels¶
cellier.visuals.LabelMemoryVisual ¶
Bases: BaseLabelsVisual
Model-layer visual for in-memory label arrays.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
appearance
|
InMemoryLabelsAppearance
|
Colormap and rendering appearance. |
required |
__setattr__ ¶
Validate clipping_planes and render_planes on assignment.
The model does not validate assignments in general; without this a list would stay a list and a wrong element would be found only when the planes are drawn.
plans_coarse_while_moving ¶
Whether an interactive dims tick plans this visual BACKSTOP_ONLY.
While the scene's dims are being scrubbed, the controller plans a
visual that returns True coarse only, and plans it in full once
when the scrub ends. A subclass derives the answer from its own
explicit config; the base answer is False.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
n_displayed_dims
|
int
|
Displayed dimensions of the view being planned (2 or 3): a visual may have a setting for each. |
required |
cellier.visuals.BaseLabelsAppearance ¶
Bases: BaseAppearance
Base appearance parameters shared by all label visuals.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
colormap_mode
|
'random' or 'direct'
|
Frozen — raises |
required |
background_label
|
int
|
Label ID treated as transparent (discarded). Default 0. |
required |
salt
|
int
|
Hash seed for random colormap mode. Default 0. |
required |
color_dict
|
dict
|
Explicit label-ID → RGBA mapping for direct mode. |
required |
render_mode
|
('iso_categorical', 'flat_categorical' or 'plane')
|
3D rendering mode. |
required |
cellier.visuals.InMemoryLabelsAppearance ¶
Multiscale labels¶
cellier.visuals.MultiscaleLabelVisual ¶
Bases: BaseLabelsVisual
Model for a multiscale label visual.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
level_transforms
|
list[AffineTransform]
|
Per-level transforms mapping level-k voxel coords to level-0. |
required |
appearance
|
MultiscaleLabelsAppearance
|
Visual appearance configuration. |
required |
render_config
|
MultiscaleLabelRenderConfig
|
GPU resource configuration. |
required |
requires_camera_reslice
|
bool
|
Always True (camera movement triggers reslice for LOD). Frozen. |
required |
__setattr__ ¶
Validate clipping_planes and render_planes on assignment.
The model does not validate assignments in general; without this a list would stay a list and a wrong element would be found only when the planes are drawn.
cellier.visuals.MultiscaleLabelsAppearance ¶
Bases: BaseLabelsAppearance
Appearance for multiscale label visuals.
Extends BaseLabelsAppearance with LOD-control fields required for
brick-streamed multiscale rendering.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
colormap_mode
|
random | direct
|
Inherited from |
required |
background_label
|
int
|
Inherited from |
required |
salt
|
int
|
Inherited from |
required |
color_dict
|
dict
|
Inherited from |
required |
render_mode
|
str
|
Overrides |
required |
settled_lod_bias
|
float
|
Level-of-detail bias of a settled view, 2D and 3D. Divisor on the screen-space LOD threshold: higher is coarser. Default 1.0. |
required |
coarsest_while_moving_3d
|
bool
|
In a 3D view, plan no target while the visual moves. A visual moves
while its scene's dims are scrubbed, or while its clipping planes
are dragged ( |
required |
coarsest_while_moving_2d
|
bool
|
The same, for a 2D view, whose only motion is a dims scrub.
|
required |
force_level
|
int | None
|
Overrides automatic LOD selection when set. Default None. |
required |
frustum_cull
|
bool
|
Skip bricks outside the camera frustum. Default True. |
required |
ray_steps_per_voxel
|
float
|
3D ray-march samples per voxel of the drawn level, measured along the ray. Lower is faster but can skip labels a voxel or two thick. Must be in [0.5, 8]: below 0.5 a bisection probe can overshoot the brick's ghost border. Default 1.0. |
required |
cellier.visuals.MultiscaleLabelRenderConfig
pydantic-model
¶
Bases: BaseModel
Config:
frozen:True
Fields:
-
block_size(int) -
gpu_budget_bytes(int) -
gpu_budget_bytes_2d(int) -
paint_max_tiles(int) -
loading(ProgressiveLoadingConfig)
model_config
class-attribute
instance-attribute
¶
Render-layer configuration for a multiscale label visual.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
block_size
|
int
|
Brick / tile side length in voxels. Default 32. |
required |
gpu_budget_bytes
|
int
|
Maximum GPU memory for the 3-D brick cache. Default 1 GiB. |
required |
gpu_budget_bytes_2d
|
int
|
Maximum GPU memory for the 2-D tile cache. Default 64 MiB. |
required |
paint_max_tiles
|
int
|
Tiles the 2-D paint overlay can hold. Default 512. |
required |
loading
|
ProgressiveLoadingConfig
|
The coarse backstop loaded ahead of the target level. Changing only this reslices; the other fields reallocate GPU resources. |
required |
Points¶
cellier.visuals.PointsVisual ¶
Bases: BaseVisual
Model-layer visual for a point cloud backed by PointsMemoryStore.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
appearance
|
PointsMarkerAppearance
|
Initial appearance. |
required |
requires_camera_reslice
|
bool
|
Always False — points do not depend on camera position. Frozen. |
required |
__setattr__ ¶
Validate clipping_planes and render_planes on assignment.
The model does not validate assignments in general; without this a list would stay a list and a wrong element would be found only when the planes are drawn.
plans_coarse_while_moving ¶
Whether an interactive dims tick plans this visual BACKSTOP_ONLY.
While the scene's dims are being scrubbed, the controller plans a
visual that returns True coarse only, and plans it in full once
when the scrub ends. A subclass derives the answer from its own
explicit config; the base answer is False.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
n_displayed_dims
|
int
|
Displayed dimensions of the view being planned (2 or 3): a visual may have a setting for each. |
required |
cellier.visuals.PointsMarkerAppearance ¶
Bases: BaseAppearance
Appearance model for a points visual.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
color
|
tuple[float, float, float, float]
|
RGBA uniform fallback colour. Used when |
required |
size
|
float
|
Uniform point size, interpreted in |
required |
size_space
|
str
|
Coordinate space for size. |
required |
color_mode
|
str
|
Declares where RGB comes from. |
required |
size_mode
|
str
|
Declares where the size comes from, on the same terms as
|
required |
opacity
|
float
|
Master opacity multiplier in [0, 1]. |
required |
Lines¶
cellier.visuals.LinesVisual ¶
Bases: BaseVisual
Model-layer visual for a line-segment collection backed by LinesMemoryStore.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
appearance
|
LinesMemoryAppearance
|
Initial appearance. |
required |
requires_camera_reslice
|
bool
|
Always False — lines do not depend on camera position. Frozen. |
required |
__setattr__ ¶
Validate clipping_planes and render_planes on assignment.
The model does not validate assignments in general; without this a list would stay a list and a wrong element would be found only when the planes are drawn.
plans_coarse_while_moving ¶
Whether an interactive dims tick plans this visual BACKSTOP_ONLY.
While the scene's dims are being scrubbed, the controller plans a
visual that returns True coarse only, and plans it in full once
when the scrub ends. A subclass derives the answer from its own
explicit config; the base answer is False.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
n_displayed_dims
|
int
|
Displayed dimensions of the view being planned (2 or 3): a visual may have a setting for each. |
required |
cellier.visuals.LinesMemoryAppearance ¶
Bases: BaseAppearance
Appearance model for a lines visual.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
color
|
tuple[float, float, float, float]
|
RGBA uniform fallback colour. Used when |
required |
thickness
|
float
|
Line thickness, interpreted in |
required |
thickness_space
|
str
|
Coordinate space for thickness. |
required |
color_mode
|
str
|
|
required |
opacity
|
float
|
Master opacity multiplier in [0, 1]. |
required |
Meshes¶
cellier.visuals.MeshVisual ¶
Bases: BaseMeshVisual
Model-layer visual for an in-memory triangle mesh.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
visual_type
|
Literal['mesh_memory']
|
Discriminator field; always |
required |
data_store_id
|
str
|
UUID string of the associated |
required |
appearance
|
MeshFlatAppearance | MeshPhongAppearance
|
Appearance parameters. |
required |
section
|
MeshSectionConfig
|
How the mesh is drawn in a 2D view: outline and fill of its cross-section. |
required |
requires_camera_reslice
|
bool
|
Always False; frozen. Camera movement does not trigger reslicing. |
required |
__setattr__ ¶
Validate clipping_planes and render_planes on assignment.
The model does not validate assignments in general; without this a list would stay a list and a wrong element would be found only when the planes are drawn.
plans_coarse_while_moving ¶
Whether an interactive dims tick plans this visual BACKSTOP_ONLY.
While the scene's dims are being scrubbed, the controller plans a
visual that returns True coarse only, and plans it in full once
when the scrub ends. A subclass derives the answer from its own
explicit config; the base answer is False.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
n_displayed_dims
|
int
|
Displayed dimensions of the view being planned (2 or 3): a visual may have a setting for each. |
required |
cellier.visuals.MultiscaleMeshVisual ¶
Bases: BaseMeshVisual
Model-layer visual for a mesh with levels of detail.
Two levels are kept loaded, the finest and one coarse level
(lod.coarse_level). A change of position loads the coarse level
first, so the mesh is back on screen sooner, and the finest replaces it
when it has loaded. With a store of one level it behaves as a
MeshVisual.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
visual_type
|
Literal['mesh_multiscale']
|
Discriminator field; always |
required |
data_store_id
|
str
|
UUID string of the associated |
required |
appearance
|
MeshFlatAppearance | MeshPhongAppearance
|
Appearance parameters, shared by both levels. |
required |
section
|
MeshSectionConfig
|
How the mesh is drawn in a 2D view: outline and fill of its cross-section, at whichever level is drawn. |
required |
lod
|
GeometryLodConfig
|
Which coarse level is kept, and when it is loaded and drawn. |
required |
requires_camera_reslice
|
bool
|
Always False; frozen. Camera movement does not trigger reslicing. |
required |
__setattr__ ¶
Validate clipping_planes and render_planes on assignment.
The model does not validate assignments in general; without this a list would stay a list and a wrong element would be found only when the planes are drawn.
cellier.visuals.MeshSectionConfig ¶
Bases: EventedModel
How a mesh is drawn in a 2D view: its cross-section.
A 2D view cuts the mesh with the slice plane and draws the cut: an outline where the surface crosses the plane, and a fill where the outline closes into loops. Both use the mesh's appearance (colour, opacity). An open surface has no closed loop, so it draws its outline only. A 3D view is not affected.
Only spatial, continuous axes are cut. Along any other sliced axis (a time axis, a discrete axis) the mesh is filtered face by face, as in 3D.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
mode
|
(cut, slab)
|
|
"cut"
|
outline
|
bool
|
Draw the outline. Default |
required |
fill
|
bool
|
Draw the fill. Default |
required |
outline_width
|
float
|
Outline thickness in screen pixels. Default 2. |
required |
Changing
|
|
required |
cellier.visuals.MeshAppearance
module-attribute
¶
MeshAppearance = Annotated[Union[MeshFlatAppearance, MeshPhongAppearance], Field(discriminator='appearance_type')]
cellier.visuals.MeshFlatAppearance ¶
Bases: BaseAppearance
Flat (unlit) mesh — maps to MeshBasicMaterial.
No lights required. Suitable for false-color meshes, wireframe overlays, and rapid inspection.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
color
|
tuple[float, float, float, float]
|
Uniform RGBA, used when color_mode is |
required |
color_mode
|
str
|
|
required |
wireframe
|
bool
|
Render only edges. Default False. |
required |
wireframe_thickness
|
float
|
Edge thickness in screen pixels. Default 1.0. |
required |
opacity
|
float
|
0-1 alpha multiplier. Default 1.0. |
required |
side
|
str
|
|
required |
cellier.visuals.MeshPhongAppearance ¶
Bases: BaseAppearance
Phong-shaded mesh — maps to MeshPhongMaterial.
Requires lights in the scene. Pass lighting="default" to
controller.add_scene() to add ambient + directional lights.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
color
|
tuple[float, float, float, float]
|
Uniform RGBA diffuse color, used when color_mode is
|
required |
color_mode
|
str
|
|
required |
shininess
|
float
|
Specular exponent. Default 30. |
required |
opacity
|
float
|
0-1 alpha multiplier. Default 1.0. |
required |
side
|
str
|
|
required |
flat_shading
|
bool
|
Use face normals instead of smooth vertex normals. Default False. |
required |
Overlays¶
cellier.visuals.CanvasOverlay ¶
Bases: EventedModel
Base model for all canvas-space overlays.
Overlays are rendered as a post-pass on top of the main scene using a
gfx.ScreenCoordsCamera. They have no world-space transform and do
not participate in the reslicing pipeline.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
id
|
UUID4
|
Unique identifier. Auto-generated. |
required |
name
|
str
|
Human-readable label. |
required |
visible
|
bool
|
Whether the overlay is rendered. Default |
required |
cellier.visuals.CenteredAxes2D ¶
Bases: CanvasOverlay
2D axis indicator rendered in screen space as a corner overlay.
Displays two line segments anchored to a fixed canvas corner, one for each displayed axis. The screen-space directions of the segments are computed from the world-space direction vectors supplied here and the live camera matrix, so the indicator correctly reflects any camera orientation. Geometry is recomputed only when the canvas resizes or the camera matrix changes — never on pan or zoom.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
overlay_type
|
str
|
Discriminator literal |
required |
axis_a_direction
|
tuple[float, float, float]
|
Unit vector in pygfx world-space XYZ defining the direction of
axis A. Default |
required |
axis_a_label
|
str
|
Text label drawn at the tip of the axis-A segment. Default |
required |
axis_b_direction
|
tuple[float, float, float]
|
Unit vector in pygfx world-space XYZ defining the direction of
axis B. Default |
required |
axis_b_label
|
str
|
Text label drawn at the tip of the axis-B segment. Default |
required |
appearance
|
CenteredAxes2DAppearance
|
Visual style for the overlay. |
required |
cellier.visuals.CenteredAxes2DAppearance ¶
Bases: EventedModel
Appearance model for a :class:CenteredAxes2D overlay.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
axis_a_color
|
tuple[float, float, float, float]
|
RGBA color for the first axis line segment.
Default green |
required |
axis_b_color
|
tuple[float, float, float, float]
|
RGBA color for the second axis line segment.
Default orange |
required |
line_thickness_px
|
float
|
Line thickness in screen pixels. Default |
required |
length_px
|
float
|
Length of each axis segment in screen pixels. Default |
required |
corner
|
('bottom_left', 'bottom_right', 'top_left', 'top_right', 'center')
|
Canvas corner to anchor to, or |
"bottom_left"
|
corner_offset_px
|
tuple[float, float]
|
|
required |
show_labels
|
bool
|
Whether to render text labels at the arrow tips. Default |
required |
font_size_px
|
float
|
Label font size in screen pixels. Default |
required |
label_color
|
tuple[float, float, float, float]
|
RGBA color for axis text labels. Default white |
required |
cellier.visuals.CanvasOverlayType
module-attribute
¶
CanvasOverlayType = Annotated[Union[CenteredAxes2D,], Field(discriminator='overlay_type')]
Clipping planes¶
Every visual has a clipping_planes tuple, in the level-0 data coordinates
of the store it reads. See Clip a visual with
planes.
cellier.visuals.ClippingPlane
pydantic-model
¶
Bases: BaseModel
One clipping plane of a visual.
The visual is drawn where plane.normal . p >= plane.offset: the
half-space the normal points into. Several planes on one visual keep
the intersection of their half-spaces.
The plane is in the visual's level-0 data coordinate system, the system
its store owns. Build the store first, then the plane from
store.data_coordinate_systems[0], then the visual. Units are data
units: voxels for an image. On anisotropic data the normal is a
covector in voxel space, so a plane tilted 45 degrees in the sample is
not (1, 1, 0) when the voxels are not cubes.
A plane may be defined on some of the data axes only (see
:meth:from_point_normal). A zyx plane on tzyx data holds at
every timepoint.
The model is frozen. Moving a plane means assigning a new tuple to
visual.clipping_planes. Build the moved plane with
item.model_copy(update={"plane": new_plane}) so it keeps its id:
the id is what names a plane across replacements of the tuple. Two
planes built from scratch have different ids and are not equal, even
with the same plane.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
id
|
UUID4
|
Names this plane. Unique within a visual's |
required |
plane
|
Plane
|
The plane, in the visual's level-0 data coordinates. |
required |
enabled
|
bool
|
A disabled plane stays in the list and clips nothing. Toggling it
costs no shader compile. Default |
required |
outline
|
PlaneOutline
|
The line around the plane's cut face: the plane where it crosses the visual's data, inside the visual's other clipping planes. Off by default. It is drawn in a 3D view, while the plane is enabled. |
required |
Config:
frozen:True
Fields:
-
id(UUID4) -
plane(Plane) -
enabled(bool) -
outline(PlaneOutline)
from_point_normal
classmethod
¶
from_point_normal(coordinate_system: CoordinateSystem, point: ArrayLike, normal: ArrayLike, axes: Sequence[AxisRef] | None = None, *, enabled: bool = True, outline: PlaneOutline | None = None) -> ClippingPlane
Build the plane through point that keeps the side normal points to.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
coordinate_system
|
CoordinateSystem
|
The visual's level-0 data coordinate system:
|
required |
point
|
ArrayLike
|
A point on the plane, in data coordinates. |
required |
normal
|
ArrayLike
|
The normal, the same length as point. It points into the kept half-space. |
required |
axes
|
Sequence[AxisRef] or None
|
The axes point and normal are given on, e.g.
|
None
|
enabled
|
bool
|
Whether the plane clips. Default |
True
|
outline
|
PlaneOutline or None
|
The line around the plane's cut face. |
None
|
Returns:
| Type | Description |
|---|---|
ClippingPlane
|
|
Render planes¶
An image or labels visual whose render mode is "plane" draws its data on
its render_planes tuple in a 3D view, instead of as a volume. A render
plane is in the scene's world space.
cellier.visuals.RenderPlane
pydantic-model
¶
Bases: BaseModel
One plane a visual in "plane" render mode draws its data on.
The plane is in the scene's world space, on three named world axes.
origin is a point on it and in_plane_axis_0 and
in_plane_axis_1 are two orthogonal unit vectors in it; all three are
given on axes, in that order. The plane constrains no other world
axis: a zyx plane in a tzyx scene holds at every time point.
The plane is drawn where it crosses the visual's data, inside the
visual's clipping planes, and within extent_0 and extent_1: the
(min, max) distances from origin along the two in-plane axes, in
world units. None is unbounded on that side.
The model is frozen. Moving a plane means assigning a new tuple to
visual.render_planes. Build the moved plane with
plane.model_copy(update={...}) so it keeps its id: the id names
a plane across replacements of the tuple. Two planes built from scratch
have different ids and are not equal, even with the same pose.
(model_copy does not validate: give it unit, orthogonal axes, or use
a constructor.)
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
id
|
UUID4
|
Names this plane. Unique within a visual's |
required |
coordinate_system
|
UUID4
|
The id of the scene's world coordinate system. |
required |
axes
|
tuple of three AxisRef
|
The world axes the pose is given on, by id or name. The constructors store ids. |
required |
origin
|
tuple of three float
|
A point on the plane. |
required |
in_plane_axis_0
|
tuple of three float
|
The in-plane frame. Normalised on construction; they must be finite, non-zero and orthogonal. |
required |
in_plane_axis_1
|
tuple of three float
|
The in-plane frame. Normalised on construction; they must be finite, non-zero and orthogonal. |
required |
extent_0
|
tuple of two (float or None)
|
|
required |
extent_1
|
tuple of two (float or None)
|
|
required |
enabled
|
bool
|
A disabled plane stays in the tuple and is not drawn. Default
|
required |
outline
|
PlaneOutline
|
The line around what is drawn of the plane. Off by default. It is
drawn while the plane is: in a 3D view of the plane's axes, with
the visual in the |
required |
Config:
frozen:True
Fields:
-
id(UUID4) -
coordinate_system(UUID4) -
axes(Axes3) -
origin(Vector3) -
in_plane_axis_0(Vector3) -
in_plane_axis_1(Vector3) -
extent_0(Extent) -
extent_1(Extent) -
enabled(bool) -
outline(PlaneOutline)
Validators:
-
_axis_ids_from_text→axes -
_finite_origin→origin -
_valid_extent→extent_0,extent_1 -
_validate_frame
normal
property
¶
The unit normal, in_plane_axis_0 x in_plane_axis_1, on axes.
Derived, not stored. Which of the two sides it points to changes nothing drawn.
from_point_normal
classmethod
¶
from_point_normal(world: CoordinateSystem, point: ArrayLike, normal: ArrayLike, axes: Sequence[AxisRef] | None = None, up: ArrayLike | None = None, **kwargs: Any) -> RenderPlane
Build the plane through point with the given normal.
The in-plane frame is chosen for the caller. Axis 0 is up
projected into the plane; with no up it is the projection of the
axis (of axes) least aligned with the normal. Axis 1 completes
the frame so that in_plane_axis_0 x in_plane_axis_1 is the
normal.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
world
|
CoordinateSystem
|
The scene's world coordinate system. |
required |
point
|
ArrayLike
|
A point on the plane, on axes. |
required |
normal
|
ArrayLike
|
The plane normal, on axes. Any non-zero length. |
required |
axes
|
sequence of three AxisRef, or None
|
The world axes point and normal are given on, e.g.
|
None
|
up
|
ArrayLike or None
|
A direction, on axes, whose projection into the plane becomes
|
None
|
**kwargs
|
Any
|
|
{}
|
Returns:
| Type | Description |
|---|---|
RenderPlane
|
|
from_rotation
classmethod
¶
from_rotation(world: CoordinateSystem, origin: ArrayLike, rotation: ArrayLike, axes: Sequence[AxisRef] | None = None, **kwargs: Any) -> RenderPlane
Build the plane at origin whose frame is a rotation.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
world
|
CoordinateSystem
|
The scene's world coordinate system. |
required |
origin
|
ArrayLike
|
A point on the plane, on axes. |
required |
rotation
|
ArrayLike
|
A 3 x 3 rotation matrix whose columns are |
required |
axes
|
sequence of three AxisRef, or None
|
The world axes the pose is given on. |
None
|
**kwargs
|
Any
|
|
{}
|
Returns:
| Type | Description |
|---|---|
RenderPlane
|
|
Raises:
| Type | Description |
|---|---|
ValueError
|
If rotation is not a rotation: not orthonormal, or a reflection. |
Plane outlines¶
A clipping plane and a render plane each carry an outline: a line round
the polygon the plane makes in its visual, in a 3D view.
cellier.visuals.PlaneOutline
pydantic-model
¶
Bases: BaseModel
The line along the edge of the polygon a plane makes in its visual.
For a render plane the polygon is what is drawn of it: the plane cut by its extents, by the visual's data box and by the visual's enabled clipping planes. For a clipping plane it is the cut face: the plane cut by the data box and by the visual's other enabled clipping planes.
The model is frozen, as the planes are. An outline is changed the way
a plane is moved: plane.model_copy(update={"outline": ...}) in a
new tuple, which keeps the plane's id. A change of the outline alone
redraws; it does not load data again.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
enabled
|
bool
|
Whether the outline is drawn. Default |
required |
color
|
tuple of four float
|
RGBA, each in |
required |
width
|
float
|
The line's width in screen pixels. Default |
required |
Config:
frozen:True
Fields:
Validators:
-
_valid_color→color -
_finite_width→width
Common¶
cellier.visuals.AABBParams ¶
Bases: EventedModel
Parameters for an axis-aligned bounding box wireframe overlay.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
enabled
|
bool
|
If True, display the AABB wireframe. Default False. |
required |
color
|
str
|
Line color as a CSS color string. Default |
required |
line_width
|
float
|
Line thickness in screen pixels. Default |
required |
cellier.visuals.VisualType
module-attribute
¶
VisualType = Annotated[Union[MultiscaleImageVisual, ImageVisual, LabelMemoryVisual, MultiscaleLabelVisual, PointsVisual, LinesVisual, MeshVisual, MultiscaleMeshVisual, GraphVisual], Field(discriminator='visual_type')]