Hi Milad,

My apologies for the delayed reply, since I left for vacation just
before your email was sent. Do you still encounter the described
problems or did you find a way in the meanwhile to implement what you
are looking for?

You may be interested to know that a (simple) interface for object
picking is now available in the current SVN version of MITK. To allow
for object picking, two major changes have been made (cf. bugs.mitk.org,
bug #2448):

1.) The mitk::Mapper class hierarchy has been extended with a method
HasVtkProp() which tells whether the queried mapper object owns the
specified vtkProp. This can be used to find out which mapper and,
consequently, which mitk::DataTreeNode / mitk::BaseData the picked VTK
object in a 3D scene corresponds to. The method is currently implemented
for mitk::SurfaceVtkMapper3D but could in principle be implemented for
any (3D, VTK-based) mapper.

2.) The renderer classes of MITK (mitk::BaseRenderer and
mitk::VtkPropRenderer) have been extended with corresponding picking
methods: the method PickObject() returns the mitk::DataTreeNode
corresponding to the passed object picked by the specified 2D display
position. This is now accessible by the event
mitk::DisplayPositionEvent, which is generated whenever a mouse event
occurs in a render window, and can be used for determining a picked
object.


Please let us know if you would like to use this mechanism in your code
and need further help.


Best regards,
Mathias




> -----Original Message-----
> From: [email protected] [mailto:[email protected]]
> Sent: Wednesday, August 12, 2009 7:31 PM
> To: Seitel Mathias
> Cc: [email protected]
> Subject: Re: [mitk-users] picking with mitk
> 
> A small update: When I render some objects and I press the button p
> (which should also trigger picking (?) ) I get also a segmentation
fault.
> 
> 
> 
> Milad Sadinam wrote:
> > Hi all,
> >
> > thanks for all your responses. As I have some time-pressure for my
> > project I will follow your suggestions and implement the
> > DataTreeNode-picking by myself.
> >
> > Unfortunately, I encountered some more problems. Let me explain
shortly
> > what I am doing. I am listening to the event "LeftButtonPressEvent"
of
> > the vtkRenderWindowInteractor of mitkWidget4. This works well.
> > So, when the execute-method of my vtkCommand-class is called I know
that
> > someone clicked with the mouse on the mitkWidget4. In the
execute-method
> > I use then the following code:
> >
> > void QmitkBmcvPickingCommand::Execute (vtkObject *caller, unsigned
long
> > eventId, void *callData)
> > {
> >   // The caller is a vtkRenderWindowInteractor-object
> >   vtkRenderWindowInteractor* interactor =
> > dynamic_cast<vtkRenderWindowInteractor*>(caller);
> >
> >   // Get the mouse-position where the user has clicked
> >   int x,y;
> >   interactor->GetMousePosition(&x, &y);
> >
> >   // Let the picker pick
> >   interactor->GetPicker()->Pick(x, y, 0,
> > mitk::BaseRenderer::GetByName("mitkWidget4")->GetVtkRenderer()) ;
> > }
> >
> > Unfortunately, when calling the pick-method I get a segmentation
fault.
> > This is the call stack:
> >
> > std::vector::end (stl_vector.h:405)
> > mitk::VtkPropRenderer::GetNextPath (mitkVtkPropRenderer.cpp:663)
> > vtkMitkRenderProp::GetNextPath (vtkMitkRenderProp.cpp:70)
> > vtkPicker::Pick (vtkPicker.cxx:280)
> > ...
> >
> > The picker is initialized by calling
interactor->CreateDefaultPicker().
> > I also tried to initialize it by hand using a vtkPicker-object but
did
> > not help.
> > Any idea what could be the problem?
> >
> > Something must be wrong. interactor->GetMousePosition(&x, &y) also
gives
> > me the values (0,0) although I am clicking somewhere in the middle
of
> > the widget.
> >
> > Hoping that you can help me again :)
> >
> > Milad
> >
> > Seitel Mathias wrote:
> >
> >> Dear Milad,
> >>
> >> We are currently discussing how picking of MITK objects could best
be
> >> realized. Currently, only point picking is supported, i.e. when you
> >> click on an object (e.g. surface) in the 3D window, the
corresponding
> >> point (in 3D world coordinates) can be retrieved. This is for
example
> >> used by the mitk::PointSetInteractor (see also
> >> DisplayPositionEvent::GetWorldPosition()).
> >>
> >> You are right that a vtkPicker can be used to retrieve the
> >> vtkProp/vtkActor representation of the underlying dataset. From
this,
> >> the corresponding mitk::DataTreeNode could be retrieved by checking
> >> whether the associated 3D Mapper contains this vtkProp/vtkActor.
> >>
> >> We are currently in the process of improving/extending the
rendering
> >> mechanism of MITK, which will make it simpler to retrieve this
> >> information. Once this is done, object picking will be simple to
> >> realize. We plan to have this ready by beginning of September. If
this
> >> doesn't fit your time schedule, you could for now experiment with
> >> vtkPickers for yourself, with the suggestions I mentioned above.
> >>
> >> Best regards,
> >> Mathias
> >>
> >>
> >>
> >>
> >>> -----Original Message-----
> >>> From: Milad Sadinam [mailto:[email protected]]
> >>> Sent: Wednesday, August 12, 2009 3:34 PM
> >>> To: [email protected]
> >>> Subject: [mitk-users] picking with mitk
> >>>
> >>> Dear all,
> >>>
> >>> I am trying to do picking with mitk. I have read about picking in
vtk
> >>> and I think I got it.
> >>> In the vtkAbstractPropPicker-class I have these GetActor- and
> >>> GetProp-methods. But how do I get the mitk-object?
> >>> What I am interested in is to get the mitk::BaseData-object or
even
> >>> better the DataTreeNode-object which contains the picked data.
> >>>
> >>> Would be glad to get a hint.
> >>>
> >>> Milad
> >>>
> >>>
> >>>
> >>>
> >>
------------------------------------------------------------------------
> >> ------
> >>
> >>
> >>> Let Crystal Reports handle the reporting - Free Crystal Reports
2008
> >>>
> >>>
> >> 30-Day
> >>
> >>
> >>> trial. Simplify your report design, integration and deployment -
and
> >>>
> >>>
> >> focus on
> >>
> >>
> >>> what you do best, core application coding. Discover what's new
with
> >>> Crystal Reports now.  http://p.sf.net/sfu/bobj-july
> >>> _______________________________________________
> >>> mitk-users mailing list
> >>> [email protected]
> >>> https://lists.sourceforge.net/lists/listinfo/mitk-users
> >>>
> >>>
> >>
> >>
> >
> >
> >
------------------------------------------------------------------------
----
> --
> > Let Crystal Reports handle the reporting - Free Crystal Reports 2008
30-Day
> > trial. Simplify your report design, integration and deployment - and
focus
> on
> > what you do best, core application coding. Discover what's new with
> > Crystal Reports now.  http://p.sf.net/sfu/bobj-july
> > _______________________________________________
> > mitk-users mailing list
> > [email protected]
> > https://lists.sourceforge.net/lists/listinfo/mitk-users
> >
> >


------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
mitk-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mitk-users

Reply via email to