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]>
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
>
> www.aquilab.com
>
>
>
> [image: AQUILAB]
>
> ----
>
>
>
>
> ------------------------------------------------------------------------------
> 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]
> https://lists.sourceforge.net/lists/listinfo/mitk-users
>
>
------------------------------------------------------------------------------
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]
https://lists.sourceforge.net/lists/listinfo/mitk-users

Reply via email to