hello guys <br>
<br>
i am a newbie to VTK and i really have a problem that getting me so nervous <br>
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 <br>
please any help <br>
<br>
here is my code<br>
<br>
<meta name="qrichtext" content="1"><meta http-equiv="Content-Type" content="text/html; charset=utf-8"><style type="text/css">
p, li { white-space: pre-wrap; }
</style>
<p style="margin: 0px; text-indent: 0px;"> PTR<vtkXMLPolyDataReader> reader = PTR<vtkXMLPolyDataReader>::New();</p>
<p style="margin: 0px; text-indent: 0px;"> reader->SetFileName("../headsq-pointcloud.vtp");</p>
<p style="margin: 0px; text-indent: 0px;"> reader->Update();</p>
<p style="margin: 0px; text-indent: 0px;"> PTR<vtkPolyData> PolyData = PTR<vtkPolyData>::New();</p>
<p style="margin: 0px; text-indent: 0px;"> PolyData = reader->GetOutput();</p>
<p style="margin: 0px; text-indent: 0px;"> vtkIdType NumPoints = PolyData->GetNumberOfPoints();</p>
<meta name="qrichtext" content="1"><meta http-equiv="Content-Type" content="text/html; charset=utf-8"><style type="text/css">
p, li { white-space: pre-wrap; }
</style>
<p style="margin: 0px; text-indent: 0px;"></p>
<p style="margin: 0px; text-indent: 0px;"> PTR<vtkLookupTable> LookupTable = PTR<vtkLookupTable>::New();</p>
<p style="margin: 0px; text-indent: 0px;"> LookupTable->SetNumberOfColors(3440);</p>
<p style="margin: 0px; text-indent: 0px;"> LookupTable->SetTableRange(0,3440);</p>
<p style="margin: 0px; text-indent: 0px;"> LookupTable->ForceBuild();</p>
<p style="margin: 0px; text-indent: 0px;"></p>
<p style="margin: 0px; text-indent: 0px;"> PTR<vtkScalarBarActor> colorbar = PTR<vtkScalarBarActor>::New();</p>
<p style="margin: 0px; text-indent: 0px;"> colorbar->SetLookupTable(LookupTable);</p>
<p style="margin: 0px; text-indent: 0px;"> colorbar->SetWidth(0.05);</p>
<p style="margin: 0px; text-indent: 0px;"> colorbar->SetPosition(0.95,0.1);</p>
<p style="margin: 0px; text-indent: 0px;"> colorbar->SetLabelFormat("%.3g");</p>
<p style="margin: 0px; text-indent: 0px;"> colorbar->PickableOff();</p>
<p style="margin: 0px; text-indent: 0px;"> colorbar->VisibilityOn();</p>
<p style="margin: 0px; text-indent: 0px;"></p>
<p style="margin: 0px; text-indent: 0px;"></p>
<p style="margin: 0px; text-indent: 0px;"></p>
<p style="margin: 0px; text-indent: 0px;"></p>
<p style="margin: 0px; text-indent: 0px;"> PTR<vtkPolyDataMapper> mapper = PTR<vtkPolyDataMapper>::New();</p>
<p style="margin: 0px; text-indent: 0px;"> mapper->SetInput (PolyData);</p>
<p style="margin: 0px; text-indent: 0px;"> //mapper->SetScalarRange(PolyData->GetScalarRange());</p>
<p style="margin: 0px; text-indent: 0px;"> mapper->SetLookupTable(LookupTable );</p>
<p style="margin: 0px; text-indent: 0px;"> //mapper->UseLookupTableScalarRangeOn ();</p>
<p style="margin: 0px; text-indent: 0px;"> //mapper->SetColorModeToDefault ();</p>
<p style="margin: 0px; text-indent: 0px;"> PTR<vtkRenderer> myRenderer = PTR<vtkRenderer>::New();</p>
<p style="margin: 0px; text-indent: 0px;"> PTR<vtkRenderWindow> myRedndererWindow = PTR<vtkRenderWindow>::New();</p>
<p style="margin: 0px; text-indent: 0px;"></p>
<p style="margin: 0px; text-indent: 0px;"> PTR<vtkActor> myActor = PTR<vtkActor>::New();</p>
<p style="margin: 0px; text-indent: 0px;"> myActor->SetMapper(mapper);</p>
<p style="margin: 0px; text-indent: 0px;"> myRenderer->AddActor(myActor);</p>
<p style="margin: 0px; text-indent: 0px;"> myRenderer->AddActor(colorbar);</p>
<p style="margin: 0px; text-indent: 0px;"> myRedndererWindow->AddRenderer(myRenderer);</p>
<p style="margin: 0px; text-indent: 0px;"></p>
<p style="margin: 0px; text-indent: 0px;"></p>
<p style="margin: 0px; text-indent: 0px;"> doRenderingAndInteraction(myRedndererWindow);</p>
<p style="margin: 0px; text-indent: 0px;"></p>
<p style="margin: 0px; text-indent: 0px;"> myRedndererWindow->Delete();</p><br clear="all"><br>-- <br>Regards<br><br>Abdalrahman Eweiwi<br>Msc in Media Informatics<br>RWTH-AACHEN <br>B-it<br><br>