[vtkusers] Contours of multiple-component data

Christoph Sohrmann Christoph.Sohrmann at eas.iis.fraunhofer.de
Wed May 29 17:14:05 EDT 2013


Hi there.

I would like to draw contours of a vtkHyperOctree but with multi-component data. This works like a charm for the zero component. However, I can't figure out a way to contour a component different from zero. Here is some code illustrating the problem:

/// set up octree and data
vtkSmartPointer<vtkHyperOctree> octree = vtkSmartPointer<vtkHyperOctree>::New();
...
vtkDataArray * scalars=vtkDataArray::CreateDataArray(VTK_DOUBLE);
scalars->SetNumberOfComponents(4);
scalars->SetNumberOfTuples(1);
scalars->SetName("MyData");
octree->GetLeafData()->SetScalars(scalars);
... (create octree data) ...
octree->GetLeafData()->SetScalars(scalars);
...

/// now for the plotting
octree->SetDualGridFlag(true);
vtkSmartPointer<vtkContourFilter> contours = vtkSmartPointer<vtkContourFilter>::New();
contours->SetInputData(octree);
contours->SetArrayComponent(2);
... (render) ...

However, the last statement has no effect. No matter what I do, always the zero-th component is plotted.

I would greatly appreciate any help on that!

Thanks and regards, Chris


More information about the vtkusers mailing list