Hm, personally I didn’t touch the interaction for a long time, but four years
ago I wrote an interactor that calculated the pick ray in the 3d renderwindow
based on the mouse coordinates [1]. The simulation module was deleted
meanwhile, but it is present in v2016.03.0. Even though it is a relatively
complicated module, I’m sure you can get an idea of how to write an interactor
for 3d interaction. I didn’t check but there is also a Gizmo module in MITK
that basically consists of a 3d control element to modify objects in the 3d
window, that could be a good and more recent starting point as well. I never
used interactors outside of the MITK Workbench so I cannot say anything about
possible quirks in completely custom applications.
[1]
https://github.com/MITK/MITK/blob/v2016.03.0/Modules/Simulation/mitkSimulationInteractor.cpp#L197-L233
From: LOPEZ VELAZCO, ROCIO [mailto:rocio.lo...@upf.edu]
Sent: Dienstag, 20. Februar 2018 11:03
To: Dinkelacker, Stefan
Cc: mitk-users@lists.sourceforge.net
Subject: Re: [mitk-users] vtkRenderWindowInteractor and LeftButtonPressEvent
Hello Stefan,
Thank you very much for your fast reply. I went deeper yesterday and now I have
more information about all this.
- I am developing a MITK based application in which there are only two
independent QmitkRenderWindow.
- What I tried some days ago was to create a new interactor modifying Display
Interactor copy (config.xml and interactor.xml), but I found that it was only
for 2D axial, sagital and coronal views, however what I want to interact is the
3D QmitkRenderWindow. In MITK Mailing
list<https://sourceforge.net/p/mitk/mailman/message/33298655/> I found
something about it: "In 2D we handle the Display interaction with the
DisplayInterator, in 3D the DisplayInteractor should (but currently doesn't)
return false, and VTK takes the place to handle the events." So, looking at the
documentation of
QmitkRenderWindow<http://docs.mitk.org/nightly/classQmitkRenderWindow.html>, I
found the public function
GetVtkRenderWindowInteractor<http://docs.mitk.org/nightly/classQmitkRenderWindow.html#a28411f023543ee4ec9484bc8d5e654d4>
() which returns vtkRenderWindowInteractor object. I thought about changing
the style of the vtk iteractor so that disable the "joystick camera" by default
in 3D render to a customized one... Do you think this would work? or is there
a way to interact with the 3D Render Window using MITK Interactions?
Looking at the MITK source code I found that for QmitkRenderWindow you don't
use MITK interactors, don't you? maybe I missunderstood.
Thank you very much for the help!
Best regards,
Rocío
2018-02-20 2:46 GMT+01:00 Dinkelacker, Stefan
<s.dinkelac...@dkfz-heidelberg.de<mailto:s.dinkelac...@dkfz-heidelberg.de>>:
Hi,
I highly recommend to use the MITK interaction instead [1]. All the interaction
in the MITK Workbench is done like this and it blends in well with all the
other interactions in the application. You can easily access the mouse position
through mitk::InteractionPositionEvent. Find some examples in the MITK source
code. Look for the "resource/Interactions" and "src/Interactions" directories
of modules, i. e. the BoundingShape module contains all the interaction for the
Image Cropper plugin, in which you can modify and move a box in the render
windows. There should be much smaller examples in the MITK source code as well.
Best,
Stefan
[1] http://docs.mitk.org/2016.11/DataInteractionPage.html
________________________________
Von: LOPEZ VELAZCO, ROCIO <rocio.lo...@upf.edu<mailto:rocio.lo...@upf.edu>>
Gesendet: Montag, 19. Februar 2018 13:00
An: mitk-users@lists.sourceforge.net<mailto:mitk-users@lists.sourceforge.net>
Betreff: [mitk-users] vtkRenderWindowInteractor and LeftButtonPressEvent
Hello,
I am trying to simulate a virtual camera in a QmitkRenderWindow, the camera is
fixed to the tip of a pointer object. I would like to modify the
vtkRenderWindowInteractor so that modify the position of my object (and thus
the camera as well) only by using the 2D coordinates the mouse sends(left
button clicked), let's call it mouse navigation.
I can access the vtkRenderWindowInteractor, but I don't know how to access the
mouse clicked event and most important take the positions in the 3D world
coordinates. I read about this in Display Geometry
Interactor<http://mitk.org/wiki/Display_Geometry_Interaction_Project>, and
looking at the RenderWindowInteractor
documentation<https://www.vtk.org/doc/nightly/html/classvtkRenderWindowInteractor.html#ac0824fe498c523664ef739202cfc679f>
I saw
LeftButtonPressEvent<https://www.vtk.org/doc/nightly/html/classvtkRenderWindowInteractor.html#ac0824fe498c523664ef739202cfc679f>
() that needs SetEventInformation() call.
I am not sure how to use SetEventInformation() funcion... I guess I have to
pass it the x and y display positions once clicked but if it "should be called
just prior to"
LeftButtonPressEvent<https://www.vtk.org/doc/nightly/html/classvtkRenderWindowInteractor.html#ac0824fe498c523664ef739202cfc679f>
() it confuses me.
Once I got the x and y positions I would do my computations so that move my
object and the camera.
I would be grateful if you could give me some tip! I don't know if this is the
best way to achieve my objective or there is a better one.
If it is not clear what I am asking feel free to make any question :)
Thank you very much in advance.
Best regards,
Rocío
--
Rocío López Velazco
SimbioSYS group, BCN MedTech
UniversityPompeu Fabra
Department of Information and Communication Technologies
Roc Boronat,
122<https://maps.google.com/?q=Roc+Boronat,+122&entry=gmail&source=g> (Tànger
Building), 08018 Barcelona
Office 55 119
https://bcn-medtech.upf.edu/
--
Rocío López Velazco
SimbioSYS group, BCN MedTech
UniversityPompeu Fabra
Department of Information and Communication Technologies
Roc Boronat, 122 (Tànger Building), 08018 Barcelona
Office 55 119
https://bcn-medtech.upf.edu/
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
mitk-users mailing list
mitk-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mitk-users