[vtkusers] please help in lookuptable

abdalrahman eweiwi abdalrahman.eweiwi at googlemail.com
Sun May 10 04:37:35 EDT 2009


hello guys

i am a newbie to VTK and i really have a problem that getting me so nervous
i have a file where i am reading a set of points , my problem is that to use
lookuptable for coloring those points , i tried everyway possible but it did
not work
please any help

here is my code

 PTR<vtkXMLPolyDataReader> reader = PTR<vtkXMLPolyDataReader>::New();

reader->SetFileName("../headsq-pointcloud.vtp");

reader->Update();

PTR<vtkPolyData> PolyData = PTR<vtkPolyData>::New();

PolyData = reader->GetOutput();

vtkIdType NumPoints = PolyData->GetNumberOfPoints();

 PTR<vtkLookupTable> LookupTable = PTR<vtkLookupTable>::New();

LookupTable->SetNumberOfColors(3440);

LookupTable->SetTableRange(0,3440);

LookupTable->ForceBuild();

 PTR<vtkScalarBarActor> colorbar = PTR<vtkScalarBarActor>::New();

colorbar->SetLookupTable(LookupTable);

colorbar->SetWidth(0.05);

colorbar->SetPosition(0.95,0.1);

colorbar->SetLabelFormat("%.3g");

colorbar->PickableOff();

colorbar->VisibilityOn();

  PTR<vtkPolyDataMapper> mapper = PTR<vtkPolyDataMapper>::New();

mapper->SetInput (PolyData);

//mapper->SetScalarRange(PolyData->GetScalarRange());

mapper->SetLookupTable(LookupTable );

//mapper->UseLookupTableScalarRangeOn ();

//mapper->SetColorModeToDefault ();

PTR<vtkRenderer> myRenderer = PTR<vtkRenderer>::New();

PTR<vtkRenderWindow> myRedndererWindow = PTR<vtkRenderWindow>::New();

 PTR<vtkActor> myActor = PTR<vtkActor>::New();

myActor->SetMapper(mapper);

myRenderer->AddActor(myActor);

myRenderer->AddActor(colorbar);

myRedndererWindow->AddRenderer(myRenderer);

 doRenderingAndInteraction(myRedndererWindow);

 myRedndererWindow->Delete();


-- 
Regards

Abdalrahman Eweiwi
Msc in Media Informatics
RWTH-AACHEN
B-it
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20090510/2fbaf04e/attachment.htm>


More information about the vtkusers mailing list