Add vtkSurfaceNetsAtlas
vtkSurfaceNetsAtlas is a new filter which consumes the polygonal output of any SurfaceNets filter
(vtkSurfaceNets2D, vtkSurfaceNets3D, or vtkGeneralizedSurfaceNets3D) and exposes it as a
queryable label atlas.
The atlas is built once per input mesh change (gated on the input vtkPolyData MTime) and then
reused for subsequent queries without re-running surface extraction. This makes iterative workflows
(e.g. interactively toggling label visibility in a viewer) inexpensive.
Key capabilities:
- Produces a
vtkPartitionedDataSetCollectionorganized by avtkDataAssemblyinto:Regions: one partitioned dataset per label.Patches(optional): one partitioned dataset per adjacent label pair.
- Each output partition carries identifying arrays so downstream consumers can work without the
assembly. The scalar type of
"BoundaryLabels"matches the upstream filter's"BoundaryLabels"input array type.- Region cell data:
"BoundaryLabels"(2-component) — one tuple per cell; Label0 is always the region's own label so normals point outward."BoundaryLabels"is the active scalar. Also"Label"(vtkIdType, constant) and"LID"(int, constant) — same value for every cell, backed byvtkConstantArray(O(1) storage). - Region field data:
"AdjacentLabels"(vtkIdType[]),"PatchIDs"(int[]) — all neighbouring labels and their patch IDs. - Patch cell data:
"BoundaryLabels"(2-component) — Label0 < Label1 by label value (background is always Label1 when present)."BoundaryLabels"is the active scalar. Also"PatchID"(int, constant) — same value for every cell, backed byvtkConstantArray(O(1) storage). - Patch field data: none.
- PDC field data:
"LIDToLabel"(vtkIdType[]) — the full Label↔️ LID mapping;"PatchLIDs"(2-componentint) — maps each patch ID to its[LID0, LID1]pair;"PatchLabels"(2-componentvtkIdType) — maps each patch ID to its[Label0, Label1]pair. All three are always present regardless ofGeneratePatches.
- Region cell data:
- Supports query-driven extraction via:
ExtractionMode(EXTRACT_ALL/EXTRACT_LABEL_SET): extract all labels or a user-provided label set.OutputStyle+GeneratePatches: the defaults (Boundary+ on) produce an exact partition of the upstream SurfaceNets output — Regions carry background-facing cells, Patches carry interior label-to-label cells, and the total cell count equals the upstream output with no duplication. SettingOutputStyletoAllemits every cell for each Region regardless, causing interior-interface cells to appear in both adjacent Region partitions.
- Optional local post-processing to resolve non-manifold points (
ResolveNonManifoldPoints). When the input carries aNonManifoldTableIndicespoint-data array (produced byvtkSurfaceNets3D), only points marked in that array are candidates; otherwise all points are scanned. The array is never present in output partitions. - Provides post-
Update()inspection APIs for label↔️ index mapping and topology queries (presence, adjacency, patch indexing, patch cell counts).
The following changes were made to support vtkSurfaceNetsAtlas:
-
vtkSurfaceNets3Ddeprecations:OUTPUT_STYLE_BOUNDARYandOUTPUT_STYLE_SELECTED, along with the associatedSelectedLabelsAPI, are deprecated in VTK 9.7 in favor of usingvtkSurfaceNetsAtlasdownstream. For backward compatibility, these code paths now delegate their filtering behavior to avtkSurfaceNetsAtlasinstance internally and merge the per-label partitions back into a singlevtkPolyDatausingvtkAppendPolyData. -
vtkGeneralizedSurfaceNets3Ddispatch: now dispatches over the concrete scalar type of the region-ids input array (viavtkArrayDispatch) instead of requiringvtkIntArrayor silently converting to one. Any integer array type (vtkShortArray,vtkIntArray,vtkLongArray, etc.) is handled natively without a copy. -
Consistent
"BoundaryLabels"convention:vtkSurfaceNets2DandvtkGeneralizedSurfaceNets3Dwere updated to name the boundary-label cell-data array"BoundaryLabels"and to use a consistent 2-tuple ordering (background label last; smaller label first when both are non-background), matching the convention ofvtkSurfaceNets3D.vtkGeneralizedSurfaceNets3Dalso reverses polygon winding together with the label swap to preserve outward-facing normals. These changes are required forvtkSurfaceNetsAtlasto work correctly with their output.