Is there a VTK filter that can generate a constant scalar field?

Viewed 27

I try to generate a constant scalar field, with 3 unsigned char components (colors), using a specific value.

I need to put this field generation in a VTK pipeline. I cannot create a vtkPolyData from scratch.

Something like this, using a vtkArrayCalculator (Java wrapper):

    var cubeSource = new vtkCubeSource();

    var calc = new vtkArrayCalculator();
    calc.SetInputConnection(cubeSource.GetOutputPort());
    calc.SetFunction("255 * jHat");
    calc.SetResultArrayType(3); // VTK_UNSIGNED_CHAR
    calc.SetAttributeTypeToCellData();

This does not work: the output dataset contains VECTORS data, and I want them to be SCALARS data.

Is there a way to do this? Maybe another VTK filter?

0 Answers
Related