How to add color preset in trame_tutorial/04_application/

Hi, I want to add a “Cool To Warm” preset in trame_tutorial/04_application/ And I modify the code. My question is how to set the preset value. Thanks!

Hi @qlhai,

The “Cool to Warm” color map is not defined in the HSV (hue, saturation, value) color space like the rest of the color maps you have. If the vtkLookupTable returned by actor.GetMapper().GetLookupTable() is a vtkColorTransferFunction, you can call

lut.AddRGBPoint(dataMin, 0.23137254902, 0.298039215686, 0.752941176471)
lut.AddRGBPoint(0.5*(dataMin+dataMax), 0.865, 0.865, 0.865)
lut.AddRGBPoint(dataMax, 0.705882352941, 0.0156862745098, 0.149019607843)

Note that dataMin and dataMax here are the minimum and maximum values of the data array by which you are coloring. Those values will change if the array changes, so updating the color map that might require some special handling beyond what is in the tutorial file.

Thank you for your careful and professional reply, I will continue to try new solutions.