Hi, David,<br><br>Thank you for your help.<br><br>I made it in your way. Thank you so much.<br><br>Have a good night.<br><br>Wenlong<br><br><div class="gmail_quote">2011/10/11 David E DeMarle <span dir="ltr">&lt;<a href="mailto:dave.demarle@kitware.com">dave.demarle@kitware.com</a>&gt;</span><br>
<blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">In my quick scan of your code I didn&#39;t notice that you are already<br>
taking approach #2. Sorry about that.<br>
<br>
VTK won&#39;t draw points without cells. Add one VTK_VERTEX cell for every<br>
landmark point and I think you will see the result. One way to do that<br>
is feed newpolydata into the glyph filter.<br>
<div class="im"><br>
David E DeMarle<br>
Kitware, Inc.<br>
R&amp;D Engineer<br>
21 Corporate Drive<br>
Clifton Park, NY 12065-8662<br>
Phone: <a href="tel:518-881-4909" value="+15188814909">518-881-4909</a><br>
<br>
<br>
<br>
</div>2011/10/11 Wenlong Wang &lt;<a href="mailto:scc.wwl@gmail.com">scc.wwl@gmail.com</a>&gt;:<br>
<div><div></div><div class="h5">&gt; Hi, David,<br>
&gt;<br>
&gt; Thank you for your reply.<br>
&gt;<br>
&gt; Yes, the code clip I attached is building a polydata object for the<br>
&gt; landmarks only and there is another polydata object for the surface.<br>
&gt;<br>
&gt; What I want to make is the landmarks are drawn on the screen while another<br>
&gt; surface is show. However, when the application runs, only the surface is<br>
&gt; shown, the landmarks are never appreared. I tried to change the z-coordinate<br>
&gt; by hand, but they still don&#39;t appear.<br>
&gt;<br>
&gt; Could it be anything wrong with the visualization pipeline? I think I&#39;ve<br>
&gt; accomplish the basic operation to visualize actors in the code clip.<br>
&gt;<br>
&gt; Thank you for your kind help”£<br>
&gt;<br>
&gt; Wenlong<br>
&gt;<br>
&gt; 2011/10/11 David E DeMarle &lt;<a href="mailto:dave.demarle@kitware.com">dave.demarle@kitware.com</a>&gt;<br>
&gt;&gt;<br>
&gt;&gt; You have to have as many tuples in the scalars array as there are<br>
&gt;&gt; points in the polydata. You have only as many tuples as there are<br>
&gt;&gt; landmark points.<br>
&gt;&gt;<br>
&gt;&gt; Alternatively might make another polydata that contains only the<br>
&gt;&gt; landmark points and draw both polydata. Scale the landmark polydata up<br>
&gt;&gt; slightly to avoid z-tearing.<br>
&gt;&gt;<br>
&gt;&gt; David E DeMarle<br>
&gt;&gt; Kitware, Inc.<br>
&gt;&gt; R&amp;D Engineer<br>
&gt;&gt; 21 Corporate Drive<br>
&gt;&gt; Clifton Park, NY 12065-8662<br>
&gt;&gt; Phone: <a href="tel:518-881-4909" value="+15188814909">518-881-4909</a><br>
&gt;&gt;<br>
&gt;&gt;<br>
&gt;&gt;<br>
&gt;&gt; On Tue, Oct 11, 2011 at 9:17 AM, Wenlong Wang &lt;<a href="mailto:scc.wwl@gmail.com">scc.wwl@gmail.com</a>&gt; wrote:<br>
&gt;&gt; &gt; Dear all,<br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt; Is there anyone know how to change the color of points with specific<br>
&gt;&gt; &gt; point<br>
&gt;&gt; &gt; ID?<br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt; I do it like this, but the surface appeared but none of these point is<br>
&gt;&gt; &gt; shown.<br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt; Here is the code,<br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt; &nbsp; &nbsp; vtkPoints* newpoints = vtkPoints::New();<br>
&gt;&gt; &gt; &nbsp; &nbsp; for (int i = 0; i &lt; sizeof(landmarks)/sizeof(double); i++)<br>
&gt;&gt; &gt; &nbsp; &nbsp; {<br>
&gt;&gt; &gt; &nbsp; &nbsp; &nbsp; &nbsp; double temp_point[3];<br>
&gt;&gt; &gt; &nbsp; &nbsp; &nbsp; &nbsp; points-&gt;GetPoint(vtkIdType(landmarks[i]), temp_point);<br>
&gt;&gt; &gt; &nbsp; &nbsp; &nbsp; &nbsp; newpoints-&gt;InsertPoint(vtkIdType(i), temp_point[0],<br>
&gt;&gt; &gt; temp_point[1],<br>
&gt;&gt; &gt; temp_point[2]);<br>
&gt;&gt; &gt; &nbsp; &nbsp; }<br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt; &nbsp; &nbsp; vtkPolyData* newpolydata = vtkPolyData::New();<br>
&gt;&gt; &gt; &nbsp; &nbsp; newpolydata-&gt;SetPoints(newpoints);<br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt; &nbsp; &nbsp; vtkFloatArray* newarray = vtkFloatArray::New();<br>
&gt;&gt; &gt; &nbsp; &nbsp; for (int i = 0; i &lt; sizeof(landmarks)/sizeof(double); i++)<br>
&gt;&gt; &gt; &nbsp; &nbsp; {<br>
&gt;&gt; &gt; &nbsp; &nbsp; &nbsp; &nbsp; newarray-&gt;InsertTuple1(vtkIdType(i), double(i));<br>
&gt;&gt; &gt; &nbsp; &nbsp; }<br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt; &nbsp; &nbsp; newpolydata-&gt;GetPointData()-&gt;SetScalars(newarray);<br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt; &nbsp; &nbsp; vtkPolyDataMapper* newmapper = vtkPolyDataMapper::New();<br>
&gt;&gt; &gt; &nbsp; &nbsp; newmapper-&gt;SetInput(newpolydata);<br>
&gt;&gt; &gt; &nbsp; &nbsp; newmapper-&gt;SetScalarRange(0, 7);<br>
&gt;&gt; &gt; &nbsp; &nbsp; newmapper-&gt;SetScalarVisibility(0);<br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt; &nbsp; &nbsp; vtkActor* newactor = vtkActor::New();<br>
&gt;&gt; &gt; &nbsp; &nbsp; newactor-&gt;SetMapper(newmapper);<br>
&gt;&gt; &gt; &nbsp; &nbsp; newactor-&gt;GetProperty()-&gt;SetColor(0.0, 1.0, 0.0);<br>
&gt;&gt; &gt; &nbsp; &nbsp; newactor-&gt;GetProperty()-&gt;SetPointSize(3);<br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt; &nbsp; &nbsp; ren-&gt;AddActor(newactor);<br>
&gt;&gt; &gt; &nbsp; &nbsp; renWin-&gt;AddRenderer(ren);<br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt; &nbsp; &nbsp; ren-&gt;Render();<br>
&gt;&gt; &gt; &nbsp; &nbsp; renWin-&gt;Render();<br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt; where &#39;ren&#39; is a vtkRenderer object, &#39;renWin&#39; is a vtkRenderWindow<br>
&gt;&gt; &gt; object,<br>
&gt;&gt; &gt; and &#39;landmarks&#39; is an array stores vtk point IDs.<br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt; Can anybody help me with this? I&#39;ll be very grateful.<br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt; Thank you all so much.<br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt; Bests<br>
&gt;&gt; &gt; Wenlong<br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt; _______________________________________________<br>
&gt;&gt; &gt; Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt; Visit other Kitware open-source projects at<br>
&gt;&gt; &gt; <a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt; Please keep messages on-topic and check the VTK FAQ at:<br>
&gt;&gt; &gt; <a href="http://www.vtk.org/Wiki/VTK_FAQ" target="_blank">http://www.vtk.org/Wiki/VTK_FAQ</a><br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt; Follow this link to subscribe/unsubscribe:<br>
&gt;&gt; &gt; <a href="http://www.vtk.org/mailman/listinfo/vtkusers" target="_blank">http://www.vtk.org/mailman/listinfo/vtkusers</a><br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt;<br>
&gt;<br>
&gt;<br>
</div></div></blockquote></div><br>