<html>
<head>
<style>
.hmmessage P
{
margin:0px;
padding:0px
}
body.hmmessage
{
font-size: 10pt;
font-family:Verdana
}
</style>
</head>
<body class='hmmessage'>
<RTE_TEXT>Hi, VTKers.<BR>
&nbsp;<BR>
I want to render a 2D image and some points over it. But somehow the points are not rendered at all.&nbsp; I attach the code here, if someone could go over it and point out where I was wrong,&nbsp;your help&nbsp;would be&nbsp;highly appreciated. <BR>
&nbsp;<BR>
// Create polydatamapper<BR>
&nbsp;vtkCellArray *verts = vtkCellArray::New();<BR>&nbsp;for( int i=0; i&lt;points-&gt;GetNumberOfPoints(); i++)<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; verts-&gt;InsertNextCell(1, &amp;i );&nbsp; // each cell contains only one point<BR>
&nbsp;// Create a PolyData dummy variable<BR>&nbsp;vtkPolyData *dummyPolyData = vtkPolyData::New(); <BR>&nbsp;dummyPolyData-&gt;SetPoints( points );&nbsp;&nbsp; // points are vtkPoints type and known ahead<BR>&nbsp;dummyPolyData-&gt;SetVerts( verts );<BR>
&nbsp;vtkPolyDataMapper *pointsMapper = vtkPolyDataMapper::New();<BR>&nbsp;pointsMapper-&gt;SetInput( dummyPolyData );<BR>&nbsp;pointsMapper-&gt;ScalarVisibilityOff();<BR>
&nbsp;vtkActor *pointsActor = vtkActor::New();<BR>&nbsp;pointsActor-&gt;SetMapper( pointsMapper );<BR>
&nbsp;<BR>
// Create imageMapper<BR>
&nbsp;vtkImageMapper * imageMapper = vtkImageMapper::New();<BR>&nbsp;imageMapper-&gt;SetInput( image );&nbsp;&nbsp;&nbsp;&nbsp; // image&nbsp;is vtkImageData type and known ahead<BR>&nbsp;imageMapper-&gt;SetColorLevel( 0 );<BR>&nbsp;imageMapper-&gt;SetColorWindow( 512 );<BR>
&nbsp;vtkActor2D *imageActor = vtkActor2D::New();<BR>
&nbsp;imageActor-&gt;SetMapper( imageMapper );&nbsp;<BR>
&nbsp;<BR>
// Create Renderer, Window, Interactor&nbsp;and etc<BR>
&nbsp;vtkRenderer *ren = vtkRenderer::New();<BR>
&nbsp;ren-&gt;AddActor(pointsActor);<BR>
&nbsp;ren-&gt;AddActor(imageActor);<BR>
&nbsp;vtkRenderWindowInteractor * Interactor = vtkRenderWindowInteractor::New();&nbsp;<BR>&nbsp;vtkRenderWindow * RenderWindow = vtkRenderWindow::New();&nbsp;<BR>&nbsp;RenderWindow-&gt;SetSize(512,512);&nbsp;<BR>&nbsp;RenderWindow-&gt;SetInteractor(Interactor);&nbsp;<BR>&nbsp;RenderWindow-&gt;AddRenderer(ren); <BR>
&nbsp;RenderWindow-&gt;Render();<BR>
&nbsp;Interactor-&gt;Start();<BR>
&nbsp;<BR>
Thanks<BR>
Siqi<BR>
&nbsp;<BR>
&nbsp;<BR>
&nbsp;<BR>
</RTE_TEXT><BR><br /><hr />MSN保护盾,十八般武艺保障MSN安全! <a href='http://im.live.cn/safe/' target='_new'>现在就下载!</a></body>
</html>