Skip to content

vtkContourFilter (using vtkSynchronizedTemplates2D) uses Scalars instead of InputArrayToProcess

When contouring a 2D vtkImageData (i.e. extent is 1 in one dimension), at some point a Scalars array is expected in input instead of using the array returned by GetInputArrayToProcess. This occurs in vtkSynchronizedTemplates2D

In the best case, this produces the correct output while printing the following error:

ERR| vtkImageData (0x556778761410): No Scalar Field has been specified - assuming 1 component!

But if Scalars is an array with a different number of component, this leads to a wrong output.

Reproducer

I have a ParaView statefile : wrong_contour.pvsm

This creates the following pipeline:

  • FastUniformGrid, WholeExtent [0, 0, -10, 10, -10, 10]: produces a 2D vtkImageData with some point data arrays
  • ProgrammableFilter: a python code to set a 3-components array as point data Scalars
  • Contour, on DistanceSquared (a 1 component point data array)

wrong_contour