[vtkusers] Problem in using vtkLookupTable with vtkContourFilter
Jothybasu Selvaraj
jothybasu at gmail.com
Wed Nov 9 11:48:57 EST 2011
Hi all,
I am trying to use my own lookup table with vtkContourFilter, so that
it can generate contour line of my own colors.
But some of the lines are of the same color!
Here is my code
vtkSmartPointer<vtkLookupTable> isoLineTable =
vtkSmartPointer<vtkLookupTable>::New();
double
scalarMin=*std::min_element(isodoseValues.begin(),isodoseValues.end());
double
scalarMax=*std::max_element(isodoseValues.begin(),isodoseValues.end());
isoLineTable->SetValueRange(scalarMin,scalarMax);
qDebug()<<scalarMin<<scalarMax;
isoLineTable->SetNumberOfTableValues(isodoseValues.size());
// isoLineTable->SetRampToLinear();
isoLineTable->Build();
for(int i=0;i<isodoseValues.size();i++)
{
//qDebug()<<colorsR[i]<<colorsG[i]<<colorsB[i];
isoLineTable->SetTableValue(i,colorsR[i],colorsG[i],colorsB[i]);
}
vtkSmartPointer<vtkPolyDataMapper> contourMapper =
vtkSmartPointer<vtkPolyDataMapper>::New();
contourMapper->SetInputConnection(cf->GetOutputPort());
contourMapper->SetScalarRange(isoLineTable->GetRange());
contourMapper->SetLookupTable(isoLineTable);
contourMapper->Update();
Any suggestions?
Thanks
Jothy
--
Jothy
More information about the vtkusers
mailing list