Re: [wxVTK] screen coordinates to world coordinates
Brought to you by:
malat
From: Andres M. <mun...@gm...> - 2006-08-10 00:17:55
|
Hi Nigel, Thank you so very much for your help. Regards, Andres On 09/08/2006, at 5:19PM, Nigel Nunn wrote: > Hi Andres, > Thanks for the details. I'll try setting up such a pipeline > myself this weekend, then let you know what I find! > Nigel > > -----Original Message----- > From: Andres Munarriz [mun...@gm...] > Sent: Thursday, 10 August 2006 8:02 AM > To: Nigel Nunn > Subject: Re: [wxVTK] screen coordinates to world coordinates > > > Hi Nigel, > > Thank you for your reply. I've loaded a single 2d DICOM image to a > vtkImageViewer2. I wish to allow a user to double click a point on > this image (slice) and draw a "marker" in this case a sphere on the > point the user double clicked. Later down the pipeline I will be > using this point as a seed for a connectivity filter. > > I've created my own wxVTKInteractor derived class (ie. > MyVTKRenderWindowInteractor) where I've defined my own EVT_LEFT_DCLICK > handler (ie. void > MyVTKRenderWindowInteractor::OnButtonDouble(wxMouseEvent& p_Event) ). > > I can obtain two sets of "display" coordinates (wx coordinates); one > by calling the p_Event.m_x, p_Event.m_y property or by calling the > wxVTKInteractor GetEventPosition method. > > I'll pass whichever coordinate set to a vtkWorldPointPicker through > the Pick method > (ie. > vtk_pointPicker->Pick(double(eventPosition[0]), double > (eventPosition[1]), 0.0, vtk_windowRenderer); > ) > > however when I retrieve the picked coordinates using the > vtk_pointPicker->GetPickPosition(pointCoordSet); call the coordinates > returned are not the coordinates I expect. The x values are OK but > the Y coord is wrong. > > Could you please help me? > > > Regards, > Andres > > > On 8/9/06, Nigel Nunn <nN...@au...> wrote: > > > > > > Andres Munarriz <mun...@gm...> wrote: > > > > > > Has someone come across the need of converting screen "display" > > > > corrdinates (ie. wxEvent ._x, ._y) to VTK world coordinates? > > > > I've read about a get event method in the > VTKRenderWindowInteractor > > > > but wxVTKRenderWindowInteractor doesn't seem to support this > method. > > > > If someone can help it'll be greatly appreciated. > > > > ... > > > > > > > I'm using the interactor->GetLastEventPosition(&event_x, > &event_y); > > > method. event_x and event_y are both integers. > > > > > > Am I using the wrong method? > > > > > > Hi Andres, > > > > From file <vtkCoordinate.h>: > > > > The coordinate systems in vtk are as follows: > > > > DISPLAY - x-y pixel values in window > > NORMALIZED DISPLAY - x-y (0,1) normalized values > > VIEWPORT - x-y pixel values in viewport > > NORMALIZED VIEWPORT - x-y (0,1) normalized value in viewport > > VIEW - x-y-z (-1,1) values in camera > coordinates. (z is depth) > > WORLD - x-y-z global coordinate values > > USERDEFINED - x-y-z in User defined space > > > > > > First question is what would you like to do? Are you trying to > convert a > > wxWindow "pick" position to vtk "world" or "viewport"? Or are > you trying to > > go the other way, i.e. from Vtk to Wx? Can you describe when and > how you > > get the source coordinates, and what you would like to do with > the target > > coordinates? > > > > A test for most possible conversions can be found here: > > > > /VTK/Rendering/Testing/Cxx/otherCoordinate.cxx > > > > > > Nigel > -- > > ---------------------------------------------------------------------- > --------------- This message is intended for the addressee named > and may contain confidential and privileged information. If you are > not the intended recipient please note that any form of > distribution, copying or use of this communication or the > information in it is strictly prohibited and may be unlawful. If > you receive this message in error, please delete it and notify the > sender. Keep up to date with what's happening in Australian sport. > Visit http://www.ausport.gov.au > ---------------------------------------------------------------------- > --------------- |