[vtkusers] help needed setting up the colormap/lookup table/mapper in C++
David, John
john.david at uconn.edu
Sun Aug 12 12:59:41 EDT 2007
Sometime back I wrote a simple point cloud to VTK converter which had the following output structure:
# vtk DataFile Version 2.0
loop
ASCII
DATASET UNSTRUCTURED_GRID
POINTS 1150 float
758301.12 555277.12 6.70
758301.50 555183.19 3.50
...
CELLS 1150 2300
1 0
1 1
...
CELL_TYPES 1150
1
1
...
POINT_DATA 1150
SCALARS Z_Value float 1 LOOKUP_TABLE default
6.700000
3.500000
...
I have been unable to figure out how to fully implement the equivalent on the fly in C++. The following is some test code which appears to get the point data set up correctly, but I cannot figure out how to set up the colormap/lookup table/mapper:
vtkPoints *points = vtkPoints::New();
vtkCellArray *polys = vtkCellArray::New();
for (i=0; !in.eof() && in.good(); i++)
{
in >> x >> y >> z;
points->InsertPoint(i, x, y, z);
}
polys->InsertNextCell(points->GetNumberOfPoints());
for (i=0; i<points->GetNumberOfPoints(); i++)
{
polys->InsertCellPoint(i);
}
vtkPolyData *polyData = vtkPolyData::New();
polyData->SetPoints(points);
polyData->SetPolys(polys);
polyData->Update();
vtkPolyDataWriter* writer1 = vtkPolyDataWriter::New();
writer1->SetInput(polyData);
writer1->SetFileName( "test_points.vtk" );
writer1->Update();
writer1->Delete();
I have not found any solutions on line, and my book order has not arrived yet (originally ordered through Amazon, and placed on back oder for 6+ months). Any pointers will be appreciated.
Thanks and best regards,
EBo --
More information about the vtkusers
mailing list