I have been using VTK for some years now but a new challenge popped up.
I need to reverse engineer the function
void vtkColorTransferFunction::GetTable( double xStart, double xEnd, int size, double* table )
into getting a Value at a given RGB color.
While the GetTable function can be passed a xStart = xEnd to obtain just one color for a given Scalar value, I need to do the opposite. Given a RGB color, getting the scalar that maps to it.
Is there already any function around that I am not finding? Or do I have to write that function by extending the class?
Inverse lookup is not implemented as it is normally should not be necessary and a general solution would not be trivial (for example, the same RGB value can be mapped to many scalar values). So, if you really need this, then you need to implement it.
luminance = 0.3R + 0.59G + 0.11*B
the same RGB just can be mapped one scalar values,I think!
Hi! Thank you for your answers!
Andras, That’s what I recon. An alternative would be to replace the lookup for a linear gray scale lookup mapped to the Scalar range. Then the gray value would immediately tell me what the scalar value is. Would you agree with this?
wulicheng, could you explain further?
What would you like to achieve? If you want to determine point ID or coordinates then you can use VTK’s picker classes.