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