Hi Hortense, listening to a change for axial slice and listening to a mouse click, are handled differently in MITK. As far as I understood the first part is working for you, but additionally you also want to trigger different action when you left click in any render window.
To deal with user interaction in general this page [1] might be of interest for you. One problem, that I see no easy solution for, is that you get notified about a slice change, but in certain cases you wish to ignore this, because it was triggered within a different view (e.g. not axial) - AFAIK the slice changed signal does simply not provide this information. A possibility would be to implement a DataInteractor that listens for a slice change, since there you also get the information in which render window the event has been triggered. Best, Christian [1] http://docs.mitk.org/nightly-qt4/DataInteractionPage.html -----Original Message----- From: Hortense KIRISLI [mailto:[email protected]] Sent: Dienstag, 25. November 2014 12:51 To: Goch, Caspar Jonas; Pierre-Yves Menguy Cc: [email protected] Subject: Re: [mitk-users] Plugin event on slice navigator change Hi Caspar, Indeed, I was doing to small 'step-by-step'; my error was indeed due to the fact I did not overwrite the virtual functions. I almost succeeded to do what I wish to do. I now understand how to make an action on change of slice (in any plane). What I need, is to perform action A1 on axial change, and action A2 on 'L-click' in any 2D view. My issue now is that when I do a 'L-click' in a 2D view (sag/cor), my A1 action is also called, as there is a change of axial slice. How can I differentiate from a click in 2D view (I am willing to use CTRL+click) and a scrolling in axial viewer from instance. Thanks for the help, Best, Hortense Hortense KIRISLI Research & Development Engineer AQUILAB SAS Parc Eurasanté - Lille Métropole Biocentre A. Fleming - Bât.A 250 rue Salvador Allende 59120 Loos - France Tel. +33 3 69 61 51 51 Fax +33 3 69 61 51 50 www.aquilab.com -----Message d'origine----- De : Goch, Caspar Jonas [mailto:[email protected]] Envoyé : vendredi 21 novembre 2014 23:54 À : Hortense KIRISLI; Pierre-Yves Menguy Cc : [email protected] Objet : AW: [mitk-users] Plugin event on slice navigator change Hi Hortense, the IRenderWindowPartListener is an abstract class. Did you remember to overwrite the purely virtual functions: RenderWindowPartActivated RenderWindowPartDeactivated If not this might very well be the problem. Best, Caspar ________________________________________ Von: Hortense KIRISLI [[email protected]] Gesendet: Freitag, 21. November 2014 16:55 An: Pierre-Yves Menguy Cc: =?utf-8?B?bWl0ay11c2VycyDigI5bbWl0ay11c2Vyc0BsaXN0cy5zb3VyY2Vmb3JnZS5u?=@mx-ext2.inet.dkfz-heidelberg.de; et] Betreff: Re: [mitk-users] Plugin event on slice navigator change Dear Pierre-Yves, My apologies for coming back after so many months back to you; the priority of the plugin functionalities I am developing have been re-ordered, and thus I am only now working back on that issue. Thank you very much for the indications. However, I have an issue with making my plugin class inherit from the mitk::IRenderWindowPartListener. My compiler (VC 2010, 64bit) is complaining that it cannot instantiate abstract class (error C2259). I just modified my *.h from class pluginClass : public QmitkAbstractView to class pluginClass: public QmitkAbstractView, public mitk::IRenderWindowPartListener and added #include <mitkIRenderWindowPartListener.h> Any idea of why I get this error? I don’t see what is the problem, as similar to the ‘ImageNavigator’ plugin. Thank you for the support, Best, Hortense Hortense KIRISLI Research & Development Engineer [cid:[email protected]] AQUILAB SAS Parc Eurasanté - Lille Métropole Biocentre A. Fleming - Bât.A 250 rue Salvador Allende 59120 Loos - France Tel. +33 3 69 61 51 51 Fax +33 3 69 61 51 50 www.aquilab.com<http://www.aquilab.com/> De : [email protected] [mailto:[email protected]] De la part de Pierre-Yves Menguy Envoyé : vendredi 18 juillet 2014 18:06 À : Hortense KIRISLI Cc : mitk-users [[email protected]] Objet : Re: [mitk-users] Plugin event on slice navigator change Hello Hortense, To achieve that, I drew inspiration from MITK's "Image Navigator" plugin (org.mitk.gui.qt.imagenavigator). I made my plugin's class inherit from "mitk::IRenderWindowPartListener" (class PluginClass : public QmitkAbstractView, public mitk::IRenderWindowPartListener) To implement this interface you'll need to create both method stubs : void RenderWindowPartDeactivated(mitk::IRenderWindowPart *); void RenderWindowPartActivated(mitk::IRenderWindowPart *); You'll also need a "Refetch()" slot (from Qt), which is the one to receive "slice changed" event. On "PartActivated", you'll set-up connections : if ( !renderWindowPart ) return; QmitkRenderWindow* renderWindow = renderWindowPart->GetQmitkRenderWindow("axial"); if (!renderWindow) return; m_SNC = renderWindow->GetSliceNavigationController(); m_Adapter = new QmitkStepperAdapter(this, m_SNC->GetSlice(), "sliceNavigatorAxialFromSimpleExample"); // don't know if the name really matters. connect(m_Adapter, SIGNAL(Refetch()), this, SLOT(Refetch())); On "PartDeactivated", you'll need to remove connections, delete objects, etc. Fun part : it is inverted for the slice number. To find it, you had to dig inside "QmitkSliderNavigatorWidget". Resulting in : unsigned int numSlice = m_Stepper->GetSteps()-1u-m_Stepper->GetPos(); Good luck, Pierre-Yves Menguy. On 18 July 2014 15:11, Hortense KIRISLI <[email protected]<mailto:[email protected]>> wrote: Hi all, In a plugin, I have a method (taking the current slice index as input) that I would like to be executed on change of slice. I could not manage to understand how to do so, thus any hint on how I should specify this connection/listener would be appreciated! Best, Hortense ---- Hortense KIRISLI, PhD Research & Development Engineer AQUILAB Parc Eurasanté – Lille Métropole Bâtiment Hermès 250 rue Salvador Allende 59120 Loos Les Lille - France Tel. +33 3 69 61 51 65<tel:%2B33%203%2069%2061%2051%2065> www.aquilab.com<http://www.aquilab.com> [cid:[email protected]] ---- ------------------------------------------------------------------------------ Want fast and easy access to all the code in your enterprise? Index and search up to 200,000 lines of code with a free copy of Black Duck Code Sight - the same software that powers the world's largest code search on Ohloh, the Black Duck Open Hub! Try it now. http://p.sf.net/sfu/bds _______________________________________________ mitk-users mailing list [email protected]<mailto:[email protected]> https://lists.sourceforge.net/lists/listinfo/mitk-users ------------------------------------------------------------------------------ Download BIRT iHub F-Type - The Free Enterprise-Grade BIRT Server from Actuate! Instantly Supercharge Your Business Reports and Dashboards with Interactivity, Sharing, Native Excel Exports, App Integration & more Get technology previously reserved for billion-dollar corporations, FREE http://pubads.g.doubleclick.net/gampad/clk?id=157005751&iu=/4140/ostg.clktrk _______________________________________________ mitk-users mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/mitk-users ------------------------------------------------------------------------------ Download BIRT iHub F-Type - The Free Enterprise-Grade BIRT Server from Actuate! Instantly Supercharge Your Business Reports and Dashboards with Interactivity, Sharing, Native Excel Exports, App Integration & more Get technology previously reserved for billion-dollar corporations, FREE http://pubads.g.doubleclick.net/gampad/clk?id=157005751&iu=/4140/ostg.clktrk _______________________________________________ mitk-users mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/mitk-users
