[vtkusers] Printing the contents of a vtkWindowLevelLookupTable
emonclus at cs.upc.edu
Wed Jul 18 07:20:08 EDT 2018
I'm working with a volume dataset which is visualized using a
vtkWindowLevelLookupTable with a vtkImageMapToColors which takes as an
input vtkExtractVOI->GetOutputPort(). The vtkExtractVOI has as an
inputdata the volume dataset.
This pipeline works fine. I can change the window/level of the
vtkWindowLevelLookupTable using SetWindow/SetLevel methods and after
that I always execute the Build method of the
vtkWindowLevelLookupTable. As I said, the changes in the window/level
are properly mapped in the obtained visualization.
My problem starts when I try to print the colors of the
vtkWindowLevelLookupTable (I want to use them in another task).
I use the following code to print it, but I always obtain the same
values (although I'm changing the window/level and I see how my changes
affect the current rendering). But, although I change the window/level
the printed messages are always the same.
void printVtKTransferFunction(vtkLookupTable *vtk_tf)
vtkIdType tv = vtk_tf->GetNumberOfTableValues();
cout << "Number of table values : " << tv << "\nTable Range: " <<
std::fixed << std::setw(8) << std::setprecision(6)
<< dR << " to " << dR << std::endl;
for (int i = 0; i < tv; ++i)
indices.push_back((dR - dR) * i / tv + dR);
unsigned int id_tf = 0;
for (std::vector<double>::const_iterator p =
indices.begin(); p != indices.end(); ++p, id_tf++)
rgba = vtk_tf->GetOpacity(*p);
cerr << id_tf << " : " << rgba << " " << rgba <<
" " << rgba << " " << rgba << endl;
Any help will be welcome. Thank you very much in advance,
More information about the vtkusers