Summary
Add a plot_surface function to confusius.plotting that displays a triangular
mesh as a napari Surface
layer.
Motivation
[Atlas.get_mesh][confusius.atlas.Atlas.get_mesh] already returns a region's mesh
as (vertices, faces) in the atlas physical space (millimetres), but there is
currently no way to display it in the napari viewer. This is particularly useful
for overlaying the surface meshes bundled with BrainGlobe atlases on top of the
reference template or a registered fUSI volume — e.g. to visually check a
registration or to show a region of interest in 3D.
Proposed API
import confusius as cf
from confusius.atlas import Atlas
atlas = Atlas.from_brainglobe("allen_mouse_25um")
# Reference template as an image layer, region mesh overlaid as a surface.
viewer, _ = cf.plotting.plot_napari(atlas.reference)
cf.plotting.plot_surface(atlas.get_mesh("VISp"), viewer=viewer)
- Accepts a
(vertices, faces) mesh tuple (matching Atlas.get_mesh's return).
- Optional per-vertex
values for colormapped shading (defaults to a flat surface).
- Optional
viewer to overlay on an existing viewer, consistent with
[plot_napari][confusius.plotting.plot_napari].
- Returns
(viewer, layer) like the other napari helpers.
Because get_mesh returns vertices already in the atlas physical space and image
layers are placed at their physical origin/spacing, the surface aligns with the
image layers without extra scaling.
Summary
Add a
plot_surfacefunction toconfusius.plottingthat displays a triangularmesh as a napari
Surfacelayer.
Motivation
[
Atlas.get_mesh][confusius.atlas.Atlas.get_mesh] already returns a region's meshas
(vertices, faces)in the atlas physical space (millimetres), but there iscurrently no way to display it in the napari viewer. This is particularly useful
for overlaying the surface meshes bundled with BrainGlobe atlases on top of the
reference template or a registered fUSI volume — e.g. to visually check a
registration or to show a region of interest in 3D.
Proposed API
(vertices, faces)mesh tuple (matchingAtlas.get_mesh's return).valuesfor colormapped shading (defaults to a flat surface).viewerto overlay on an existing viewer, consistent with[
plot_napari][confusius.plotting.plot_napari].(viewer, layer)like the other napari helpers.Because
get_meshreturns vertices already in the atlas physical space and imagelayers are placed at their physical origin/spacing, the surface aligns with the
image layers without extra scaling.