Skip to content

contour_lab: the contour tiler in Ariadne, with a demo on a real Reconstruct series (P4) - #1397

Merged
transfix merged 7 commits into
masterfrom
p4/contour-lab
Nov 21, 2026
Merged

transfix merged 7 commits into
masterfrom
p4/contour-lab

Conversation

@transfix

Copy link
Copy Markdown
Owner

Phase P4 of docs/roadmap/VOLROVER-LIBRARY-PORTS-ROADMAP.md (§3's Ariadne part, §7's P4 row). It puts the contour tiler (cvc::tile_contours, ported in P3b) into Ariadne as a scene node, with a component that drives it, and a demo on a small Reconstruct series that may be redistributed. The demo runs natively and in arigl-web.

The node: contour_lab

Declared in inc/cvc/gl/ariadne/contour_lab_nodes.h; register_cvcgl_extensions registers it.

  • Sources. It reads one of:

    • a contour file, source: { file }, in any contour format;
    • another node's contour_stack, source: { node }, from that node's tiler.contours or grid.contours data key;
    • a stack on a state key's data channel, source: { state }.

    It follows a node or state source and loads again when that source changes.

  • Contours. Each component's contours are drawn as polylines under <id>_contours (tag contours).

  • Tiling. tiler.request = "tile" runs tile_stepper as a sliced task on the app's scheduler.

    • The surfaces go under <id>_tiles (tag tiles).
    • On the data channel, each surface is at <node>.tiler.surfaces.<component> and the stack at <node>.tiler.contours.
    • stop ends the tile at its next step. The node keeps whatever surfaces it had.
  • Keys under <node>.tiler:

    • tile_params, and read.* (contour_read_params), seeded from their parameter tables with their unit, range and doc properties;
    • one row per component: name, colour, visible, and tile (unticked means left out of the next tile);
    • view.*, info.* and warnings;
    • §1.9's job keys. The phase names the slice pair being tiled, for example tiling slices 3 - 4 42%.

The component: contour_tiler.ari

  • A component picker: a tile tick, a show tick and a colour for each component.
  • The slice range and the tiler's parameters.
  • Tile, Stop and Load buttons.
  • A progress bar labelled with the slice pair being tiled.

Its INDEX.ari entry is in this PR rather than P11, because ariadne_loader_test fails on any shipped component that INDEX.ari doesn't list.

The data: Kuwajima 2019, CC0

examples/data/contours/kuwajima2019 (216 KB) is a subset of a real tSEM series from mouse CA1:

  • the axons ax006 and ax010, traced through 72 sections;
  • ax008, which branches;
  • two mitochondria inside ax010.

Source and licence:

  • Dataset: Kuwajima M (2019), Texas Data Repository, doi:10.18738/T8/QP43LB.
  • Licence: the repository record gives it as CC0 1.0, and its description names the corral folder these trace files came from.
  • Paper: PLoS ONE 15(1): e0226797.
  • Citation: the folder's README gives the full citation and says what was kept, and THIRD_PARTY_NOTICES.md cites it.

Only the trace files were downloaded, no images. Other candidates I looked at and ruled out:

  • the 2015 Sci Data series: its traces are no longer online;
  • Reconstruct's own samples: GPL-2;
  • the SynapseWeb 1989 zips: no licence stated.

The demo

examples/ariadne/documents/contour_tiler.ari tiles all five objects. In a native Release build that comes to 20,282 triangles with no warnings. It is in the gallery as contour_tiler_ari, with a thumbnail.

Other changes

  • Loader: source: { node } now reaches a custom node type's props, as { state } and { stream } already do.
  • RealizedScene::pending_work: custom nodes report work in flight. cvcgl_ari_golden steps until none is busy before it captures. A document with no such node takes no extra frames.
  • Golden: src/cvcGL/test/golden/contour_tiler.ari (sections 14 to 33 of ax010 and its mitochondria). The PNG has to come from CI's llvmpipe run, as orthoslicer's did, so this PR's first run fails that comparison. The PNG follows in a second commit.
  • arigl-web:
    • The docset's contour_tiler.ari is served at /apps/tiler/. Its page config preloads the series from /apps/data/, which arigl_web_smoke.mjs now maps to the repository's examples/data.
    • The document prints one line once its three surfaces are up, and the smoke test waits for that line. Like the orthoslicer case, it runs on arigl-web only.
  • wasm builds: the browser builds now have cvc::planar, and so the tiler.
    • The arigl-web and libcvc-examples-web recipes take clipper2, cdt and shewchuk-predicates, with cvc_revision 2. All three are on the catalog for wasm and wasm-mt.
    • The gallery builds in deploy-pages and publish-cvcgl-wasm install the same three. In publish-cvcgl-wasm they are installed after the wasm-mt SDK is built, so the published SDK does not change.

Tests

cvcgl_contour_lab (headless, 57 checks):

  • rows, keys and their properties;
  • polylines and tags;
  • a tile equal to tile_contours on the same stack;
  • untick, stop, and colour, visibility and opacity;
  • node and state sources;
  • bad input;
  • the pending-work probe;
  • two apps tiling at once;
  • a cooperative-mode run (CVC_SLICED_THREADING=cooperative, as single-threaded wasm runs) that spans many frames.

Checked locally

On Windows, MSVC Release, with cvc::planar:

Check Result
cvcgl_contour_lab 57/57
ariadne_loader_test 242 passed, 2 skipped (shipped components, with the INDEX entry)
cvcgl_ariadne_realize passed
cvcgl_volume_slice 54/54
cvcgl_ari_golden on the new document (local variant) loads with no warnings; the jobs finish 35 frames in; the frame settles
The demo and the golden document, in arigl snapshot rendered as intended
The smoke document in cooperative mode, natively prints contour_tiler: 3 surfaces, 4778 triangles
clang-format 18 on changed lines clean

On this machine's Intel Arc GPU the existing orthoslicer golden is 630 px off in its volren region. That document has no contour_lab, so this PR doesn't change its frames, and its reference image comes from llvmpipe.

Not checked locally:

  • Linux and macOS;
  • the wasm builds and headless Chrome (CI's arigl-web job covers them);
  • the deploy-pages and publish-cvcgl-wasm edits, which run only on deploys and tags.

Found: the tiler's first frames in cooperative mode

In cooperative mode, the first frames of a tile (the snapping, curating and augmenting phases) take 50 to 160 ms each in a native Release build. §1.9's slice is 4 ms. There are two causes, both in P3b's stepper rather than this node:

  • tile_stepper::step keeps going across a phase change, so a budget sized on snapping units (one vertex each) gets spent on curating units.
  • One curating or augmenting unit is a whole slice or slice pair, but the scheduler's smallest call is 16 units.

The tiling frames themselves stay near 4 ms. The roadmap's §3 records this; it is a follow-up for the stepper.

…nstruct series (P4)

Phase P4 of docs/roadmap/VOLROVER-LIBRARY-PORTS-ROADMAP.md (§3's Ariadne part, §7's P4 row):
the tiler P3b ported (cvc::tile_contours) as a scene node, a component that drives it, and a
demo on a small redistributable Reconstruct series, native and in arigl-web.

- contour_lab (inc/cvc/gl/ariadne/contour_lab_nodes.h, registered by register_cvcgl_extensions):
  reads a contour file (source: { file }, any contour format), another node's contour_stack
  (source: { node }, its tiler.contours or grid.contours data key) or a stack on a state key's
  data channel (source: { state }), and follows a node or state source when it changes. It draws
  each component's contours as polylines under <id>_contours (tag contours). request "tile" runs
  tile_stepper as a sliced task on the app's scheduler; the surfaces go under <id>_tiles (tag
  tiles) and on the data channel at <node>.tiler.surfaces.<component>, the stack at
  <node>.tiler.contours. Keys under <node>.tiler: tile_params and read.* (contour_read_params)
  from their tables, with their properties; a row per component (name, colour, visible, tile);
  view.*, info.*, warnings; and §1.9's job keys, the phase naming the slice pair being tiled
  ("tiling slices 3 - 4 42%"). Stop ends the tile at its next step and keeps what the node had.
- contour_tiler.ari: the component picker (tile / show / colour per component), the slice range,
  the parameters, Tile / Stop / Load, a progress bar labelled with the slice pair; its INDEX.ari
  entry, which ariadne_loader_test requires of every shipped component.
- The loader passes source: { node } through to a custom type's props, as { state } and
  { stream }.
- RealizedScene::pending_work: a custom node's work in flight. cvcgl_ari_golden steps until none
  is busy before the capture.
- The demo, examples/ariadne/documents/contour_tiler.ari, tiles the Kuwajima 2019 series (CC0,
  doi:10.18738/T8/QP43LB): two axons through 72 sections, a third that branches, and two
  mitochondria inside one of them (examples/data/contours/kuwajima2019, 216 KB; its README says
  where it came from and what was kept; THIRD_PARTY_NOTICES.md cites it). In the gallery as
  contour_tiler_ari.
- Golden: src/cvcGL/test/golden/contour_tiler.ari (sections 14 to 33 of the axon with its
  mitochondria). Its PNG comes from CI's llvmpipe run, as orthoslicer's did.
- arigl-web: the docset's contour_tiler.ari, served at /apps/tiler/ with a page config that
  preloads the series from /apps/data/ (the repository's examples/data); it prints one line once
  its three surfaces are up.
- wasm: arigl-web's and libcvc-examples-web's recipes take clipper2, cdt and shewchuk-predicates
  (cvc_revision 2), as do deploy-pages' and publish-cvcgl-wasm's gallery builds (the wasm-mt SDK
  itself unchanged), so the browser builds have cvc::planar and the tiler.
- Tests: cvcgl_contour_lab (57 checks): rows, keys and their properties, polylines, the tile
  equal to tile_contours, untick, stop, colour and visibility, node and state sources, bad input,
  the pending-work probe, two apps, and a cooperative run that spans many frames.

Found: in cooperative mode the tiler's first frames (snapping, curating, augmenting) take 50 to
160 ms each in a native Release build: tile_stepper::step runs on across a phase change, and a
curating or augmenting unit is a whole slice or pair. The roadmap's §3 records it; the fix is
P3b's stepper's, not this node's.
CI's first run drew the window 130 px tall, which hid the third component's row behind a
scrollbar. At 160 px all three rows show.
Taken from the ari-golden artifact of package-linux / libcvc-release at 1575da9. The
libcvc-release-grpc lane wrote the same bytes.
@transfix
transfix enabled auto-merge (squash) November 20, 2026 19:59
AFleetIsLaidOutInTeamsAtRallyPoints (FL1a, #1384) stepped 240 times and
asked for the fleet to be 5 m east. On OW1's 1/120 s quantum (#1378)
those steps are 2.0 s, not the 2.4 s it was written at, and the fleet
starting from rest is 4.36 m east by then. Neither PR's CI saw the
other, so master has failed it since OW1 merged.

It now steps 3 s of the clock (3 / kSimQuantum), about 9 m east.

(cherry picked from commit 1cf1081)
@transfix
transfix merged commit d9a4013 into master Nov 21, 2026
29 checks passed
@transfix
transfix deleted the p4/contour-lab branch November 21, 2026 04:12
transfix added a commit that referenced this pull request Nov 21, 2026
…eleton branch

P4 added RealizedScene::pending_work, a probe per custom node that is true while its work
is in flight, for the golden harness to wait on: the same thing as P2's
RealizedScene::settling. The merge keeps master's name and drops settling:

- scene_realize.h: one pending_work, its comment covering both (a contour_lab's tile, a
  mesh_lab's skeleton, a result not drawn yet).
- mesh_lab registers its probe on pending_work; cvcgl_mesh_skeleton reads it there.
- cvcgl_ari_golden: one loop. It steps until no probe has said busy for kMinFrames frames
  after the one it went idle on (P2's "until done, then kMinFrames more", with P4's restart
  when a probe goes busy again), under P2's 180 s ceiling. The skeleton golden gets the
  frames it was taken with; the contour tiler two more, after its scene has settled.
- arigl-web and libcvc-examples-web recipes: clipper2, cdt and shewchuk-predicates, with
  one comment saying the predicates serve the tiler (P4) and the skeleton (P2).
- demos.json and arigl_web_smoke.mjs: both demos and both page cases.
- ARIADNE.md, the roadmap and skeleton.ari name pending_work.
transfix added a commit that referenced this pull request Nov 21, 2026
…e, now that #1411 fixed it (#1419)

#1397 recorded the finding (50 to 160 ms cooperative frames on its demo
stack) and #1411 fixed it and recorded what it measured in §3's
Resumable paragraph. Whichever merged second was to replace the finding
with a pointer; #1411 merged second.
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