[vtkusers] can vtkDiscretizableColorTransferFunction deal with non-contiguous dicrete values?
Luca Pallozzi Lavorante
lplavorante at gmail.com
Fri Aug 12 14:50:51 EDT 2016
Hi everybody,
I am trying to use vtkDiscretizedColorTransferFunction in order to assign
predefined colors to a variable number of fixed values.
With the settings specified in the code below, the table works fine as soon
as the values are contiguous, e.g., 3->4->5->6->7->8. But if I provide a
list of non-contiguous ids, such as 3->5->6->7->8, the table apparently
shifts the colors.
Can anybody help me understand what I am missing?
Thanks for any help
Luca
Here is my code:
// This is an example
std::vetor<uint32> listIds = {3, 5, 6, 7, 8};
table = vtkSmartPointer<vtkDiscretizableColorTransferFunction>::New();
table->DiscretizeOn();
table->IndexedLookupOff();
table->SetNumberOfValues(listIds.size());
foreach (uint32 id, listaIds) {
QColor color(myFunctionTogetColorsFromIds(id))
double r = color.redF();
double g = color.greenF();
double b = color.blueF();
table->AddRGBPoint(static_cast<double>(id), r, g, b);
}
table->Build();
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/vtkusers/attachments/20160812/9c4fd290/attachment.html>
More information about the vtkusers
mailing list