Skip to content

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.BaseImageVisual

Bases: BaseVisual

The fields and rules both image families share.

Parameters:

Name Type Description Default
channel_axis int or None

The data axis a composite draws channels along. Fixed at construction. None means the image has no channels: composite is unavailable and the visual keeps one slot. The axis must map to a world axis through transform; the controller checks that, since the model has no transform to check against when it is built.

required
composite bool

False (single mode) draws the one sample the world sliders select, with single. True (composite mode) draws every visible entry of channels, each with its own appearance, and ignores the slice position along the channel axis.

Assign it through CellierController.set_image_composite. That refuses to composite an axis the scene displays. A direct assignment is not checked, because the check needs the scene's displayed_axes; the reslice and the events still happen.

required
channels dict[int, channel appearance]

Per-channel appearances, keyed by index along channel_axis. Empty is valid and draws nothing in composite mode.

Every channel has the same render_mode, hidden ones included: the dict is refused otherwise, here and on assignment. Change it with CellierController.set_image_render_mode, which sets every channel together; assigning it to one channel of several is refused. single.render_mode is separate.

required
max_channels int

The most channels channels may hold, in 2D and 3D alike. Default 4.

required
render_planes tuple[RenderPlane, ...]

The planes the visual draws its data on in a 3D view while its render mode is "plane"; ignored in every other mode and in a 2D view. World space; see RenderPlane. At most four. Assign a new tuple to change them: one assignment is one event. Default empty, which in "plane" mode draws nothing.

required

plans_coarse_while_moving

plans_coarse_while_moving(n_displayed_dims: int) -> bool

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

__setattr__

__setattr__(name: str, value: object) -> None

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

drawn_channels(size: int | None = None) -> tuple[int, ...]

The channel indices composite mode draws, ascending.

D = {k in channels : appearance.visible and channels[k].visible and 0 <= k < size}. Empty when the visual is hidden.

Parameters:

Name Type Description Default
size int or None

The length of the channel axis. None skips the range check.

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

draws_nothing(size: int | None = None) -> bool

Whether the visual draws nothing and so needs no slicing.

Hidden, or in composite mode with no drawn channel.

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 visible is gated by it.

required
transparency_mode str or None

The pygfx alpha mode for every drawn channel. None (the default) is automatic: "blend" in single mode and "add" in composite mode, following the mode as it switches. An explicit value always wins.

required
interpolation str

Texture sampler filter. "nearest" (default) or "linear".

required
slab_projection str

In a 2D view, reduce the slab the scene's thickness selects instead of drawing one plane: "mip" (maximum), "minip" (minimum) or "mean", along the one world axis projection_axes names. "none" (the default) draws the plane at the slice position. The slab is slice +- thickness on that axis (the scene's dims.selection.thickness); a zero thickness draws the plane. Each channel projects on its own, then composites; the contrast limits and colormap apply to the projected value. Ignored by a 3D view.

required
projection_axes tuple[str, ...]

The world axis to project along, by name, e.g. ("z",). It must be sliced in the view: a displayed axis, more than one axis or an axis the world does not have draws the plane with a status. Empty (the default) projects nothing.

required
projection_steps_per_voxel float

Samples per voxel of the drawn level along a projection's ray, in [0.25, 8]. Default 1.0: one sample per voxel.

required

cellier.visuals.BaseImageSingleAppearance

Bases: CellierEventedModel

The mode-dependent fields both image families share.

Parameters:

Name Type Description Default
color_map Colormap

Colormap applied after contrast normalisation. Accepts any cmap-registered name. Default "gray".

required
clim tuple[float, float]

Contrast limits (min, max). Default (0.0, 1.0).

required
opacity float

Opacity in [0, 1]. Default 1.0.

required
iso_threshold float

Isosurface threshold for the iso render modes.

required

cellier.visuals.effective_transparency_mode

effective_transparency_mode(visual: Any) -> str

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 "image_memory".

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 False; frozen. A view on the brick route reslices on camera moves anyway (the controller decides per view).

required
render_config InMemoryImageRenderConfig

The brick route's GPU configuration.

required

__setattr__

__setattr__(name: str, value: object) -> None

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

drawn_channels(size: int | None = None) -> tuple[int, ...]

The channel indices composite mode draws, ascending.

D = {k in channels : appearance.visible and channels[k].visible and 0 <= k < size}. Empty when the visual is hidden.

Parameters:

Name Type Description Default
size int or None

The length of the channel axis. None skips the range check.

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

draws_nothing(size: int | None = None) -> bool

Whether the visual draws nothing and so needs no slicing.

Hidden, or in composite mode with no drawn channel.

plans_coarse_while_moving

plans_coarse_while_moving(n_displayed_dims: int) -> bool

The 2D moving setting in a 2D view; False in 3D.

Only a view on the brick route plans by level, so only it is affected.

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=.

The level-of-detail and motion fields apply to a 2D view on the brick route only -- a tilted view, or a projecting image -- which draws the array from 3D bricks with a coarse level. Aligned 2D views and 3D views load the whole slice and ignore them.

Parameters:

Name Type Description Default
settled_lod_bias float

Level-of-detail bias of a settled view on the brick route. Divisor on the screen-space LOD threshold: higher is coarser. Default 1.0.

required
coarsest_while_moving_2d bool

On the brick route, each tick of a dims scrub, a transform drag (inside transform_interaction) or a thickness drag loads only the new slice's coarse level; the full level is loaded once the motion ends. Default False.

required
force_level int or None

1-indexed level the brick route draws (1 is the array, 2 its coarse level), overriding the automatic choice. Default None.

required

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: "mip" (default), "iso", "minip", or "plane", which draws the data on the visual's render_planes instead of as a volume. Ignored by the 2D 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 appearance.visible. Default True.

required

cellier.visuals.InMemoryImageRenderConfig pydantic-model

Bases: CellierModel

Render-layer configuration of an in-memory image's brick route.

Used only while a 2D view draws the image from 3D bricks (a tilted view, or a projecting image). Nothing is allocated for a visual that never takes that route.

Parameters:

Name Type Description Default
block_size int

Brick side length in voxels. Default 32.

required
gpu_budget_bytes int

Maximum GPU memory for the brick atlas, split between the channels the visual can draw. Default 1 GiB.

required
loading ProgressiveLoadingConfig

The coarse backstop loaded ahead of the full level. Changing only this reslices; the other fields take effect when the route is first taken.

required

Config:

  • frozen: True

Fields:

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 "multiscale_image".

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__

__setattr__(name: str, value: object) -> None

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

drawn_channels(size: int | None = None) -> tuple[int, ...]

The channel indices composite mode draws, ascending.

D = {k in channels : appearance.visible and channels[k].visible and 0 <= k < size}. Empty when the visual is hidden.

Parameters:

Name Type Description Default
size int or None

The length of the channel axis. None skips the range check.

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

draws_nothing(size: int | None = None) -> bool

Whether the visual draws nothing and so needs no slicing.

Hidden, or in composite mode with no drawn channel.

plans_coarse_while_moving

plans_coarse_while_moving(n_displayed_dims: int) -> bool

The moving setting of the view being planned.

appearance.coarsest_while_moving_3d for a 3D view, appearance.coarsest_while_moving_2d for a 2D one.

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 "attenuated_mip". Default 1.0.

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, while its clipping planes are dragged (CellierController.plane_interaction), or while its transform is dragged (CellierController.transform_interaction). A dims tick then loads the new slice's coarse backstop only; a plane or transform drag plans nothing and keeps the last plan, whose bricks move with the transform. The target is planned once every motion has ended. False plans in full on every tick and nothing more at the end. Default True.

required
coarsest_while_moving_2d bool

The same, for a 2D view: each tick of a dims scrub, of a transform drag (inside transform_interaction) or of a thickness drag (inside dims_interaction, or sent with update_thickness(..., interactive=True)) loads only the new slice's coarse backstop. This includes a tilted 2D view drawn from 3D bricks (the brick route). True saves most of a drag's reads, is the setting for a slow store, and is what keeps a tilted view at 30 fps at native zoom. Default False.

required
force_level int or None

1-based pyramid level to draw (1 is the finest), overriding the automatic choice; clamped to the pyramid. 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 1 / (2 * ray_steps_per_voxel) of its value). 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.MultiscaleImageSingleAppearance

Bases: BaseImageSingleAppearance

Single-mode appearance of a multiscale image visual.

Parameters:

Name Type Description Default
render_mode str

"iso" (default), "mip", "smooth_iso", "attenuated_mip", or "plane", which draws the data on the visual's render_planes instead of as a volume.

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 True.

required

cellier.visuals.MultiscaleImageRenderConfig pydantic-model

Bases: CellierModel

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 channels, not the slot pool's max_channels, so an unused slot takes no budget from a drawing one. A visual with no channel axis, or none configured, gets all of it. Default 1 GiB.

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:

cellier.visuals.ProgressiveLoadingConfig pydantic-model

Bases: CellierModel

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.

Optional intermediate stages load between the two. A stage is the target moved a fixed number of levels coarser (its offset): it covers what the view shows and nothing else, with far fewer reads, so a slow store shows a medium picture while the target loads. With no stage (the default) loading is coarse, then fine.

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 force_level (1 is the finest), so at least 1. Clamped to the pyramid. None (the default) is the coarsest level.

required
backstop_extent ('full', 'view')

"full" (default): the whole volume in 3D, so orbiting never exposes black, and the whole slice in 2D. "view": frustum-culled in 3D, and the viewport plus one backstop tile of margin in 2D.

"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 cellier.render.cache names the settings that would avoid it. In (0, 0.5]; default 0.1.

required
intermediate_offsets tuple of int

One intermediate stage per offset, given coarse to fine: each offset at least 1 and smaller than the one before, so (4, 2) is accepted and (2, 4) and (2, 2) are refused. Nothing is re-sorted. An offset is a number of levels coarser than each target brick's own level; a stage brick at or beyond the backstop level is dropped, so a stage may be empty for a view. The first (largest) offset may be at most 254. () (the default) is no stage; (2,) is coarse, medium, fine.

required
intermediate_max_slot_fraction float

At most this share of an atlas's slots holds the bricks of all the stages together, filled coarsest stage first, each nearest the camera (3D) or canvas centre (2D) first. When it truncates, one INFO line per visual on cellier.render.cache says so. It sits beside backstop_max_slot_fraction: the target gets what the backstop and stage bricks actually use leave. In (0, 0.5]; default 0.1.

required

Config:

  • frozen: True

Fields:

  • backstop_level (int | None)
  • backstop_extent (Literal['full', 'view'])
  • backstop_max_slot_fraction (float)
  • intermediate_offsets (tuple[int, ...])
  • intermediate_max_slot_fraction (float)

Validators:

  • _refuse_removed_fields
  • _offsets_run_coarse_to_fine → intermediate_offsets

cellier.visuals.GeometryLodConfig pydantic-model

Bases: CellierModel

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). None (the default) is the coarsest level the store has. A level the store does not have is refused when the visual is added. Level numbers on a pick (MeshPickInfo.level) and on a store request are 0-based instead.

required
dims_drag ('coarse', 'full')

What a dims scrub loads for each new position. "coarse" (the default) loads the coarse level while the slider moves and the finest when it rests; "full" loads both on every tick.

"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" (the default) draws the coarse level while the slider moves, so a very large mesh does not slow the scrub's frames; the finest stays loaded and returns when the scrub ends. "full" keeps drawing the finest. Applies at once, with no read.

"coarse"
camera_motion ('coarse', 'full')

What is drawn while the camera moves in a 3D view. "coarse" (the default) draws the coarse level on the canvas whose camera is moving; "full" keeps drawing the finest. Applies at once, with no read.

"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

coarse_scale_index(level_count: int) -> int | None

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

None when the store has one level: there is no coarse level.

Raises:

Type Description
ValueError

If coarse_level names a level the store does not have.

Masked image

The isosurface of a multiscale mask, coloured by a second (value) image. Build it with Viewer.add_masked_image.

cellier.visuals.MaskedImageVisual

Bases: MultiscaleImageVisual

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

Build it with cellier.controller.CellierController.add_masked_image, which registers both stores and checks that they can be drawn together.

Parameters:

Name Type Description Default
visual_type Literal['masked_image']

Discriminator field. Always "masked_image".

required
data_store_id str

The mask's store.

required
level_transforms list[AffineTransform]

The mask store's levels.

required
value_store_id str

The value's store. Frozen.

required
value_to_mask AffineTransform or None

Value level-0 data coordinates to mask level-0 data coordinates. The value image's world transform is this, then transform, so moving the visual moves both images together. None means the two share a grid. Frozen.

required
value_level_transforms list[AffineTransform]

The value store's levels.

required
appearance MaskedImageAppearance

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

required
single MaskedImageSingleAppearance

The surface's appearance.

required
render_config MaskedImageRenderConfig

Each image's GPU budget.

required
Notes

Refused at construction: a channel_axis, composite=True, any channels and any render_planes. A c axis in the stores is a slider axis like t, not a channel axis.

__setattr__

__setattr__(name: str, value: object) -> None

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

plans_coarse_while_moving(n_displayed_dims: int) -> bool

The moving setting of the view being planned.

appearance.coarsest_while_moving_3d for a 3D view, appearance.coarsest_while_moving_2d for a 2D one.

drawn_channels

drawn_channels(size: int | None = None) -> tuple[int, ...]

The channel indices composite mode draws, ascending.

D = {k in channels : appearance.visible and channels[k].visible and 0 <= k < size}. Empty when the visual is hidden.

Parameters:

Name Type Description Default
size int or None

The length of the channel axis. None skips the range check.

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

draws_nothing(size: int | None = None) -> bool

Whether the visual draws nothing and so needs no slicing.

Hidden, or in composite mode with no drawn channel.

cellier.visuals.MaskedImageAppearance

Bases: MultiscaleImageAppearance

Shared appearance of a MaskedImage.

The level-of-detail fields apply to each image on its own pyramid. On an in-memory image, which is single scale, they have one level to choose and do nothing.

Parameters:

Name Type Description Default
interpolation str

Texture filter for both images: "linear" (default) or "nearest".

required
target_bricks str

Which target bricks a 3D view loads. "visible" (default): every brick the view shows, as a multiscale image does. "surface": only those near the surface, found from the coarse mask; a feature too thin for the coarse level is never loaded. Ignored by a 2D view.

required
force_level int or None

1-based level of the mask a view draws, overriding the automatic choice (1 is the finest). Default None.

required
value_force_level int or None

The same for the value image, whose pyramid can differ. Default None.

required
Notes

slab_projection must stay "none" and projection_axes empty: a MaskedImage does not project a slab. projection_steps_per_voxel sets the samples a value voxel along the surface normal instead.

cellier.visuals.MaskedImageSingleAppearance

Bases: BaseImageSingleAppearance

The appearance of a MaskedImage's surface and band.

color_map, clim and opacity apply to the value image, in its own units. iso_threshold is in the mask's units and applies in 2D as well as 3D. Both are the arrays' own numbers, not normalised: a uint8 binary mask of 0 and 255 takes a threshold of 127.5.

Parameters:

Name Type Description Default
render_mode Literal['iso']

Always "iso".

required
surface_thickness float

World units, shared by 2D and 3D. In 3D the value image is reduced along the surface normal over this length; 0 reads the value at the surface. In 2D it is the width of the contour band; 0 is a hairline surface_min_width_px wide. Default 0.

required
surface_projection str

3D only: "max" (default), "mean" or "min" of the value along the normal. A 2D pixel shows its own value.

required
surface_placement str

Where the thickness lies relative to the surface, in 2D and 3D: "inward" (default, into the mask), "centred" or "outward".

required
surface_min_width_px float

2D only: a band is drawn at least this many screen pixels wide, so it neither shimmers when zoomed out nor vanishes at thickness 0. 0 draws the strictly physical width. Default 1.0.

required
band_rays int

2D only: rays in the fan that searches for the contour. Fewer is faster and loses up to a few percent of the band at its far edge on a steep mask. Default 16.

required
band_cap int

2D only: the steps a search ray takes before its step widens to reach / band_cap, bounding the reads a pixel. Default 32.

required

cellier.visuals.MaskedImageRenderConfig pydantic-model

Bases: MultiscaleImageRenderConfig

GPU configuration of a MaskedImage: one budget for each image.

Each image's 3D atlas is allocated at its budget whatever the image's size, so two defaults reserve about 2 GiB of GPU memory even for a small pair; lower either field to reserve less. An in-memory image whose one level does not fit its budget is refused when added.

Parameters:

Name Type Description Default
gpu_budget_bytes int

The mask's 3D atlas. Default 1,100 MiB.

required
value_gpu_budget_bytes int

The value's 3D atlas. Default 1,100 MiB.

required
Notes

gpu_budget_bytes_2d is inherited and unused: every view of a MaskedImage, 2D included, is drawn from 3D bricks.

Fields:

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
render_config InMemoryLabelRenderConfig

The brick route's GPU configuration.

required

__setattr__

__setattr__(name: str, value: object) -> None

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.

plane_mode

plane_mode() -> bool

Whether a 3D view draws this visual on its render_planes.

plans_coarse_while_moving

plans_coarse_while_moving(n_displayed_dims: int) -> bool

The 2D moving setting in a 2D view; False in 3D.

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 ValidationError on mutation.

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 str

3D rendering mode.

"iso_categorical" (the default) draws the voxel faces of every label, lit by the face normals. "flat_categorical" draws the same faces unlit.

"smooth_iso" draws the same voxel faces, lit by a normal that varies smoothly across them, so a label looks rounded while its outline stays on the voxel grid. It costs about the same as "iso_categorical".

"smooth_geometry" draws a smooth surface per label instead of voxel faces: each label's voxels are blended trilinearly and the surface sits where a label carries more than smooth_geometry_level of the weight. At the default level, flat sides stay on the voxel faces, convex corners round off and concave ones fill in, so outlines and depth are smooth too. Where two labels touch, each is rounded on its own, which leaves a small groove along their shared edge. A single voxel still draws, as a small blob. It is several times as expensive as the other modes.

"plane" draws the labels on the visual's render_planes instead of as a volume.

required
smooth_geometry_level float

Where the "smooth_geometry" surface sits: the share of the blended weight a label must carry, in [0.05, 0.95]. The default, 0.5, puts flat sides exactly on the voxel faces. Lower grows every label -- voxels that touch only along an edge or at a corner join up, thin structures look solid, and the grooves between touching labels narrow -- and higher shrinks it. No effect in the other modes.

required

cellier.visuals.InMemoryLabelsAppearance

Bases: BaseLabelsAppearance

Appearance parameters for an in-memory label visual.

The level-of-detail and motion fields apply to a 2D view on the brick route only -- a tilted view -- which draws the labels from 3D bricks with a coarse level. Aligned 2D views and 3D views load the whole slice and ignore them.

Parameters:

Name Type Description Default
settled_lod_bias float

Level-of-detail bias of a settled view on the brick route. Divisor on the screen-space LOD threshold: higher is coarser. Default 1.0.

required
coarsest_while_moving_2d bool

On the brick route, each tick of a dims scrub or a transform drag (inside transform_interaction) loads only the new slice's coarse level; the full level is loaded once the motion ends. Default False.

required
force_level int or None

1-indexed level the brick route draws (1 is the array, 2 its coarse level), overriding the automatic choice. Default None.

required

cellier.visuals.InMemoryLabelRenderConfig pydantic-model

Bases: CellierModel

Render-layer configuration of an in-memory labels visual's brick route.

Used only while a tilted 2D view draws the labels from 3D bricks. Nothing is allocated for a visual that never takes that route.

Parameters:

Name Type Description Default
block_size int

Brick side length in voxels. Default 32.

required
gpu_budget_bytes int

Maximum GPU memory for the brick atlas. Default 1 GiB.

required
loading ProgressiveLoadingConfig

The coarse backstop loaded ahead of the full level. Changing only this reslices; the other fields take effect when the route is first taken.

required

Config:

  • frozen: True

Fields:

cellier.visuals.OutlineMode module-attribute

OutlineMode = Literal['per_label', 'whole_object', 'all_boundaries', 'depth_threshold']

How a labels visual is outlined; see LabelMemoryVisual.outline_mode.

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__

__setattr__(name: str, value: object) -> None

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.

plane_mode

plane_mode() -> bool

Whether a 3D view draws this visual on its render_planes.

plans_coarse_while_moving

plans_coarse_while_moving(n_displayed_dims: int) -> bool

The moving setting of the view being planned.

appearance.coarsest_while_moving_3d for a 3D view, appearance.coarsest_while_moving_2d for a 2D one.

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 BaseLabelsAppearance. Frozen.

required
background_label int

Inherited from BaseLabelsAppearance.

required
salt int

Inherited from BaseLabelsAppearance.

required
color_dict dict

Inherited from BaseLabelsAppearance.

required
render_mode str

The modes of BaseLabelsAppearance, plus "gradient_debug", which draws the surface normal as RGB to diagnose shading across brick boundaries. Not frozen -- live-mutable. In "smooth_geometry" the surface is found exactly rather than by ray steps, so ray_steps_per_voxel has no effect on it.

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, while its clipping planes are dragged (CellierController.plane_interaction), or while its transform is dragged (CellierController.transform_interaction). A dims tick then loads the new slice's coarse backstop only; a plane or transform drag plans nothing and keeps the last plan, whose bricks move with the transform. The target is planned once every motion has ended. False plans in full on every tick and nothing more at the end. Default True.

required
coarsest_while_moving_2d bool

The same, for a 2D view: each tick of a dims scrub, of a transform drag (inside transform_interaction) or of a thickness drag (inside dims_interaction, or sent with update_thickness(..., interactive=True)) loads only the new slice's coarse backstop. This includes a tilted 2D view drawn from 3D bricks (the brick route). True saves most of a drag's reads, is the setting for a slow store, and is what keeps a tilted view at 30 fps at native zoom. Default False.

required
force_level int | None

1-based pyramid level to draw (1 is the finest), overriding the automatic choice; clamped to the pyramid. 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: CellierModel

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. The tiles share one near-square texture, so ceil(sqrt(paint_max_tiles)) * block_size must not exceed the device's maximum 2-D texture dimension.

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:

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__

__setattr__(name: str, value: object) -> None

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

plans_coarse_while_moving(n_displayed_dims: int) -> bool

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 colour of every point when color_mode is "uniform". Not a fallback: with color_mode="vertex" it is unused, and a store with no per-point colours raises ValueError when the points are drawn.

required
size float

Uniform point size, interpreted in size_space units.

required
size_space str

Coordinate space for size. "screen" (pixels) or "world" (world-space units). Default "screen".

required
color_mode str

Declares where RGB comes from. "uniform" — use color for every point. "vertex" — use per-point colors from the store. A caller declaration, never inferred from the data and never overwritten at commit time.

required
size_mode str

Declares where the size comes from, on the same terms as color_mode. "uniform" — use size for every point. "vertex" — use per-point sizes from the store. Declaring "vertex" with no sizes in the store raises at commit rather than falling back.

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__

__setattr__(name: str, value: object) -> None

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

plans_coarse_while_moving(n_displayed_dims: int) -> bool

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 colour of every vertex when color_mode is "uniform". Not a fallback: with color_mode="vertex" it is unused, and a store with no per-vertex colours raises ValueError when the lines are drawn.

required
thickness float

Line thickness, interpreted in thickness_space units.

required
thickness_space str

Coordinate space for thickness. "screen" (logical pixels) or "world" (world-space units). Default "screen".

required
color_mode str

"uniform" — use color for every vertex. "vertex" — use per-vertex colors from the store; the store must carry them.

required
opacity float

Master opacity multiplier in [0, 1].

required

Graphs

A spatial graph from a GraphMemoryStore: nodes drawn as points and edges as lines. TrailConfig widens the slab on one sliced axis, for example to show a time window.

cellier.visuals.GraphVisual

Bases: BaseVisual

Model-layer visual for a spatial graph backed by GraphMemoryStore.

Rendered as a pygfx compound: one group holding a points node and a line-segment node.

trail lives on the visual rather than on the appearance because it selects which data is fetched, so every change to it must trigger a reslice. Keys are axis indices; axis names were considered and rejected to keep the visual decoupled from the store's metadata and consistent with the rest of the dims API.

An out-of-range trail axis raises ValueError when the visual is added or the trail assigned (the check needs the store's ndim, which the visual does not hold). A valid axis that is currently displayed has no effect, and warns once per (visual, axis) the first time it is sliced that way.

Parameters:

Name Type Description Default
appearance GraphAppearance

Initial appearance.

required
trail dict[int, TrailConfig]

Axis index -> window configuration. Not restricted to one axis; alphas multiply across axes.

required
requires_camera_reslice bool

Always False -- graphs do not depend on camera position. Frozen.

required

__setattr__

__setattr__(name: str, value: object) -> None

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

plans_coarse_while_moving(n_displayed_dims: int) -> bool

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.GraphAppearance

Bases: BaseAppearance

Appearance model for a graph visual.

Flat, with node_ / edge_ prefixes, on purpose. psygnal does not propagate nested EventedModel field changes to the parent's event group, and the controller listens only to visual.appearance.events -- so composing this from PointsMarkerAppearance and LinesMemoryAppearance would silently drop every node and edge appearance change. The cost is a dozen duplicated field declarations; the benefit is that the appearance event bridge, the GUI control generation and serialization all work unchanged.

BaseAppearance contributes visible, opacity, render_order and the depth/transparency fields. visible and render_order apply to the group; the rest are pushed to both child materials, with node_depth_compare / edge_depth_compare overriding depth_compare per child.

Parameters:

Name Type Description Default
node_color tuple[float, float, float, float]

RGBA uniform node colour, used when node_color_mode is "uniform".

required
node_size float

Uniform node size, in node_size_space units.

required
node_size_space str

"screen" (pixels) or "world".

required
node_color_mode str

Declares where node RGB comes from: "uniform" is this model's node_color, "vertex" is the store's per-node colours. A caller declaration, never inferred from the data and never overwritten at commit time.

required
node_size_mode str

Declares where the node size comes from, on the same terms as node_color_mode. "uniform" is this model's node_size, "vertex" is the store's per-node sizes. Declaring "vertex" with no sizes in the store raises at commit rather than falling back.

required
node_visible bool

Show the node sub-visual. Nests under visible.

required
node_pick_write bool

Write nodes into the pick buffer.

required
node_depth_compare str

Defaults to "<=", not BaseAppearance's "<", so a node coplanar with an edge wins the tie and reads on top. This is the mechanism -- render_order was measured and does nothing for coplanar children. User-overridable like any other field.

required
edge_color tuple[float, float, float, float]

RGBA uniform edge colour. A dimmer grey than the node default so nodes read on top without any depth trickery.

required
edge_thickness float

Edge thickness, in edge_thickness_space units.

required
edge_thickness_space str

"screen" (logical pixels) or "world".

required
edge_color_mode str

As node_color_mode, for edges.

required
edge_visible bool

Show the edge sub-visual.

required
edge_pick_write bool

Write edges into the pick buffer.

required
edge_depth_compare str

Standard "<"; see node_depth_compare for why they differ.

required

cellier.visuals.TrailConfig

Bases: CellierEventedModel

Asymmetric window on one sliced axis.

Extends the slab on a single axis to [index - before, index + after], optionally fading elements by their distance from the current index. Nothing here presumes the axis is time: it works identically for a z-depth window or a channel sweep.

The axis is the dict key on the visual, not a field here, so a config can never disagree with where it is filed.

Every extent here is in world units. The render layer divides them by the axis's scale before the store sees them. World units are the only choice that stays meaningful on an irregularly sampled axis: a two-second trail is two seconds wherever the slider sits, spanning three densely sampled frames in one place and two sparse ones in another. Stated in data units it would be "two frames", which is a different physical length at every position.

Parameters:

Name Type Description Default
before float

Extent of the window below the current slice position, in world units. Default 0.5. A trail only widens the scene's own slab: the window on the axis is the larger of this and the scene's half-thickness there.

required
after float

Extent above the current slice position, in world units, on the same terms. Default 0.5.

required
fade bool

If True, elements fade with distance from the current index. The fade rides its own per-element alpha buffer, so it composes with either color_mode and never overwrites it.

required
fade_before float | None

Falloff distance below the position, in world units. None uses before -- the window width is the only sensible falloff when none is given.

required
fade_after float | None

Falloff distance above the position, in world units. None uses after.

Accepted wart: the store applies the fade linearly in data units, so on an irregularly sampled axis the alpha ramps unevenly per world unit -- faster per second through a densely sampled window than through a sparse one. Computing it in world units would require the store to know the transform, which it deliberately does not.

required
min_alpha float

Floor applied to in-window elements, so a trail need not vanish before the window ends. Out-of-window elements are forced to exactly 0.0 regardless, so a dangling edge fades to nothing at the boundary rather than being cut square.

required

resolved_fade_before property

resolved_fade_before: float

fade_before, falling back to before.

resolved_fade_after property

resolved_fade_after: float

fade_after, falling back to after.

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 "mesh_memory".

required
data_store_id str

UUID string of the associated MeshMemoryStore.

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__

__setattr__(name: str, value: object) -> None

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

plans_coarse_while_moving(n_displayed_dims: int) -> bool

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

draws_nothing

draws_nothing() -> bool

Whether the mesh is hidden, and so loads nothing.

A hidden mesh is not planned, and its reads stop. Shown again at the same position it reads nothing: what it held is still there.

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 "mesh_multiscale".

required
data_store_id str

UUID string of the associated MultiscaleMeshStore.

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__

__setattr__(name: str, value: object) -> None

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.

draws_nothing

draws_nothing() -> bool

Whether the mesh is hidden, and so loads nothing.

A hidden mesh is not planned, and its reads stop. Shown again at the same position it reads nothing: what it held is still there.

plans_coarse_while_moving

plans_coarse_while_moving(n_displayed_dims: int) -> bool

True when lod.dims_drag is "coarse", in 2D and 3D.

While the scene's dims are scrubbed the mesh then loads its coarse level only, and the finest once when the scrub ends.

cellier.visuals.MeshSectionConfig

Bases: CellierEventedModel

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" (default) draws the cut by the slice plane itself; the scene's thickness on the cut axis is ignored, so a thick slab that shows many image planes still shows one mesh outline. "slab" draws what lies inside the scene's slab: the surface between its two faces, flattened, with a cap at each face and both cuts as the outline. With no thickness the two are the same.

"cut"
outline bool

Draw the outline. Default True.

required
fill bool

Draw the fill. Default True.

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')]

A mesh appearance (flat or Phong), told apart by 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 "uniform".

required
color_mode str

"uniform", "vertex", or "face".

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

"both", "front", or "back". Default "both".

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 "uniform".

required
color_mode str

"uniform", "vertex", or "face".

required
shininess float

Specular exponent. Default 30.

required
opacity float

0-1 alpha multiplier. Default 1.0.

required
side str

"both", "front", or "back". Default "front".

required
flat_shading bool

Use face normals instead of smooth vertex normals. Default False.

required

Overlays

Canvas overlays

Drawn in screen space, on top of one canvas.

cellier.visuals.CanvasOverlay

Bases: CellierEventedModel

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 True.

required

cellier.visuals.CenteredAxes2D

Bases: CanvasOverlay

2D axis indicator rendered in screen space.

Displays two line segments from one anchor point, one for each displayed axis. The anchor is the canvas centre by default, or a canvas corner (CenteredAxes2DAppearance.corner). The screen-space directions of the segments are computed from the world-space direction vectors supplied here and the live camera rotation, so the indicator follows any camera orientation. Geometry is recomputed only when the canvas resizes or the camera rotates; panning and zooming leave it unchanged.

Parameters:

Name Type Description Default
overlay_type str

Discriminator literal "centered_axes_2d". Do not set manually.

required
axis_a_direction tuple[float, float, float]

Unit vector in pygfx world-space XYZ defining the direction of axis A. Default (0.0, 1.0, 0.0) (world +Y, screen up for standard 2D cameras).

required
axis_a_label str

Text label drawn at the tip of the axis-A segment. Default "A".

required
axis_b_direction tuple[float, float, float]

Unit vector in pygfx world-space XYZ defining the direction of axis B. Default (1.0, 0.0, 0.0) (world +X, screen right for standard 2D cameras).

required
axis_b_label str

Text label drawn at the tip of the axis-B segment. Default "B".

required
appearance CenteredAxes2DAppearance

Visual style for the overlay.

required

cellier.visuals.CenteredAxes2DAppearance

Bases: CellierEventedModel

Appearance model for a 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 (0.23, 0.67, 0.23, 1.0).

required
axis_b_color tuple[float, float, float, float]

RGBA color for the second axis line segment. Default orange (0.80, 0.40, 0.00, 1.0).

required
line_thickness_px float

Line thickness in screen pixels. Default 2.0.

required
length_px float

Length of each axis segment in screen pixels. Default 60.0.

required
corner ('bottom_left', 'bottom_right', 'top_left', 'top_right', 'center')

Canvas corner to anchor to, or "center" to place the origin at the canvas centre. Default "center".

"bottom_left"
corner_offset_px tuple[float, float]

(x, y) offset in pixels from the anchor corner, where (0, 0) is the corner itself. The offset moves the origin inward (right for left corners, left for right corners; down for top corners, up for bottom corners). Ignored when corner is "center". Default (20.0, 20.0).

required
show_labels bool

Whether to render text labels at the arrow tips. Default True.

required
font_size_px float

Label font size in screen pixels. Default 12.0.

required
label_color tuple[float, float, float, float]

RGBA color for axis text labels. Default white (1.0, 1.0, 1.0, 1.0).

required

cellier.visuals.DrawStatusOverlay

Bases: CanvasOverlay

Lists, in a canvas corner, the visuals its view does not draw.

A 2D view whose slice cuts a rotated image at an angle draws nothing of it rather than something wrong; this overlay says so where the user is looking, one line per visual: Not shown: <name> (OBLIQUE). It draws nothing while every visual draws. The full reason is on draw_status.

The convenience viewers add one to every canvas by default (draw_status_overlay=True).

Parameters:

Name Type Description Default
overlay_type str

Discriminator literal "draw_status". Do not set manually.

required
name str

Human-readable label. Default "draw status".

required
font_size_px float

Text size in screen pixels. Default 13.0.

required
color tuple[float, float, float, float]

RGBA text colour. Default amber (1.0, 0.85, 0.35, 1.0).

required
corner_offset_px tuple[float, float]

(x, y) offset of the text's top-left corner from the canvas's top-left corner, in pixels. Default (8.0, 8.0).

required

cellier.visuals.CanvasOverlayType module-attribute

CanvasOverlayType = Annotated[Union[CenteredAxes2D, DrawStatusOverlay], Field(discriminator='overlay_type')]

Any canvas overlay model, told apart by its overlay_type field.

Scene overlays

Drawn in world space, in every canvas that shows the scene.

cellier.visuals.SceneOverlay

Bases: CellierEventedModel

Base model for all scene overlays.

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 True.

required

cellier.visuals.SceneBoundingBox

Bases: SceneOverlay

Wireframe around the world bounding box of every visual in a scene.

The box is the union over all visuals -- hidden ones included -- of each store's level-0 extent mapped through the visual's data -> world transform, taken over every world axis and then projected onto the displayed ones. It therefore spans the whole dataset rather than the current slice: moving a slider does not move it. Displayed in 3D it is the 12 edges of a box; in 2D, the 4 edges of a rectangle.

Parameters:

Name Type Description Default
overlay_type str

Discriminator literal "scene_bounding_box". Do not set manually.

required
appearance SceneBoundingBoxAppearance

Visual style for the box.

required

cellier.visuals.SceneBoundingBoxAppearance

Bases: CellierEventedModel

Appearance model for a SceneBoundingBox.

Parameters:

Name Type Description Default
color tuple[float, float, float, float]

RGBA line colour. Default mid gray (0.5, 0.5, 0.5, 1.0).

required
thickness float

Line thickness in screen pixels. Default 1.5.

required
render_order int

pygfx render order. Default 1, after visuals at the default 0: a MIP image depth-tests but writes no depth, so drawn after the box it would paint over every edge behind the volume's front faces.

required

cellier.visuals.SceneOverlayType module-attribute

SceneOverlayType = Annotated[Union[SceneBoundingBox,], Field(discriminator='overlay_type')]

Any scene overlay model, told apart by its overlay_type field.

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: CellierModel

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 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 clipping_planes. Generated when not given.

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 True.

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:

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: store.data_coordinate_systems[0].

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. ("z", "y", "x"). The other axes are not constrained. None means every axis of the system.

None
enabled bool

Whether the plane clips. Default True.

True
outline PlaneOutline or None

The line around the plane's cut face. None is no outline.

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: CellierModel

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 render_planes. Generated when not given.

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)

(min, max) along each in-plane axis; None is unbounded. A bounded pair needs min < max.

required
extent_1 tuple of two (float or None)

(min, max) along each in-plane axis; None is unbounded. A bounded pair needs min < max.

required
enabled bool

A disabled plane stays in the tuple and is not drawn. Default True.

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 "plane" render mode.

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

normal: Vector3

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. ("z", "y", "x"). None means the system's axes, which must then be three.

None
up ArrayLike or None

A direction, on axes, whose projection into the plane becomes in_plane_axis_0. It must not be parallel to the normal.

None
**kwargs Any

extent_0, extent_1, enabled, outline, id.

{}

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 in_plane_axis_0, in_plane_axis_1 and the normal, on axes; or a quaternion (x, y, z, w) (scalar last) of that rotation, its vector part on axes.

required
axes sequence of three AxisRef, or None

The world axes the pose is given on. None means the system's axes, which must then be three.

None
**kwargs Any

extent_0, extent_1, enabled, outline, id.

{}

Returns:

Type Description
RenderPlane

Raises:

Type Description
ValueError

If rotation is not a rotation: not orthonormal, or a reflection.

cellier.visuals.MAX_RENDER_PLANES module-attribute

MAX_RENDER_PLANES = 4

The most render planes a visual may carry.

The shader's uniforms hold this many, so adding or removing a plane is a uniform write, not a shader compile.

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: CellierModel

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 False. Switching it off keeps the colour and the width.

required
color tuple of four float

RGBA, each in [0, 1]. Default opaque white.

required
width float

The line's width in screen pixels. Default 2.0.

required

Config:

  • frozen: True

Fields:

Validators:

  • _valid_color → color
  • _finite_width → width

Common

cellier.visuals.AABBParams

Bases: CellierEventedModel

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 "#ffffff".

required
line_width float

Line thickness in screen pixels. Default 2.0.

required

cellier.visuals.VisualOutline

Bases: CellierEventedModel

Screen-space outline assignment for one visual.

The global outline configuration -- palette, thicknesses, layer enables, the contrast band -- lives in RenderManagerConfig.outline, because it is shared by every outlined visual. What is here is only the part that is genuinely about this one visual: which palette slot it uses, and which side of its own edge the band sits on.

Parameters:

Name Type Description Default
slot int

0 (the default) means the visual is not outlined. 1 upward selects palette entry slot - 1 from RenderManagerConfig.outline.palette for the selection layer; any nonzero slot also makes the visual visible to the boundaries layer.

required
placement str or None

"inward" puts the band inside the region's own footprint, so the region never appears to grow, but one thinner than twice the band is consumed entirely. "outward" puts it outside, reading as a halo and leaving the region intact. None (the default) defers to the per-type rule -- outward for lines, points and graphs, whose default footprints are a few screen pixels wide, and inward for everything else. Left as None rather than resolved at construction so a visual that never asked for a placement follows the rule if the rule changes.

required
Notes

Outlining requires pick_write: the pass is a screen-space post-process and the pick buffer is the only per-pixel identity channel it has. Setting a nonzero slot on a visual with pick_write = False turns picking back on and warns.

cellier.visuals.VisualType module-attribute

Any visual model, told apart by its visual_type field.

The type of Scene.visuals entries; a saved viewer file uses it to rebuild each visual as the right class.