[vtkusers] vtkProjectedTetrahedraMapper to map one component only

Bertram Sabrowsky-Hirsch Bertram.Sabrowsky-Hirsch at risc-software.at
Thu Mar 29 07:45:52 EDT 2018



From: Bertram Sabrowsky-Hirsch
Sent: 29 March 2018 13:29
To: 'vtkusers at vtk.org' <vtkusers at vtk.org>
Subject: vtkProjectedTetrahedraMapper to map one component only

Hi everyone,

I have troubles implementing a similar feature found in Paraview: I do have a vtkUnstructuredGrid where the PointData contains 4 different (Float) Arrays (e.g. "Pressure", "Velocity", ...).
One of those Arrays has 3 components and I want to let the user decide which one of the components is used for the color mapping.

What I do:


-          Set the active Attribute of the grid to select the array that is visualized:

grid->SetActiveAttribute(grid->GetInformation(), vtkDataObject::FIELD_ASSOCIATION_POINTS, "Velocity", vtkDataSetAttributes::SCALARS);



-          Use a vtkDataSetTriangleFilter and connect it with a vtkProjectedTetrahedraMapper and finally set the mapper to a vtkVolume that is rendered



-          Set a custom vtkColorTransferFunction in the volumes properties to map the scalar values to colors

Now, for single component arrays, this works just fine.
For arrays with multiple components - as I understand it - this will always use the magnitude of the components to map the scalar values.

vtkColorTransferFunction does offer to set the vector components using the functions (SetVectorModeToComponent(), SetVectorComponent(idx), SetVectorSize(1)) and I tried this,
however, after inspecting the source code of vtkProjectedTetrahedraMapper I think that this feature is ignored by the mapper. Also, I didn't find any way to adjust the grid in a way that a specific component is used (I figured there might be something like SetActiveComponent as it exists for attributes with SetActiveAttribute).

I also looked into using vtkArrayCalculator and vtkExtractBlock but I don't understand the VTK data concept well enough to find a solution on my own.

Is there a simple way to get the vtkProjectedTetrahedraMapper to use one specific component?

Thanks in advance,

Kind regards,
Bertram
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://vtk.org/pipermail/vtkusers/attachments/20180329/e455a1d7/attachment.html>


More information about the vtkusers mailing list