Why is "number of components : 1" of color in "vtkArrowHandleRepresentation"

I’m sorry for the frequent questions these days.

I’m just trying to change the color of “Handle” in “LineWidget”, but it doesn’t work well.

The setColor method of the Handle enters a one-dimensional float value as a parameter, but I don’t know exactly what it means.

It doesn’t seem to be a normal RGBA value, so what kind of value do you put in?


The color mixin is a 0 to 1 scalar value.
Such value is then used in a lookup table (rainbow by default, can be modified by changing the LUT of the mapper I believe).

Alternatively, you can set NaN as scalar value and set a NaNColor to the LUT.

Please note that the following PR adds a new color3 mixin which takes RGB values. Clean reslice cursor widget by finetjul · Pull Request #2591 · Kitware/vtk-js · GitHub

To date, the PR has only been merged into the beta branch, not yet master.

1 Like

Thank you for your detailed reply.

I went through the relevant internal code, looked up some references,

It also seems difficult to express the desired RGB with a one-dimensional linear.

When I called "setColor(1.0)", the result I expected was purple, but navy

It’s not an urgent part for me yet, so I’m going to watch and use it when the PR is officially reflected.