[vtkusers] Color mapping

marf marvin.huber at basf.com
Fri Aug 3 07:26:19 EDT 2018


Hi, I did something like that recently in VTKjs, the main idea is, that you
apply your data about what heat you have on which point as a scalar, then
you pick this as an active scalar.
>From this, you create a Lookuptable and apply it to your mapper.

Sorry for the rather vague explanation, I'm fairly new to vtk myself. See
below my javascript code to create a lookuptable, maybe it can help you.
Also I figured this out by looking at these

https://www.vtk.org/pipermail/vtkusers/2012-February/072230.html
https://www.vtk.org/Wiki/VTK/Examples/Cxx/Meshes/Color_a_mesh_by_height



const lookup = vtk.Common.Core.vtkLookupTable.newInstance();
lookup.setHueRange(0.667, 0.0);

// this.reader.getOutputData() returns a Polydata object for me

this.reader.getOutputData().getPointData().setActiveScalars(this.activeScalar
+ '_scalar');
let upper =
this.reader.getOutputData().getPointData().getScalars().getRange()[1];
let lower =
this.reader.getOutputData().getPointData().getScalars().getRange()[0];


lookup.setRange(lower, upper);
lookup.build();

this.mapper.setLookupTable(lookup);
this.mapper.setUseLookupTableScalarRange(lookup);
this.renderWindow.render();



--
Sent from: http://vtk.1045678.n5.nabble.com/VTK-Users-f1224199.html


More information about the vtkusers mailing list