[vtkusers] Draw a line when interact with the renderwindow
Rakesh Patil
rakeshthp at in.com
Thu Apr 15 11:53:10 EDT 2010
Hi..Even i am trying to implement the same feature.,.. Please check for all these messages in this months threadhttp://www.vtk.org/pipermail/vtkusers/2010April/107914.htmlIf you are able to implement it succesfully, then please let me know...ThanksRegardsRakesh Patil Original message From:Erkang Cheng< ekyaya at gmail.com >Date: 15 Apr 10 20:32:52Subject:[vtkusers] Draw a line when interact with the renderwindowTo: vtkusers at vtk.orgHi all:Could anyone help me?The story is that, I want to interact the window which display a image or one slice of 3D data (like DICOM). The operation is that when I click one point, and mouse move on the window, then LeftButtonUp. These action could related to a line. I want to save the positions of all the points on the line and draw this line on the window.I follow the example in InsightApplication titled "LiverTumorSegmentation". In this application, I can get the point when I click on the window, also, I can get the points when mouse move.So, I w
ant to draw this line on the window. How to do this?My idea is that, suppose that there are two points p1 and p2, p1 is the point I click on the window, when mouse move, p2 is current point, I want to draw a line from p1 to p2. Then update p1 as p2. This could turn into a line. I use this method in MFC which can draw a line.But, I don't know how to draw a line in a vtkRenderWindow? what's the coordinate of the vtkRenderWindow?I look at the example about drawing a line in "VTK/Examples/GeometricObjects/Display/Line". But, it doesn't look correct. part of codes are: Here, I test draw a line when I click on the renderwindow. The line is supposed to from (10,10,0) to (50,50,0).Every time when I click the line, the line should not change.But, when I add these codes in the click event, the line changes every time. I wonder I do not catch the coordinate point. Could anyone help me figure out the question?vtkLineSource * line = vtkLineSource::New();line>SetPoint1(10,10,0);line>SetPo
int2(50,50,0);vtkPolyDataMapper * mapper = vtkPolyDataMapper::New();mapper>SetInput(line>GetOutput());line>Update();mSphereActor>SetMapper(mapper);//mSphereActor is an instance of vtkActor mRenderWindow>Render();Is there is example similar to my question? Thanks a lot.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20100415/7e4617f3/attachment.htm>
More information about the vtkusers
mailing list