Colormaps RGBPoints clarification

I am familiar with colorTransfer function and what the next two lines would do

const ctfun = vtkColorTransferFunction.newInstance();
ctfun.addRGBPoint(200.0, 1.0, 1.0, 1.0);

However, there are a number of colormaps here in colorMaps.json that I would like to get more information about.

  • What is the mapping between RGBPoints in to the colors?
  • Is there a min and max for RGBPoints array? Why there is a -1 (I thought it should be between [0,1]?
  • What is "NanColor" in some of the colormaps

Thanks!

Here is the jet colormap as an example

{
  "ColorSpace" : "RGB",
  "Name" : "jet",
  "RGBPoints" : [
      -1,
      0,
      0,
      0.5625,
      -0.777778,
      0,
      0,
      1,
      -0.269841,
      0,
      1,
      1,
      -0.015873,
      0.5,
      1,
      0.5,
      0.238095,
      1,
      1,
      0,
      0.746032,
      1,
      0,
      0,
      1,
      0.5,
      0,
      0
  ]
},

The RGBPoints array is a contiguous array of 4-tuples that match the signature of the addRGBPoint function: [value1, red1, green1, blue1, value2, red2, green2, blue2, ...].

The negative values should make sense once you understand the array structure. So [-1, 0, 0, 0.5625] means map the value -1 to the rgb color [0, 0, 0.5625].

NanColor tells the color transfer function to map NaN values to a particular color.

1 Like

Thanks, and does every other value get linearly interpolated between the min and max of the “values” portion of the array?

Thanks, and does every other value get linearly interpolated between the min and max of the “values” portion of the array?

Yes, values are linearly interpolated.

1 Like