Now i get it . You need the projection . Try the vtkCoordinate class , there is an example in the VTK Wiki. This will give you the answer in viewport coordinates. <br><br>Regards<br>Darshan<br><br><div class="gmail_quote">
On Tue, Apr 27, 2010 at 4:55 AM, 朱文武 <span dir="ltr">&lt;<a href="mailto:cool.wenwu@gmail.com">cool.wenwu@gmail.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
hey, Darshan, thanks for your kind help. From my point of view, the function of the GetSelectionPoint() of vtkAbstractPicker is &quot;get the selection point in screen (pixel) coordinates&quot;.&nbsp;&nbsp; And my condition is that user can pick point&nbsp; on the 3D model(surface), then i need to calculate the 2D coordinate of this point. The mean of 2D coordinate is the 3D point projected into original 2D image.&nbsp; So, i think the point coordinate which i want&nbsp; does not equalize the screen point coordinate. But, thank your all the same.<br>


Could anyone provide suggestion? thanks very much!<div><div></div><div class="h5"><br><br><br><br><div class="gmail_quote">On Tue, Apr 27, 2010 at 3:12 AM, Darshan Pai <span dir="ltr">&lt;<a href="mailto:darshanpai@gmail.com" target="_blank">darshanpai@gmail.com</a>&gt;</span> wrote:<br>


<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">I think GetSelection() should be the function of choice <br><br><div class="gmail_quote"><div>


<div></div><div>On Mon, Apr 26, 2010 at 10:17 AM, 朱文武 <span dir="ltr">&lt;<a href="mailto:cool.wenwu@gmail.com" target="_blank">cool.wenwu@gmail.com</a>&gt;</span> wrote:<br>
</div></div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><div><div></div><div>hi all,<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; i encounter a problem, and need your kind help ! I get 3D global coordinate by using vtkCellPicker, then i want to know the 2D coordinate of point which is picked in the 3D scene.&nbsp; However, the 2D coordiante i transformed was not accurate. Could anyone give some suggestion or better methods? thanks in advance!<br>





<br>All related code is as follows:<br>&nbsp;&nbsp;&nbsp; vtkBMPReader *m_read=... // read bmp image&nbsp;&nbsp; <br>&nbsp;&nbsp;&nbsp; m_read-&gt;SetDataSpacing(CReadBmp::m_Dx,CReadBmp::m_Dy,CReadBmp::m_Dz);//&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <br>&nbsp;&nbsp;&nbsp; m_read-&gt;SetDataExtentCReadBmp::m_Xmin,CReadBmp::m_Xmax,CReadBmp::m_Ymin,CReadBmp::m_Ymax,CReadBmp::m_Zmin,CReadBmp::m_Zmax);//<br>





<br><br>&nbsp;&nbsp;&nbsp; vtkInteractorStyleTrackballCamera *style;<br>&nbsp;&nbsp;&nbsp; vtkRenderWindowInteractor *iren;<br>&nbsp;&nbsp;&nbsp; vtkCellPicker *picker;<br>&nbsp;&nbsp;&nbsp; iren-&gt;SetInteractorStyle(style);<br><br>&nbsp;&nbsp;&nbsp; style-&gt;AddObserver(vtkCommand::MiddleButtonReleaseEvent, cmd);<br>





&nbsp;&nbsp;&nbsp; cmd-&gt;SetCallback(MyExecute);<br>&nbsp;&nbsp;&nbsp; picker-&gt;SetTolerance(0.0001);<br>&nbsp;&nbsp;&nbsp; iren-&gt;SetPicker(picker);<br><br>void MyExecute(vtkObject *caller, unsigned long eid, void *clientdata, void *calldata)<br>{<br>&nbsp;&nbsp;&nbsp; double globalCoordinate[3]; //<br>





&nbsp;&nbsp;&nbsp; double selPt[2];<br>&nbsp;&nbsp;&nbsp; picker-&gt;Pick(psurface-&gt;iren-&gt;GetEventPosition()[0],psurface-&gt;iren-&gt;GetEventPosition()[1],0, psurface-&gt;aRenderer);<br>&nbsp;&nbsp;&nbsp; picker-&gt;GetPickPosition(globalCoordinate);&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <br>





&nbsp;&nbsp;&nbsp;&nbsp; <br>&nbsp;&nbsp;&nbsp;&nbsp; int _2DCoor[3];<br>//<span style="color: rgb(255, 0, 0);"> this is the map formula</span><br>&nbsp;&nbsp;<span style="color: rgb(255, 0, 0);">&nbsp;&nbsp;&nbsp; _2DCoor[0] = static_cast&lt;int&gt;(globalCoordinate[0] / CReadBmp::m_Dx); //2D x Coordinate</span><br style="color: rgb(255, 0, 0);">





<span style="color: rgb(255, 0, 0);">&nbsp;&nbsp; </span><br style="color: rgb(255, 0, 0);"><span style="color: rgb(255, 0, 0);">&nbsp;&nbsp;&nbsp; _2DCoor[1] = CReadBmp::m_Ymax + 1 - static_cast&lt;int&gt;(globalCoordinate[1] / CReadBmp::m_Dy);//2D y Coordinate</span><br style="color: rgb(255, 0, 0);">





<br style="color: rgb(255, 0, 0);"><span style="color: rgb(255, 0, 0);">&nbsp;&nbsp;&nbsp; _2DCoor[2] = static_cast&lt;int&gt;(globalCoordinate[2] / CReadBmp::m_Dz + 0.5) +&nbsp; CReadBmp::m_Zmin ; </span>// the index of image<br><br>}<br><br>





<br>wenwu<br><br><br><br><br>
<br></div></div><div>_______________________________________________<br>
Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
<br>
Visit other Kitware open-source projects at <a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
<br>
Please keep messages on-topic and check the VTK FAQ at: <a href="http://www.vtk.org/Wiki/VTK_FAQ" target="_blank">http://www.vtk.org/Wiki/VTK_FAQ</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a href="http://www.vtk.org/mailman/listinfo/vtkusers" target="_blank">http://www.vtk.org/mailman/listinfo/vtkusers</a><br>
<br></div></blockquote></div><br>
</blockquote></div><br><br clear="all"><br></div></div><font color="#888888">-- <br>祝<br>工作愉快,身体健康!<br>
</font></blockquote></div><br>