Skip to content

volume_grid: the Contours tab, contours per object, trace and tile (P10) - #1451

Merged
transfix merged 10 commits into
masterfrom
p10/volume-grid-contours
Nov 22, 2026
Merged

transfix merged 10 commits into
masterfrom
p10/volume-grid-contours

Conversation

@transfix

@transfix transfix commented Nov 22, 2026 •

Copy link
Copy Markdown
Owner

P10 of the VolumeRover library ports (docs/roadmap/VOLROVER-LIBRARY-PORTS-ROADMAP.md §4, §7): volume_grid v3, the contours tab. Curves drawn per object on the grid's planes, linear or spline, exported, and tiled by the contour tiler into a surface per object in the 3D view. Built on P8 (#1400, #1401, #1423) and P3b/P4 (the tiler's stepper, contour_lab).

What it adds

Core (inc/cvc/volume/volume_grid_contours.h, no GL)

  • cvc::grid_contours: the legacy SurfRecon model. Objects have a name, colour, linear or spline, and samples. Each holds curves, each on one plane (axis, slice index, control points in the plane's object coordinates, open or closed). The grid's frame (dims, origin, spacing) comes with them.
  • sample_grid_curve: a centripetal Catmull-Rom, periodic on a closed curve, so no GSL.
  • grid_contour_editor and grid_contour_gestures. A click adds a point at the end being drawn, else at the nearer end of the object's open curve on that plane. A click on the curve's other end closes it. A drag moves a point. A rubber band selects. Delete and undo work as in P8.
  • The object rows a list: binds.
  • Contour stacks per plane orientation, both ways.
  • JSON, and an optional contours in the volume_grid session.
  • trace_slice: VolumeGridRover's isocontouring (marching squares, simplified to half a voxel).
  • tile_grid_contours, grid_tile_stepper and the job. Each orientation's closed curves are tiled by tile_stepper in units of the frame's smallest spacing, so the tiler's absolute tolerances hold for any volume. The XZ and ZY winding is turned back, so every surface faces out.

DSL (grid-contours.*)

  • tile with -async and -start; info; stack; from-stack; add-curve; the parameter tables.
  • register_cvcgl_extensions installs them for documents.

pycvc

  • pycvc_volume_grid_contours.i, plus tile_grid_contours_job in pycvc_jobs.i.

The node (cvc::gl::VolumeGridContours, owned by VolumeGridNode; P8's files get a member and short hooks)

  • The contours tool.
  • Keys:
    • grid.objects (rows) and grid.objects.current;
    • grid.contour.*, whose source is followed;
    • grid.tile.*: tile_params plus the tile job's keys. These sit under tile, not grid.busy, so a tile and P9's segmentation each have their own progress.
  • Requests: tile, stop_tile, close_curve, new_curve, delete_curve, clear_object, trace <iso> [first last [step]]. Under the contours tool, delete_selected, select_all, select_none and undo act on the contours.
  • Data channel:
    • grid.curves: every curve as drawn;
    • grid.contours: the z planes' stack, which contour_lab's source: { node } follows;
    • grid.contours.xz and grid.contours.zy;
    • grid.surfaces.<object>.
  • Overlays on each plane: curves, control points, and rings. In the surfaces group: every plane's curves and the tiled surfaces.
  • Props: objects:, contours:, contour:, tile:.
  • Ariadne's data layer gains a contours decoder and encoder (.cvcc, .contour, .pcd out; any contour format in).

The component and documents

  • The Contours tab (volume_grid_contours_tab).
  • Demo examples/ariadne/documents/volume_grid_contours.ari: traces the bunny's 64^3 field on every third plane and tiles it. Gallery entry volume_grid_contours_ari.
  • Golden src/cvcGL/test/golden/volume_grid_contours.ari.
  • arigl-web smoke case volume_grid_contours.ari: it traces, tiles, then draws and closes a curve with scripted picks.

Tested locally (Windows, MSVC Release)

  • volume_grid_contours_test 33/33 and volume_grid_contour_intrinsics_test 7/7. Both also pass under wasm-mt node with cvc::planar, where the slowest tile step was 2.3 ms at budget 4096.
  • cvcgl_volume_grid_contours 58/58.
  • P8's tests still pass: volume_grid_test 21, cvcgl_volume_grid 79, cvcgl_ariadne_volume_grid 17.
  • cvcgl_contour_lab 58, with a check that a followed stack written 20 times, a tick apart and with no sleep, loads every time (it failed before the fix below).
  • ariadne_loader_test 252 and ariadne_data_test 17.
  • test_pycvc_volume_grid_contours.py, plus pycvc's volume_grid, tiler, jobs, contours, params and volume_slice tests.
  • The smoke document natively with arigl snapshot. It prints the line the browser case waits for: volume_grid_contours: 32 32 32, tiled 1 object: 500 triangles, closed a curve of drawn on z = 16 (3 points).

Not verified here

  • Linux, macOS, headless Chrome.

The goldens

  • volume_grid_contours.png is new.
  • P8's volume_grid.png and volume_grid_quad.png change only where the panel gains the Contours tool and tab.
  • All three are the actual frames from this PR's first CI run (cf67ebb), from the package-windows ari-golden artifact. That is Windows' llvmpipe, which docs/ARIADNE.md measures within 1 of the Linux llvmpipe goldens. On f20a4dd, Linux's llvmpipe matched all three. The largest channel differences were 22, 1 and 1, with no pixel beyond 40.

Found

  • The ported tiler's untiled-region fill gives up on a regular polygon stacked on its own copy (medial_axis_stable: Failed to propagate z_home), which leaves the surface open there. This is a P3b follow-up and is not fixed here.
  • cvcgl_ariadne_volume_grid loaded documents without the 8 MB host stack the other document tests have. The tab's extra nesting level overflowed Windows' 1 MB stack. It now uses the 8 MB stack, as do cvcgl_volume_grid and cvcgl_volume_grid_contours.
  • In the grid's 3D viewport, surfaces lit by the main view's lights read black from behind, so the tiles carry ambient 0.3.
  • contour_lab (P4) noticed new contours at a source: { node } or { state } only by the key's lastMod. On Windows, boost's clock ticks with the system timer (15.6 ms on CI's VMs), so two writes close together shared a stamp, and the lab never loaded the second. cvcgl_volume_grid_contours hit this on Windows CI. The lab now also keeps what held the stack it loaded and loads again when the key holds another (ecf00f1). P8's node and VolumeGridContours already compared the payload as well as the stamp.

The arigl-web contours case (125a8ea)

  • On f20a4dd the page ran, but the case's line never came within the harness's 15 s. Natively the document prints it within 20 frames.
  • The document wrote the trace request in init:, which may run before the node is up. It now asks from on_tick once the grid has the volume, as volume_grid.ari's case does.
  • It prints a vgc: progress line (step, dims, tile status, triangles, node status) whenever one changes. A failing run reports those lines and the page's warnings.

Master merged in again (2b5cb84): D1 (#1446)

  • The conflicts were both sides adding: the extensions' includes and their comment, port tests, cvcGL tests, and a test each in ariadne_loader_test. All kept.
  • D1's cvcgl_ariadne_shared_volume overflowed Windows' 1 MB stack here (0xC00000FD). Its document includes volume_grid, and the Contours tab is one level deeper, so it joins the 8 MB document host stack.
  • VolumeGridContours follows grid.contour.source with D1's cvc::followed_key instead of its own copy of that logic (3fbd933).
  • After the merge, these pass locally: cvcgl_volume_grid_contours 58, cvcgl_volume_grid 79, cvcgl_ariadne_volume_grid 17, cvcgl_shared_volume 29, cvcgl_ariadne_shared_volume 7, cvcgl_contour_lab 58, ariadne_loader_test 253, volume_grid_test 21, volume_grid_contours_test 33 and volume_grid_contour_intrinsics_test 7.

Master merged in (3df9651)

Overlaps:

VolumeGridRover's contours (docs/roadmap/VOLROVER-LIBRARY-PORTS-ROADMAP.md §4, P10): curves
drawn per object on the grid's planes, linear or spline, exported as contour stacks, and tiled by
the contour tiler into a surface per object in the 3D view.

Core (cvc/volume/volume_grid_contours.h, no GL):
- grid_contours: objects (name, colour, linear | spline, samples) holding curves on one plane
  each (axis, slice, control points, open or closed), on the grid's frame;
- sample_grid_curve (centripetal Catmull-Rom), grid_contour_editor (add at the active or the
  nearer end, close, open, move, select, delete, undo), grid_contour_gestures (picks to edits),
  the object rows, stacks both ways, JSON (and the session's optional contours), trace_slice
  (VolumeGridRover's isocontouring);
- tile_grid_contours, grid_tile_stepper and the job: each orientation's closed curves tiled by
  tile_stepper in voxel units, mapped back with the XZ/ZY winding turned so surfaces face out.
DSL: grid-contours.tile (-async, -start), .info, .stack, .from-stack, .add-curve; installed by
register_cvcgl_extensions. pycvc: pycvc_volume_grid_contours.i and tile_grid_contours_job.

Node and component:
- VolumeGridContours, owned by VolumeGridNode: the contours tool; grid.objects, grid.contour.*,
  grid.tile.* (the tile job's keys under tile, beside the segmentation's); requests tile,
  stop_tile, close_curve, new_curve, delete_curve, clear_object, trace; data grid.curves,
  grid.contours (+ .xz, .zy), grid.surfaces.<object>; overlays per plane and the 3D view's curves
  and surfaces; props objects:, contours:, contour:, tile:;
- Ariadne data: the contours decoder and encoder;
- volume_grid.ari: the Contours tab (volume_grid_contours_tab);
- demo volume_grid_contours.ari, golden volume_grid_contours.ari (PNG to follow from CI),
  arigl-web case volume_grid_contours.ari.

Tests: volume_grid_contours_test (33) and volume_grid_contour_intrinsics_test (7), native and
wasm-mt under node, in the sanitizer lanes; cvcgl_volume_grid_contours (58); loader and data
cases; test_pycvc_volume_grid_contours.py. cvcgl_ariadne_volume_grid and the other grid tests
get the 8 MB document-host stack.
contour_lab noticed new contours at a node or state source only by the
key's lastMod. boost's microsec_clock on Windows has the system timer's
resolution (15.6 ms on CI's VMs), so two writes close together share a
stamp and the second was never loaded. cvcgl_volume_grid_contours hit
it on Windows CI: the lab stayed one stack behind the grid's contours.

The lab now also keeps what held the stack it loaded (the shared
pointer, or the data object it came in) and loads again when the key
holds another. Keeping it means its address isn't reused. A stack held
by value is still told by lastMod alone.

cvcgl_contour_lab writes a followed stack 20 times with a tick between
and no sleep, and checks each write loads. It failed locally before
the change.
volume_grid_contours.png is new. volume_grid.png and volume_grid_quad.png
change only where the panel gains the Contours tool and tab.

They are the actual frames from #1451's CI run on cf67ebb, in the
package-windows ari-golden artifact, rendered by Windows' llvmpipe
(mesa-dist-win), which docs/ARIADNE.md measures within 1 of the Linux
llvmpipe goldens. The Linux jobs compare them on the next run.
…nd says where it stops

The case failed in headless Chrome: the page ran, but the line it waits
for never came within the 15 s the harness allows. Natively the same
document prints it within 20 frames.

The document wrote the node's trace request in init:, which may run
before the node is up, so the case depended on that order. It now asks
once the grid has the volume, as volume_grid.ari's case acts only once
the dims are there.

It also prints a `vgc:` line whenever the step, the dims, the tile's
status, bunny's triangle count or the node's status changes. A failing
run of the case reports those lines and the page's warnings.
…tours

Master gained #1446 (D1: volren and volume_slice view a volume on the
state tree). The conflicts were both sides adding: the extensions'
includes and their comment, the port tests, the cvcGL tests, and a test
each in ariadne_loader_test. All kept.

cvcgl_ariadne_shared_volume (D1's) joins the 8 MB document host stack:
its document includes volume_grid, whose Contours tab is one level
deeper, and it overflowed Windows' 1 MB stack (0xC00000FD) here.
D1 (#1446) put the key-following the volume_grid node did by hand into
cvc::followed_key (path through links, node, lastMod, payload type and
pointee). The contours helper had its own copy of the same logic; it
now uses the shared one, with its payload_id (data objects, and
grid_contours or contour_stack pointers) as the pointee.
@transfix
transfix merged commit 1603cd1 into master Nov 22, 2026
31 checks passed
@transfix
transfix deleted the p10/volume-grid-contours branch November 22, 2026 21:08
transfix added a commit that referenced this pull request Nov 22, 2026
volume_grid_quad.png takes master's for now: the image with both the Contours
tab and the Source combo comes from this PR's CI render.
transfix added a commit that referenced this pull request Nov 22, 2026
Both tabs kept: the Contours tab and the Segmentation tab share the node,
its CMake lists, docs and the sanitizer list. `stop` now ends every job the
grid runs (a tile and a segmentation alike), and says "nothing to stop" only
when neither ran; cvcgl_volume_grid_segment checks one stop ending both.
volume_grid.png and volume_grid_quad.png are master's for now: the tab bar
changed on both sides, so they come next from this branch's CI render.
transfix added a commit that referenced this pull request Nov 23, 2026
…lumes the grid shows (#1443)

The volume_grid component's Probe tab now has a Source combo that picks which of the app's volumes the grid shows.

- VolumeGridNode publishes grid.volumes: each output of the document's data: entries that holds a volume (data.<name>.<output>), then the key grid.source.volume names when it isn't one of them. It is empty while that key names nothing, and rebuilt only when the source key or an entry changes.
- The Probe tab's Source is a combo over grid.volumes that writes grid.source.volume; the read-only text shows while the list is empty.
- The volume_grid demo loads a coarser bunny (24^3) beside the 64^3 one.
- volume_grid_quad.png is CI's llvmpipe render with the combo and P10's Contours tab (#1451).
- Merged with D1 (#1446): holds_volume uses cvc::volume_payload_pointee.
- Docs: ARIADNE.md's volume_grid keys, the component header, and the roadmap's P8 "Which volume" bullet.

Tests: cvcgl_volume_grid (85), cvcgl_volume_grid_contours (58), ariadne_loader_test's VolumeGridDrivesItsNodesKeys combo checks, cvcgl_ariadne_volume_grid (17), cvcgl_shared_volume (29), volume_grid_test (21).
transfix added a commit that referenced this pull request Nov 23, 2026
…w keeps its side panel (P9)

With five tabs (Segmentation beside #1451's Contours), volume_grid's side
panel went below its views once its Contours page grew taller than the
window: the vertical scroll bar left 358 px, less than the tabs' least width
(372), so ImGui scrolled them, and the tabs scrolled out of the bar still
counted as the line's width. #1450's flowing row saw the panel run past its
room and moved it to the next line for good. ImGui also spans the bar to the
window's work rect, under the scroll bar (its arrows hidden there), and as
wide as last frame's content in a window that scrolls sideways, which kept
that content too wide frame after frame (a spurious horizontal scroll bar
in volume_grid_segment, the clipped last tab in the earlier goldens).

tab_bar now lays the bar out in the visible room and does not count the
tabs scrolled out of it. 57 ImGui and Ariadne tests pass locally; the
golden harness keeps the panel beside the views.
transfix added a commit that referenced this pull request Nov 24, 2026
…es in 3D (P9) (#1452)

* volume_grid segmentation core: class_surfaces and the tab's stepper (P9)

cvc::class_surfaces: the surface of every class of a label volume in one
marching-cubes pass (midpoint vertices shared within a class, closed at the
volume's faces), Taubin smoothing and outward normals, as a resumable
stepper with its job and a parameter table.

cvc::volume_grid_segment_stepper: segment_stepper, then class_surfaces on
its labels, as one stepper with one progress bar and one Stop, keeping the
labels so far for the slices while it marches
(segment_stepper::labels_so_far). The Segmentation tab's view table, its
rows (coloured as the seeding point classes), color_labels for the slice
layer, and grid.segment.* in grid sessions.

Tests: class_surfaces_test, volume_grid_segment_test (ports lane).

* volume_grid: the Segmentation tab (segment, labels on the slices, class surfaces) (P9)

VolumeGridSegmentation, owned by VolumeGridNode: grid.request `segment`
runs volume_grid_segment_stepper on the grid's volume, seeded by its shown
point classes, as a sliced task (the §1.9 job keys under grid.*); `stop`
keeps the last result; a new volume clears it. The labels draw on each
plane as a see-through `labels` layer (live while the fronts advance), and
each class's surface in a `segments` group under the grid's surfaces. The
result is on the data channel (grid.segment.labels, classes, border,
surfaces.<n>), its classes as rows under grid.segment.rows; parameters
from the seeded_segmentation, view and class_surface tables, seeded from a
document's segment: props.

Component volume_grid_segmentation.ari, the volume_grid component's
Segmentation tab. Ariadne's volume encoder writes a list of volumes as one
file's variables (Save classes: VolumeGridRover's SegTmp.rawv).
register_cvcgl_extensions installs the segmentation intrinsics per app;
segment.surfaces (class_surfaces) joins segment.seeded.

Test: cvcgl_volume_grid_segment (and its cooperative run).

* volume_grid segmentation: pycvc, segment.surfaces tests, demo, golden, web smoke (P9)

pycvc: class_surfaces (keywords, its result, its job), the tab's rows and
colour layer, its view table, and volume_grid_segment_job (the tab's run as
one job); test_pycvc_volume_grid_segment.py.

segmentation_intrinsics_test covers segment.surfaces in its three forms;
ariadne_data_test the volume encoder's list of volumes (one .rawv,
variables named after the volumes).

Demo examples/ariadne/documents/volume_grid_segment.ari: VolRover's Visible
Human CT (examples/data/fem/vh4.rawiv) with a seed on the spine and in each
arm, segmented above 72 on open, the classes' surfaces in a Bones view; in
the gallery as volume_grid_segment_ari. Golden volume_grid_segment.ari (its
PNG follows from CI's llvmpipe render), arigl-web smoke case
volume_grid_segment.ari (a pick, then segment on the page).

The Segmentation tab: volume_grid_segmentation (a window) and
volume_grid_segmentation_tab (the controls), included with tab: so the tab
adds no nesting level. cvcgl_ariadne_volume_grid gets the 8 MB document
host stack (it overflowed Windows' 1 MB on the deeper component).

Ariadne's color widget takes fmt: hex (one #rrggbb field beside the
swatch, Backend::color_hex); the volume_grid class tables use it.

ci.yml: class_surfaces_test and volume_grid_segment_test join
SAN_CXX_TESTS. Docs: ARIADNE.md (the grid's segmentation keys, the
encoder, the components), the roadmap's "What P9 built".

* volume_grid segmentation: goldens from CI's llvmpipe artifact; the stop check no longer races a fast cooperative run (P9)

- src/cvcGL/test/golden: volume_grid_segment.png (new), volume_grid.png and volume_grid_quad.png
  (the Segmentation tab, the Point classes table's hex colour fields), from run 44992251035's
  ari-golden-Linux-libcvc-release artifact at 6e568ef.
- cvcgl_volume_grid_segment: on the Linux package runners a cooperative 24^3 run ended within the
  frame after `segment`, before `stop` reached it ("stop ends the run" failed). Between `segment`
  and the next request the test now ticks the nodes without stepping the scheduler, so a
  cooperative run has not begun when `stop` (or a second `segment`) comes.

* volume_grid_segment golden: the default headlight, not the three_point rig (P9)

On CI's package-linux lanes the golden's surface views (live mirrors of the main view) were lit by
the document's three_point rig in the Release build and by the default headlight in the Debug one,
so volume_grid_segment.png (from the Release artifact) failed on libcvc-debug: 1.17% of pixels,
all on the surfaces. Rendered locally in Release without the rig, the surfaces look as the Debug
lane drew them. The golden now declares no lights; its PNG follows from this run's artifact.

* volume_grid_segment golden: the headlight-lit image from CI (P9)

Taken from run 45042979740's ari-golden-Linux-libcvc-release artifact at
1084dfd, the first run of the golden without the three_point rig.

* extensions.cpp: one space before the segmentation include's comment (clang-format, P9)

* goldens: volume_grid, _quad, _segment and _contours from this PR's CI render (P9)

The tab bar now holds both Contours and Segmentation, and the class
colours show as hex. Taken from run 45078206762's ari-golden-Windows-libcvc-release
artifact; every other document there matched its Linux-made golden within 1.

* goldens: volume_grid_quad from this PR's CI render after the master merge (P9)

The merged panel: the Probe tab's Source combo (#1443) under the five-tab
bar. From run 45106838969's ari-golden-Linux-libcvc-release artifact; the
Windows render of the same run agrees (no pixel beyond 8).

* ImGuiBackend: a tab bar fits the line's visible room, so a flowing row keeps its side panel (P9)

With five tabs (Segmentation beside #1451's Contours), volume_grid's side
panel went below its views once its Contours page grew taller than the
window: the vertical scroll bar left 358 px, less than the tabs' least width
(372), so ImGui scrolled them, and the tabs scrolled out of the bar still
counted as the line's width. #1450's flowing row saw the panel run past its
room and moved it to the next line for good. ImGui also spans the bar to the
window's work rect, under the scroll bar (its arrows hidden there), and as
wide as last frame's content in a window that scrolls sideways, which kept
that content too wide frame after frame (a spurious horizontal scroll bar
in volume_grid_segment, the clipped last tab in the earlier goldens).

tab_bar now lays the bar out in the visible room and does not count the
tabs scrolled out of it. 57 ImGui and Ariadne tests pass locally; the
golden harness keeps the panel beside the views.

* goldens: volume_grid_contours, _segment and _quad from this PR's CI render after the tab-bar fix (P9)

The Contours panel stays beside the views, its tabs scrolled behind arrows in
the visible room; the segment window lost its spurious horizontal scroll bar
(one more row shows); quad's right edge moved a few pixels. From run
45274811851's ari-golden-Windows-libcvc-release artifact (Windows and Linux
renders have agreed within 8 on every earlier run).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant