Issue when applying vtkLookupTable

I’m applying a vtkLookupTable via vtkImageSlice->GetProperty()->SetLookupTable(lut):

lut->SetValueRange(0, 255);
lut->SetRange(0, 255);
for (int i = 0; i <= 255; i++) {
    double red = [[parsedTable Red][i] doubleValue];
    double green = [[parsedTable Green][i] doubleValue];
    double blue = [[parsedTable Blue][i] doubleValue];
    lut->SetTableValue(i, red, green, blue);

I’ve fetched a set of lookup tables from here that I’ve parsed to obtain their RGB values, but when I apply them to my pipeline the result is different from Horos and other viewers (first picture is the expected result, second one is what I’m getting).


Is there some obvious mistake in my code that I’m missing, or are there any settings I can tweak to achieve the expected result?

Make sure that the values for SetTableValue() are between zero and one.
You might have to divide the Horos values by 255 before you use them with VTK:

red /= 255.0;
green /= 255.0;
blue /= 255.0;
1 Like

Thank you for the quick reply! Your solution worked perfectly.