Skip to content

VTK algorithms keep the input's active attributes, and set their own - #348

Open
berkgeveci wants to merge 2 commits into
Kitware:mainfrom
berkgeveci:vis/vtk-active-attributes
Open

berkgeveci wants to merge 2 commits into
Kitware:mainfrom
berkgeveci:vis/vtk-active-attributes

Conversation

@berkgeveci

Copy link
Copy Markdown
Collaborator

Stacked on #343 (its commit shows here until it merges; this merges after it). Found by running VTK's own Python tests with Tack's algorithms in place of VTK's filters: about 1,500 outputs lacked an active attribute VTK's filter gives, and tests rendered white or lit wrongly (TestElevationFilter.py, clipHex.py).

The bug: Tack keeps no roles, so the arrays the algorithms carried came back as plain arrays. A mapper colors by the active scalars, a glyph turns by the active vectors, lighting reads the active normals: all found nothing. A tube took the lines' carried Normals (dataset_to_vtk makes an array of that name the active normals) and was lit with the cube's face normals.

The fix (_keep_active, after every run):

  • Each dataset of the output keeps its input's active scalars, vectors, normals, texture coordinates and tensors, on points and cells, where it carries an array of the name and has none in that role yet -- as VTK's filters pass them. Probe takes its source's (ACTIVE_FROM).
  • A filter's own array where VTK's makes it active, over a carried one (_made_active): Elevation and ImplicitValues their array as the scalars, SurfaceNormals, PointNormals and Tubes their normals as the normals.
  • Setting a role modifies the dataset, so its kept Tack dataset is kept valid (the arrays are the same).

Tested: elevation, contour, clip, threshold over pieces, probe, tubes over a cube's edges (carrying its Normals) and surface normals each give VTK's active attribute. VTK tests 223 passed on the 9.7.1 wheel and 238 on a local VTK master; quick tier 3046 passed.

🤖 Generated with Claude Code

The algorithms that add fields wrote Tack's values straight into VTK's point
data. On VTK's higher-order cells that put an order-2 field's values in Tack's
node order, not VTK's (Elevation scrambled, its Gradients wrong), and values on
Tack's points, the corners, where VTK's points include the edge middles (a
1193-point grid got an array of 1193 tuples of 1227 components). The import
now records which node of its space each VTK point is, and the writers put a
point field into that space (project) and give each VTK point its node's value.
Found running VTK's quadraticQuadDeriv.py on Tack.
Tack keeps no roles, so the arrays the algorithms carried came back plain: mappers
colored by nothing, glyphs and lighting found no vectors or normals. An output
now keeps its input's active scalars, vectors, normals, texture coordinates and
tensors where it carries arrays of those names (Probe its source's), as VTK's
filters pass them; Elevation and ImplicitValues make their array the active
scalars, SurfaceNormals, PointNormals and Tubes theirs the active normals (a
tube took the lines' carried Normals, and was lit wrongly). Found running VTK's
Python tests on Tack.

This branch has not been deployed

No deployments
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