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. |
required |
composite
|
bool
|
Assign it through |
required |
channels
|
dict[int, channel appearance]
|
Per-channel appearances, keyed by index along Every channel has the same |
required |
max_channels
|
int
|
The most channels |
required |
render_planes
|
tuple[RenderPlane, ...]
|
The planes the visual draws its data on in a 3D view while its
render mode is |
required |
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 |
__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}. 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.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 |
slab_projection
|
str
|
In a 2D view, reduce the slab the scene's thickness selects instead
of drawing one plane: |
required |
projection_axes
|
tuple[str, ...]
|
The world axis to project along, by name, e.g. |
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 |
required |
clim
|
tuple[float, float]
|
Contrast limits |
required |
opacity
|
float
|
Opacity in |
required |
iso_threshold
|
float
|
Isosurface threshold for the iso render modes. |
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 |
render_config
|
InMemoryImageRenderConfig
|
The brick route's GPU 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}. 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.
Hidden, or in composite mode with no drawn channel.
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 |
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: |
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 |
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:
-
block_size(int) -
gpu_budget_bytes(int) -
loading(ProgressiveLoadingConfig)
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}. 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.
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, while its clipping planes are
dragged ( |
required |
coarsest_while_moving_2d
|
bool
|
The same, for a 2D view: each tick of a dims scrub, of a transform
drag (inside |
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
|
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: 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 |
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: 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 |
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 |
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 |
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 |
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). |
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 |
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 |
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 |
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__ ¶
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 ¶
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 ¶
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
|
Returns:
| Type | Description |
|---|---|
tuple[int, ...]
|
The drawn indices. |
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: |
required |
target_bricks
|
str
|
Which target bricks a 3D view loads. |
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 |
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; |
required |
surface_projection
|
str
|
3D only: |
required |
surface_placement
|
str
|
Where the thickness lies relative to the surface, in 2D and 3D:
|
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.
|
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
|
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:
-
block_size(int) -
gpu_budget_bytes_2d(int) -
loading(ProgressiveLoadingConfig) -
gpu_budget_bytes(int) -
value_gpu_budget_bytes(int)
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__ ¶
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.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
|
str
|
3D rendering mode.
|
required |
smooth_geometry_level
|
float
|
Where the |
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 |
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:
-
block_size(int) -
gpu_budget_bytes(int) -
loading(ProgressiveLoadingConfig)
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__ ¶
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
|
The modes of |
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 ( |
required |
coarsest_while_moving_2d
|
bool
|
The same, for a 2D view: each tick of a dims scrub, of a transform
drag (inside |
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
|
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) -
paint_max_tiles(int) -
loading(ProgressiveLoadingConfig)
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 colour of every point 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 colour of every vertex 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 |
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__ ¶
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.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 |
required |
node_size
|
float
|
Uniform node size, in |
required |
node_size_space
|
str
|
|
required |
node_color_mode
|
str
|
Declares where node RGB comes from: |
required |
node_size_mode
|
str
|
Declares where the node size comes from, on the same terms as
|
required |
node_visible
|
bool
|
Show the node sub-visual. Nests under |
required |
node_pick_write
|
bool
|
Write nodes into the pick buffer. |
required |
node_depth_compare
|
str
|
Defaults to |
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 |
required |
edge_thickness_space
|
str
|
|
required |
edge_color_mode
|
str
|
As |
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 |
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 |
required |
fade_before
|
float | None
|
Falloff distance below the position, in world units. |
required |
fade_after
|
float | None
|
Falloff distance above the position, in world units. 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 |
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: 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"
|
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')]
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 |
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¶
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 |
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 |
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: 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 |
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.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 |
required |
name
|
str
|
Human-readable label. Default |
required |
font_size_px
|
float
|
Text size in screen pixels. Default |
required |
color
|
tuple[float, float, float, float]
|
RGBA text colour. Default amber |
required |
corner_offset_px
|
tuple[float, float]
|
|
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 ¶
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 |
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 |
required |
thickness
|
float
|
Line thickness in screen pixels. Default |
required |
render_order
|
int
|
pygfx render order. Default |
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 |
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: 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 |
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. |
cellier.visuals.MAX_RENDER_PLANES
module-attribute
¶
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 |
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: 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 |
required |
line_width
|
float
|
Line thickness in screen pixels. Default |
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
|
|
required |
placement
|
str or None
|
|
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
¶
VisualType = Annotated[Union[MultiscaleImageVisual, MaskedImageVisual, ImageVisual, LabelMemoryVisual, MultiscaleLabelVisual, PointsVisual, LinesVisual, MeshVisual, MultiscaleMeshVisual, GraphVisual], Field(discriminator='visual_type')]
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.