VTK Examples - Some ColorMap to LookupTable tools

Introduction

There is nothing in VTK that allows you to easily import colormaps. So it is hoped that these examples address this and make it easier for users to import or create their own colormaps.

Hopefully this will make VTK a more colorful and happier place!

The Programs

These two Python programs will allow you to generate and visualise XML or JSON colormaps on a cone (a sphere is also provided - commented out). They also have the ability to generate a C++ or Python function that you can automatically incorporate into your code.

Examples

These two examples demonstrate how to do this using the autogenerated function from either of the above programs:

Comments

These tools were inspired by this discussion: Replacement default color map and background palette. I have used the Fast colormap from this discussion.

A good initial source for color maps is: SciVisColor - this will provide you with plenty of XML examples.

See also:

7 Likes

I’m really glad to see better colormap support - it’s an underappreciated aspect of good visualization practices. Thanks Andrew!

3 Likes

I have updated ColorMapToLUT_JSON to support choosing a colormap by name e.g. from ParaView Default Colormaps. In this case you can look at the colormaps in ParaView and select the the one you want from the from the ParaView JSON file.

Two new programs have been added:

These allow you to adjust a colormap so that the colormap scalar range matches the scalar range of the object by rescaling the control points and, optionally, reversing the order of the colors.