<html>
<head>
<style>
P
{
margin:0px;
padding:0px
}
body
{
FONT-SIZE: 9pt;
FONT-FAMILY:Tahoma
}
</style>
</head>
<body><div style="text-align: left;">Hi, I have now a structuredPoints image data, and an array of scalars corresponding to the color at each point of the image, I want to use vtkLookupTable to take the color array as input and color the points, what i did was set the color array as the scalar values of the PointData in structuredpoints, however I am not able to do that, the image is blue at all points, here is my code, could anybody have a look at the problem?<br><br><br>thanks<br><br><br> vtkStructuredPoints *sp = vtkStructuredPoints::New();<br> int dim[3] = {dx, dy, dz};<br> sp->SetDimensions(dim);<br> sp->SetScalarType(VTK_FLOAT);<br> //sp->SetNumberOfScalarComponents(1);<br> sp->SetSpacing(1.75, 1.75, 2);<br> sp->SetOrigin(0, 0, 0); <br> sp->GetPointData()->SetScalars(scalar);<br> sp->GetPointData()->SetVectors(arr);<br> arr->Delete();<br><br> vtkThreshold *thres = vtkThreshold::New();<br> thres->SetInput(sp);<br> thres->ThresholdByUpper(10);<br> thres->AllScalarsOff();<br> thres->SetComponentModeToUseSelected();<br> thres->SetSelectedComponent(0);<br><br> vtkMaskPoints *mask = vtkMaskPoints::New();<br> mask->SetInputConnection(thres->GetOutputPort());<br> mask->SetOnRatio(30);<br> //mask->RandomModeOn();<br><br> vtkHedgeHog* hh = vtkHedgeHog::New();<br> hh->SetInputConnection(mask->GetOutputPort());<br> hh->SetVectorModeToUseVector();<br> hh->SetScaleFactor(5);<br> <br> vtkLookupTable *bwLut = vtkLookupTable::New();<br> bwLut->SetTableRange (0, 255);<br> bwLut->SetNumberOfColors(256);<br> bwLut->Build(); //effective built<br><br> vtkPolyDataMapper *mapper = vtkPolyDataMapper::New();<br> mapper->SetLookupTable(bwLut);<br> mapper->SetInput(hh->GetOutput());<br><br> vtkProperty *prop = vtkProperty::New();<br> prop->SetOpacity(0.2);<br><br> vtkActor *actor = vtkActor::New();<br> actor->SetProperty(prop);<br> actor->SetMapper(mapper); <br> vtkRenderer *renderer = vtkRenderer::New();<br> vtkRenderWindow *renWin = vtkRenderWindow::New();<br> renWin->AddRenderer(renderer);<br> vtkRenderWindowInteractor *iren = vtkRenderWindowInteractor::New();<br> iren->SetRenderWindow(renWin);<br><br> renderer->AddActor(actor);<br> renderer->SetBackground(1,1,1);<br> //renderer->SetActiveCamera(aCamera);<br> renderer->ResetCamera();<br> renderer->GetActiveCamera()->Elevation(60.0);<br> renderer->GetActiveCamera()->Azimuth(30.0);<br> renderer->GetActiveCamera()->Zoom(2);<br><br> renWin->SetSize(600,600);<br> renWin->Render();<br> iren->Initialize();<br> iren->Start();<br></div><br /><hr />中国十大热门旅游景点 <a href='http://search.msn.com/results.aspx?q=%E4%B8%AD%E5%9B%BD%E5%8D%81%E5%A4%A7%E9%A3%8E%E6%99%AF&mkt=zh-CN&form=QBRE' target='_new'>了解更多信息!</a></body>
</html>