Hi Aida,

        You can try the following in your WidgetCollective:

        if ( GetPluginTab() )
        {
                Core::Widgets::PluginTab* pluginTab = GetPluginTab( );
                wxWindow* workingArea = pluginTab->GetWorkingAreaManager(
)->GetActiveWorkingArea();

                Core::Widgets::RenderWindowContainer* container;
                container =
dynamic_cast<Core::Widgets::RenderWindowContainer*> ( workingArea );

                if ( container && container->GetWindow( 0 ) )
                {
                        Core::Widgets::RenderWindowBase* renWindow =
container->GetWindow( 0 );
                        renWindow->GetMetadata()->AddTag( "LayoutType",
int(mitk::Single2D_Z ) );
                        renWindow->GetMetadataHolder( )->NotifyObservers( );
                }
        }


Best,
Xavi

From: Aida Ninyerola [mailto:[email protected]] 
Sent: miércoles, 27 de julio de 2011 18:13
To: Xavier Planes
Cc: [email protected]
Subject: Re: [Gimias-developers] working area

Hi, 

I was trying to do the change of layout when the plugin tab is loaded by
taking by example the DicomPlugin.
But I am not sure about what part of the code is the one I have to take a
look. I have seen that it calls the WorkingAreaPanelWidget which I found in
DicomWorkingAreaPanelWidget.h, but I'm not sure if is this. I don't know
excactly what to do.

Can you tell what to take as example?

Thank you very much!
Aida
2011/7/25 Xavier Planes <[email protected]>
Hi Aida,

       This feature you are asking is not supported by GIMIAS Framework.
However, you can achieve this feature, accessing to wxWidgets controls. To
change the working area layout when the user changes the plugin tab page,
you need to handle the event fired by the plugin tab wxWidgets control.
These are the steps you need to follow in order to handle this event:

       1. The Plugin Tab page is created calling this line of code:

Core::Runtime::Kernel::GetGraphicalInterface()->CreatePluginTab( "Scene
View" );

       2. To retrieve the plugin tab you need to call this function from
your WidgetCollective and cast it to a wxWindow pointer:
               Core::Widgets::PluginTab* pluginTab = GetPluginTab( ).

       4. Once you have a wxWindow*, you can add a new Handler that can
handle the event fired when the user changes the tab page. The default
handler is in the wxMitkCoreMainWindow class:
               EVT_AUINOTEBOOK_PAGE_CHANGED(wxID_TabContainer,
wxMitkCoreMainWindow::OnPageChanged)

       5. To add a new handler to a wxWindow, you can take a look at
DICOMPlugin. The class DicomMenuEventHandler is a wxEvtHandler that handles
the events from the main menu before the event is processed by the main
menu. To add a new handler to a wxWindow, you can take a look at
WorkingAreaPanelWidget class of DICOMPlugin:
               m_DicomMenuEventHandler = new DicomMenuEventHandler( this );
               mainWindow->PushEventHandler( m_DicomMenuEventHandler );

       If you find any problem, please ask me again.

Best,
Xavi


From: Aida Ninyerola [mailto:[email protected]]
Sent: sábado, 23 de julio de 2011 19:54
To: Xavier Planes
Cc: [email protected]
Subject: Re: [Gimias-developers] working area

Hi,

Yes, I solved the problem but I don't get the result I wanted.
Now it changes the view when I open the widget. What I wanted is to change
the view when I select the plugin before selecting the widget. I tried to
find the function enable in the plugin.cxx but there is not this function.
It is posible to achieve what I want?

Thanks!
Aida
2011/7/22 Xavier Planes <[email protected]>
Hi Aida,
 
                Enable function is called at initialization with the value
enable == false. Could you try to change layout only when enable is true?
 
                If this doesn’t work, could you give me more details about
the error you get?
 
Thanks!
Xavi
 
From: Aida Ninyerola [mailto:[email protected]]
Sent: viernes, 22 de julio de 2011 14:36

To: Xavier Planes
Cc: [email protected]
Subject: Re: [Gimias-developers] working area
 
Hi,

I've used the Enable function like this:

bool ReconstructionPlugin::ReconstructionPanelWidget::Enable( bool enable
/*= true */ )
{
    bool bReturn = ReconstructionPluginReconstructionPanelWidgetUI::Enable(
enable );

    GetMultiRenderWindow()->GetMetadata()->AddTag( "LayoutType",
int(mitk::Single2D_Z ) );
    GetMultiRenderWindow()->GetMetadataHolder( )->NotifyObservers( );

    // If this panel widget is selected -> Update the widget
    if ( enable )
    {
        UpdateWidget();
    }

    return bReturn;
}

I don't know if I've missed something because I doesn't work.

Thanks!
Aida
2011/7/22 Xavier Planes <[email protected]>
Hi Aida,
 
                Can you try to set it at Enable() function? You need to
overwrite it from parent class and call the parent Enable() function.
 
                Enable will be called when the widget is shown in the plugin
tab.
 
Best,
Xavi
 
From: Aida Ninyerola [mailto:[email protected]]
Sent: jueves, 21 de julio de 2011 17:58
To: Xavier Planes
Cc: [email protected]
Subject: Re: [Gimias-developers] working area
 
Thank you, it worked!

But I have another problem. I would like to have the working area in the
Single2D_Z view at the begining of my process. I thought that the procces
OnInit would be useful for this purpose, but I get an error.
Can you tell me where can I put the view I want my plugin begin?

Thank you very much,
Aida
2011/7/20 Xavier Planes <[email protected]>
Hi Aida!

       You can change the layout of the selected render window calling
these functions:
       #include "wxMitkMultiRenderWindowLayout.h"

       GetMultiRenderWindow()->GetMetadata()->AddTag( "LayoutType", int(
mitk::Single2D_X ) );
       GetMultiRenderWindow()->GetMetadataHolder( )->NotifyObservers( );

Best,
Xavi

From: Aida Ninyerola [mailto:[email protected]]
Sent: miércoles, 20 de julio de 2011 13:13
To: [email protected]
Subject: [Gimias-developers] working area

Hi,

I would like to change the views of the working area during my process. At
first I have one image that I only want to view in the X axis view. After
processing the image, I want to show the result with the tres axis view and
3D (as I have it now). I hope I've explained myself correctly.
How can I achieve that? Is there any example that I can follow?

Thank you very much,
Aida
 
 




------------------------------------------------------------------------------
Got Input?   Slashdot Needs You.
Take our quick survey online.  Come on, we don't ask for help often.
Plus, you'll get a chance to win $100 to spend on ThinkGeek.
http://p.sf.net/sfu/slashdot-survey
_______________________________________________
Gimias-developers mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/gimias-developers

Reply via email to