From: vargas Date: Mon, 31 May 2010 13:16:40 +0000 (+0000) Subject: *** empty log message *** X-Git-Tag: CREATOOLS.2-0-3~14 X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=commitdiff_plain;h=532e76344aea0ee609187d05b871ddcb755f4d35;p=creaContours.git *** empty log message *** --- diff --git a/data/Icons/test.png b/data/Icons/test.png new file mode 100644 index 0000000..4084656 Binary files /dev/null and b/data/Icons/test.png differ diff --git a/lib/Interface_Icons_NDimensions/interfIOMenu.cxx b/lib/Interface_Icons_NDimensions/interfIOMenu.cxx index 762a16d..baee7dd 100644 --- a/lib/Interface_Icons_NDimensions/interfIOMenu.cxx +++ b/lib/Interface_Icons_NDimensions/interfIOMenu.cxx @@ -26,8 +26,9 @@ void interfIOMenu::initButtons(wxEvtHandler* evtHandler) { nom.push_back("Import an OSIRIX XML file with contours"); funct.push_back((wxObjectEventFunction) &interfIOMenu:: onImport); - //First step, include the image and the alternate text of the button. - //Obviously, a callback function must also be specified. + /****** ****** + ******* New Button ******* + ******* ******/ path.push_back(datadir + "/test.png"); nom.push_back("Performing a test on how to add a new button"); funct.push_back((wxObjectEventFunction) &interfIOMenu:: onTest); diff --git a/lib/Interface_Icons_NDimensions/interfMainPanel.cxx b/lib/Interface_Icons_NDimensions/interfMainPanel.cxx index fcf7d0d..f3e4129 100644 --- a/lib/Interface_Icons_NDimensions/interfMainPanel.cxx +++ b/lib/Interface_Icons_NDimensions/interfMainPanel.cxx @@ -35,6 +35,7 @@ interfMainPanel::interfMainPanel(wxWindow * parent, int sizex, int sizey, wxEvtH mirrorPanel = NULL; thresholdPanel = NULL; currentWindow = NULL; + testPanel = NULL; //CMRU 17-08-09 ------------------------------------------------------------------ infoPanelCalibration = NULL; @@ -439,7 +440,25 @@ void interfMainPanel::onImport(){ } void interfMainPanel::onTest(){ - wxContourMainFrame::getInstance()->onTest(); + if(testPanel==NULL) + { + testPanel = new wxPanel(interfMainPanel::getInstance()->getInfoPanel(), -1, wxDefaultPosition, + wxDefaultSize, wxBORDER_STATIC, wxString(_T(""))); + wxFlexGridSizer* flexsizer = new wxFlexGridSizer(1); + testPanel->SetSizer(flexsizer, true); + testPanel->SetAutoLayout( true ); + panelTest = new interfTestPanel(testPanel); + + wxStaticText* stattext = new wxStaticText(mirrorPanel, -1, + wxString(_T(" Test Panel ")), + wxDefaultPosition, wxDefaultSize, + wxALIGN_CENTRE|wxBORDER_SIMPLE|wxFULL_REPAINT_ON_RESIZE, wxString(_T(""))); + + flexsizer->Add(stattext,wxALIGN_CENTER | wxALIGN_CENTRE); + flexsizer->Add(panelTest, wxEXPAND); + testPanel->Layout(); + showPanel(testPanel); + } } void interfMainPanel::RefreshInterface() diff --git a/lib/Interface_Icons_NDimensions/interfMainPanel.h b/lib/Interface_Icons_NDimensions/interfMainPanel.h index bc57279..5881936 100644 --- a/lib/Interface_Icons_NDimensions/interfMainPanel.h +++ b/lib/Interface_Icons_NDimensions/interfMainPanel.h @@ -257,8 +257,13 @@ private: wxWindow* infoWin; wxPanel* informationPanel; + wxPanel *testPanel; + interfTestPanel *panelTest; + wxPanel* mirrorPanel; interfMirrorPanel* panelMirror; + + wxPanel* thresholdPanel; bool axisshown; diff --git a/lib/Interface_Icons_NDimensions/interfSegmentationPanels.cxx b/lib/Interface_Icons_NDimensions/interfSegmentationPanels.cxx index 04f8fd8..7e65d44 100644 --- a/lib/Interface_Icons_NDimensions/interfSegmentationPanels.cxx +++ b/lib/Interface_Icons_NDimensions/interfSegmentationPanels.cxx @@ -273,3 +273,36 @@ void interfMirrorPanel::onChangeWidth(wxScrollEvent& event) BEGIN_EVENT_TABLE(interfMirrorPanel, wxPanel) EVT_SCROLL(interfMirrorPanel :: onChangeWidth) END_EVENT_TABLE() + +////////////////////////////////////////////////////////////// + +interfTestPanel::interfTestPanel(wxWindow* parent) +: wxPanel(parent, -1, wxDefaultPosition, wxDefaultSize, wxBORDER_SUNKEN) +{ + wxButton *button1 = new wxButton(this,wxID_ANY,_T("Button 1"), wxDefaultPosition, wxSize(200,35) ); + wxButton *button2 = new wxButton(this,wxID_ANY,_T("Button 2"), wxDefaultPosition, wxSize(200,35) ); + + Connect( button1->GetId(), wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &interfTestPanel::onButton1Pressed ); + Connect( button2->GetId(), wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &interfTestPanel::onButton2Pressed ); + + wxFlexGridSizer * sizer = new wxFlexGridSizer(1); + sizer -> Add( button1, 1, wxGROW ); + sizer -> Add( button2, 1, wxGROW ); + + this->SetSizer( sizer ); + this->SetAutoLayout( true ); + this->Layout(); +} + +interfTestPanel::~interfTestPanel(){ +} + +void interfTestPanel::onButton1Pressed(wxCommandEvent& event) +{ + std::cout << "Button 1 has been pressed" << std::endl; +} + +void interfTestPanel::onButton2Pressed(wxCommandEvent& event) +{ + std::cout << "Button 2 has been pressed" << std::endl; +} \ No newline at end of file diff --git a/lib/Interface_Icons_NDimensions/interfSegmentationPanels.h b/lib/Interface_Icons_NDimensions/interfSegmentationPanels.h index ad0055a..a2e8cbf 100644 --- a/lib/Interface_Icons_NDimensions/interfSegmentationPanels.h +++ b/lib/Interface_Icons_NDimensions/interfSegmentationPanels.h @@ -100,6 +100,20 @@ private: DECLARE_EVENT_TABLE() }; +class interfTestPanel + : public wxPanel +{ +public: + interfTestPanel(wxWindow * parent); + ~interfTestPanel(); + +private: + void onButton1Pressed(wxCommandEvent& event); + + void onButton2Pressed(wxCommandEvent& event); + +}; + #endif diff --git a/lib/Interface_ManagerContour_NDimensions/wxContourMainFrame.cxx b/lib/Interface_ManagerContour_NDimensions/wxContourMainFrame.cxx index 1e6ff4c..83863e8 100644 --- a/lib/Interface_ManagerContour_NDimensions/wxContourMainFrame.cxx +++ b/lib/Interface_ManagerContour_NDimensions/wxContourMainFrame.cxx @@ -1008,20 +1008,14 @@ void wxContourMainFrame::onImport(){ } } - void wxContourMainFrame::onTest(){ std::string filename, filenamecontours; - wxFileDialog dialog(NULL, _T("Choose a XML Osirix File"), _T(""), _T(""), _T("*.xml"), wxOPEN ); + wxFileDialog dialog(NULL, _T("Choose a File"), _T(""), _T(""), _T("*.*"), wxOPEN ); if (dialog.ShowModal() == wxID_OK) { filename = dialog.GetPath().mb_str(); - filenamecontours = kernelManager->parseOsirixFile(filename); - - if(filenamecontours.compare("") != 0){ - onLoadContours(filenamecontours); - } - + std::cout << "This is the filename: " << filename << std::endl; } } diff --git a/lib/doxygen/TemplateHomeLibDoxygen.html b/lib/doxygen/TemplateHomeLibDoxygen.html index 7ae8258..4f32841 100644 --- a/lib/doxygen/TemplateHomeLibDoxygen.html +++ b/lib/doxygen/TemplateHomeLibDoxygen.html @@ -57,73 +57,74 @@ text-align: center; } -

General -Description

-

creaContours -is a C++ application developed by the CreaTools -software team. As such, it is contained within the CreaTools general -architecture. Its principal objective as a standalone -application is to let the user create flexible contour shapes over +

General +Description

+creaContours +is a C++ application developed by the CreaTools +software team. As such, it is contained within the CreaTools general +architecture. Its principal objective as a standalone +application is to let the user create flexiblecontour shapes over different kinds of images. The drawn contours can afterwards by used to -extract statistical information out of these images.

A gross approximation +extract statistical information out of these images.

A gross approximation of creaContours' general architectural distribution can be seen in this diagram. In short creaContours can be -thought of as being divided in three parts, each one of which will be explained and detailed in this document. 

+thought of as being divided in three parts, each one of which will be explained and detailed in this document. 
-

Table of Contents

Libraries

The first three sections of this guide shall be dedicated to the three main creaContours libraries:

+

Table of Contents

Libraries

The first three sections of this guide shall be dedicated to the three main creaContours libraries:

-

Tutorials

creaContours is continously evolving. Its development it's not yet finished and tha application sees new features being added to it on a regular basis. The tutorials give a rough idea of how to contribute to the development of -certain aspects of the application.
+certain aspects of the application.

-

Modules -Description

-

In this section, each module of +

Modules +Description

+

In this section, each module of creaContours is fleshed out through class, sequence and component diagrams. The objective is to provide as much useful information about each component as it is -possible.

+possible.

-
Interface_Icons_NDimensions_lib
+
Interface_Icons_NDimensions_lib



-
Interface_ManagerContour_NDimensions_lib
+
Interface_ManagerContour_NDimensions_lib
-
-
kernel_ManagerContour_NDimensions_lib
-
-

Tutorials

\ No newline at end of file diff --git a/lib/doxygen/bouml/GeneralArchitecture/GeneralArchitecture_HTML/classdiagrams.html b/lib/doxygen/bouml/GeneralArchitecture/GeneralArchitecture_HTML/classdiagrams.html new file mode 100644 index 0000000..5590a38 --- /dev/null +++ b/lib/doxygen/bouml/GeneralArchitecture/GeneralArchitecture_HTML/classdiagrams.html @@ -0,0 +1,22 @@ + + + + + + +Class Diagram Index + + + + + +
Class Diagram Index
+

+ + + + + +
GeneralArchitecture
+ + diff --git a/lib/doxygen/bouml/GeneralArchitecture/GeneralArchitecture_HTML/classes_list.html b/lib/doxygen/bouml/GeneralArchitecture/GeneralArchitecture_HTML/classes_list.html new file mode 100644 index 0000000..f124784 --- /dev/null +++ b/lib/doxygen/bouml/GeneralArchitecture/GeneralArchitecture_HTML/classes_list.html @@ -0,0 +1,24 @@ + + + + + + +Classes + + + + + +
Classes
+

+ + + + + + + +
+ + diff --git a/lib/doxygen/bouml/GeneralArchitecture/GeneralArchitecture_HTML/fig128002.png b/lib/doxygen/bouml/GeneralArchitecture/GeneralArchitecture_HTML/fig128002.png new file mode 100644 index 0000000..87ae100 Binary files /dev/null and b/lib/doxygen/bouml/GeneralArchitecture/GeneralArchitecture_HTML/fig128002.png differ diff --git a/lib/doxygen/bouml/GeneralArchitecture/GeneralArchitecture_HTML/index-withframe.html b/lib/doxygen/bouml/GeneralArchitecture/GeneralArchitecture_HTML/index-withframe.html new file mode 100644 index 0000000..45eb5a9 --- /dev/null +++ b/lib/doxygen/bouml/GeneralArchitecture/GeneralArchitecture_HTML/index-withframe.html @@ -0,0 +1,19 @@ + + + + + + +c:/VSProjets/creaContours/lib/doxygen/bouml/GeneralArchitecture/GeneralArchitecture_HTML/index-withframe + + + + + + + + + + +<H2>Frame Alert</H2><P>This document is designed to be viewed using the frames feature. If you see this message, you are using a non-frame-capable web client.<BR>Link to <A HREF="index.html">Non-frame version.</A> + diff --git a/lib/doxygen/bouml/GeneralArchitecture/GeneralArchitecture_HTML/index.html b/lib/doxygen/bouml/GeneralArchitecture/GeneralArchitecture_HTML/index.html new file mode 100644 index 0000000..5ce149b --- /dev/null +++ b/lib/doxygen/bouml/GeneralArchitecture/GeneralArchitecture_HTML/index.html @@ -0,0 +1,23 @@ + + + + + + +GeneralArchitecture +Documentation + + + + + +
GeneralArchitecture
Documentation
+

+ + + + +

+

GeneralArchitecture



+ + diff --git a/lib/doxygen/bouml/GeneralArchitecture/GeneralArchitecture_HTML/index_71.html b/lib/doxygen/bouml/GeneralArchitecture/GeneralArchitecture_HTML/index_71.html new file mode 100644 index 0000000..8ef324d --- /dev/null +++ b/lib/doxygen/bouml/GeneralArchitecture/GeneralArchitecture_HTML/index_71.html @@ -0,0 +1,23 @@ + + + + + + +G + + + + + +
G
+

+ + + + + + +
NameKindDescription
GeneralArchitectureclass diagram
+ + diff --git a/lib/doxygen/bouml/GeneralArchitecture/GeneralArchitecture_HTML/navig.html b/lib/doxygen/bouml/GeneralArchitecture/GeneralArchitecture_HTML/navig.html new file mode 100644 index 0000000..3254736 --- /dev/null +++ b/lib/doxygen/bouml/GeneralArchitecture/GeneralArchitecture_HTML/navig.html @@ -0,0 +1,17 @@ + + + + + + +c:/VSProjets/creaContours/lib/doxygen/bouml/GeneralArchitecture/GeneralArchitecture_HTML/navig + + + +


+

-Top- -Class Diagrams-

+

+

+

G

+ + diff --git a/lib/doxygen/bouml/GeneralArchitecture/GeneralArchitecture_HTML/style.css b/lib/doxygen/bouml/GeneralArchitecture/GeneralArchitecture_HTML/style.css new file mode 100644 index 0000000..3a10a81 --- /dev/null +++ b/lib/doxygen/bouml/GeneralArchitecture/GeneralArchitecture_HTML/style.css @@ -0,0 +1,30 @@ +div.title { font-size: 150%; background: #87ceff; text-align: center; font-weight: bold; } + +div.sub { margin-left : 20px; } +div.element { background: #d3d3d3; } + +h1.package { background: #ffe4c4; } +h1.view { background: #98fb98; } + +h2.package { background: #ffe4c4; } +h2.view { background: #98fb98; } +h2.class { background: #87ceff; } +h2.usecase { background: #87ceff; } +h2.state { background: #87ceff; } +h2.activity { background: #87ceff; } + +h3.package { background: #ffe4c4; } +h3.view { background: #98fb98; } +h3.class { background: #87ceff; } +h3.usecase { background: #87ceff; } +h3.state { background: #87ceff; } +h3.stateregion { background: #87ceff; } +h3.activity { background: #87ceff; } + +h4.package { background: #ffe4c4; } +h4.view { background: #98fb98; } +h4.class { background: #87ceff; } +h4.usecase { background: #87ceff; } +h4.state { background: #87ceff; } +h4.stateregion { background: #87ceff; } +h4.activity { background: #87ceff; } diff --git a/lib/doxygen/bouml/buttons/all_panels.png b/lib/doxygen/bouml/buttons/all_panels.png new file mode 100644 index 0000000..8431aa1 Binary files /dev/null and b/lib/doxygen/bouml/buttons/all_panels.png differ diff --git a/lib/doxygen/bouml/buttons/buttons.png b/lib/doxygen/bouml/buttons/buttons.png new file mode 100644 index 0000000..5eaedf2 Binary files /dev/null and b/lib/doxygen/bouml/buttons/buttons.png differ diff --git a/lib/doxygen/bouml/buttons/callback_action.png b/lib/doxygen/bouml/buttons/callback_action.png new file mode 100644 index 0000000..27512a4 Binary files /dev/null and b/lib/doxygen/bouml/buttons/callback_action.png differ diff --git a/lib/doxygen/bouml/buttons/callback_functions.png b/lib/doxygen/bouml/buttons/callback_functions.png new file mode 100644 index 0000000..72f1c4f Binary files /dev/null and b/lib/doxygen/bouml/buttons/callback_functions.png differ diff --git a/lib/doxygen/bouml/buttons/classes.png b/lib/doxygen/bouml/buttons/classes.png new file mode 100644 index 0000000..9df8457 Binary files /dev/null and b/lib/doxygen/bouml/buttons/classes.png differ diff --git a/lib/doxygen/bouml/buttons/code_add_button.png b/lib/doxygen/bouml/buttons/code_add_button.png new file mode 100644 index 0000000..2e29690 Binary files /dev/null and b/lib/doxygen/bouml/buttons/code_add_button.png differ diff --git a/lib/doxygen/bouml/buttons/file_selector_popsup.png b/lib/doxygen/bouml/buttons/file_selector_popsup.png new file mode 100644 index 0000000..03d4547 Binary files /dev/null and b/lib/doxygen/bouml/buttons/file_selector_popsup.png differ diff --git a/lib/doxygen/bouml/buttons/header_interfIOMenu.png b/lib/doxygen/bouml/buttons/header_interfIOMenu.png new file mode 100644 index 0000000..9cbdd4c Binary files /dev/null and b/lib/doxygen/bouml/buttons/header_interfIOMenu.png differ diff --git a/lib/doxygen/bouml/buttons/interfMainPanel.png b/lib/doxygen/bouml/buttons/interfMainPanel.png new file mode 100644 index 0000000..acbce20 Binary files /dev/null and b/lib/doxygen/bouml/buttons/interfMainPanel.png differ diff --git a/lib/doxygen/bouml/buttons/interfMainPanel_callback.png b/lib/doxygen/bouml/buttons/interfMainPanel_callback.png new file mode 100644 index 0000000..c3eecc1 Binary files /dev/null and b/lib/doxygen/bouml/buttons/interfMainPanel_callback.png differ diff --git a/lib/doxygen/bouml/buttons/interfMainPanel_newPanel.png b/lib/doxygen/bouml/buttons/interfMainPanel_newPanel.png new file mode 100644 index 0000000..b889251 Binary files /dev/null and b/lib/doxygen/bouml/buttons/interfMainPanel_newPanel.png differ diff --git a/lib/doxygen/bouml/buttons/interfMainPanel_onShowPanel.png b/lib/doxygen/bouml/buttons/interfMainPanel_onShowPanel.png new file mode 100644 index 0000000..5b13d62 Binary files /dev/null and b/lib/doxygen/bouml/buttons/interfMainPanel_onShowPanel.png differ diff --git a/lib/doxygen/bouml/buttons/interfMirrorPanel.png b/lib/doxygen/bouml/buttons/interfMirrorPanel.png new file mode 100644 index 0000000..0a5c9df Binary files /dev/null and b/lib/doxygen/bouml/buttons/interfMirrorPanel.png differ diff --git a/lib/doxygen/bouml/buttons/interfSegmentationPanels.png b/lib/doxygen/bouml/buttons/interfSegmentationPanels.png new file mode 100644 index 0000000..a00ed53 Binary files /dev/null and b/lib/doxygen/bouml/buttons/interfSegmentationPanels.png differ diff --git a/lib/doxygen/bouml/buttons/interfTestPanel.png b/lib/doxygen/bouml/buttons/interfTestPanel.png new file mode 100644 index 0000000..573106b Binary files /dev/null and b/lib/doxygen/bouml/buttons/interfTestPanel.png differ diff --git a/lib/doxygen/bouml/buttons/interfTestPanel_final.png b/lib/doxygen/bouml/buttons/interfTestPanel_final.png new file mode 100644 index 0000000..a17c207 Binary files /dev/null and b/lib/doxygen/bouml/buttons/interfTestPanel_final.png differ diff --git a/lib/doxygen/bouml/buttons/mirroring_panel.png b/lib/doxygen/bouml/buttons/mirroring_panel.png new file mode 100644 index 0000000..b948e47 Binary files /dev/null and b/lib/doxygen/bouml/buttons/mirroring_panel.png differ diff --git a/lib/doxygen/bouml/buttons/newPanel_newButtons.png b/lib/doxygen/bouml/buttons/newPanel_newButtons.png new file mode 100644 index 0000000..e897348 Binary files /dev/null and b/lib/doxygen/bouml/buttons/newPanel_newButtons.png differ diff --git a/lib/doxygen/bouml/buttons/new_button.html b/lib/doxygen/bouml/buttons/new_button.html index 10d857d..7eb3fc7 100644 --- a/lib/doxygen/bouml/buttons/new_button.html +++ b/lib/doxygen/bouml/buttons/new_button.html @@ -55,11 +55,11 @@ font-size: x-large; font-weight: bold; text-align: center; } - - -

Adding -a new button to creaContours

-After taking a quick look at creaContours' + + +

Adding +a new button to creaContours

+After taking a quick look at creaContours' interface, it's easy to agree that buttons are a very important part of it! Adding, editing and deleting contours; extracting statistical data; @@ -69,6 +69,173 @@ segmentation. All this is accomplished by pressing on the right button. For that purpose, a detailed how-to guide is included in this documentation alongside a sequence diagram that serves as an example of the process that takes place -once a button is pressed.


+once a button is pressed.
It +also details the process of displaying a panel, often used alongside +buttons to configure the different segmentation tools offered by +creaContours. Finally, a short tutorial on adding a new contour-drawing +button is included.

  1. Finding where to start. How to figure out where to start writing the code that will let you add a new button to creaContours.
  2. Adding the button. As soon as we've found the right place to start, we have to add the actual button. Here such process is detailed.
  3. The callback function. It's +not enough to add a new button; a functionality must be associated to +it. Here we describe how to create the callback function, which does +just that.
  4. The callback action. Once +the callback function is called, something must happen. To explain how +to assign a callback action to a button (and its respective function) +is the objective of this section.
  5. Button-click pipeline. The sequence diagram which shows the pipeline the program goes through when a button is clicked.
  6. Adding a panel. What +if the functionality associated to a button requires the user to +configure a few parameters? In that case, it could be useful to have a +panel. Here we show how to create and display one.

1. Finding where to start

Taking +a cursory look at creaContours' buttons panel, one can easily see that +its buttons are divided into categories: "New Contour" buttons, "I/O" +buttons, etc. This division of the interface is not arbitrary and +suggests that before creating a new button one has to decide into which +category it'll fit! Will it let the user perform a new kind of +segmentation? If yes, it must be added to the "Segmentation" +categories. Or will it permit the serial lecture of many contour .roi +files? Should it be that way, "I/O" is the place to go.

Image which shows creaContours' button panel, in which one can find all of the buttons that form the core of the application's functionality
Figure [1]. Button panel (creaContours).
As +soon as the correct placement of the button has been decided, the next +step is to write the necessary code so that it is correctly added to +the interface. Remembering that creaContours' +<link>architecture<link> is divided into three main +components, this would mean first identifying in which one of these the +modifcations have to be made.

kernel_ManagerContour_NDimensions_lib +is constituted by the building blocks of +<link>creaContours<link>. This is the where the most basic +classes of the application are and as such it's not the right place to +look. Interface_ManagerContour_NDimensions_lib +contains many visual elements and sembles to be a good choice to look +in. But in reality, this library deals with the creation and edition of +contours and the management of "main" interface. It is therefore a high +level representation of the interface. This leaves only one option...

Image which graphically displays the classes that are within the Interface_Icons_NDimensions_lib library
Figure [2]. Interface_Icon_NDimensions_lib, where new buttons are added
This +is clearly the right place! Each of the button panel's categories is +represented by a class, named accordingly: "interfIOMenu" is where the +buttons corresponding to the "I/O" category are. Having finally found +where to start, we must now choose which kind of button we want to +create so that we modify the appropriate class. Since the process is +similar for each category, we will choose an arbitrary one to +illustrate the process; "I/O" in this case.
Back to top

2. Adding the button

Now +that we have choosen which kind of button to add, we can take a good +look to the corresponding class. As we just said, we're going to add a +new "I/O" button. It is therefore in interfIOMenu where we have to look.

This image shows the code contained within the hader file of the interfIOMenu class
Figure [3]. Header file of interfIOMenu
Taking +a quick look a it we can identify the usual constructor/destructor pair +and a virtual "initButtons" method. Each class that represents a button +category must have implimented this virtual method, where all of the +buttons that belong to it have to be created and added. Other than +that, there is a method for each of the functions performed by each of +the category's button. In this case, "I/O" contains the Load, Save and +Import buttons and therefore there is a "On" method for each function. +These functions receive as parameters wxCommandEvent events. This basic +structure is replicated in each category class (interfSegmentationMenu, +interfToolsMenu, etc).

Hence, in order to add the new button we must go to the initButtons method in the .cxx.

Code where a new button is added to the category. The image also shows what's to be written when adding a new button.
Figure [4].  Where to add the new button.
As +we can see, adding a new button it's just a matter or replicating the +code that's been already written for the previous buttons. In this +case, we have added a new test button, underneath the big "New Button" +heading. In orther for this to work as expected, it's necessary to add +the button's image (in this case, test.png Image which is shown over the test button once it is sucessfully added to the interface) +to the data/Icons folder of the creaContours' CMake project. It's also +worth nothing that once a button is being added, its callback function +it's specified. In this case, it's the function OnTest, as shown in +Figure [4], which must also be added to the header file. If we go back +to it in Figure [3] we'll notice that it's already there.

If we +run the application now, we'll see that the button's been successfully +added to the interface. Finally, the callback function has to be +written!

3. The callback function

We now have a new button in our interface.
In this image we can see the original I/O buttons alongside the new test button
Figure [5]. The I/O buttons alongside the new test button.
It's +time to create a new callback function to associate a function to it. +For that purpose, we take a look at the existing callback functions.

Image which shows the code of the existing callback functions as well as that of the new callback function. The latter is marked in red.
Figure [6]. The callback functions for each of the buttons.
As +we can see, all that this function does is call the corresponding +callback function on the interfMainPanel class. This mean that there +we'll have to define at least one more callback function! The first +step is to find the interfMainPanel class header file +(interfMainPanel.h) and include a new function, "OnTest".

An image which shows how in the interfMainPanel class the callback functions are defined
Figure [7]. The callback functions in interfMainPanel.
By +principle, interfMainPanel is not a class where the "business logic" is +to be defined. It can be thought of as the agglomeration of the +different menu categories. We can thus expect the onLoad, onSave, +onImport and onTest functions to simply call another function on a +class where it's pertinent to perform the callback action. Taking a +look at the interfMainPanel.cxx file, we find out that this is +effectively the case.

An image that shows the piece of code where the interfMainPanel's callback function are defined (for the I/O menu category)
Figure [8].  The callback functions in the interfMainPanel class.
Once +again, we see that we have to go deeper into +<link>creaContours'<link> architecture. Each callback +function calls another function in another class, this time the +wxContourMainFrame class. But we're finally getting closer!

4. The callback action

Since +we must define a new callback function within wxContourMainFrame, it +goes without saying that it's declaration must be included in this +class' header file. Having done that, it's time to define the actual +callback function. Now, as wxContourMainFrame is where all callback +functions eventually end up, this is where the callback action has to +be defined. A callback action can be many things: opening a new window, +showing a new panel to configure the parameters of a segmentation (and +then execute it by pressing on the appropiate button) or drawing a new +contour. For this part of the example, we'll be satisfied by just +showing a File Selector window.

The code that shows the callback action code that's necessary so that a File Selector pops up when clicking on the button
Figure [9].  The callback action, opening a file selector window.
 And +that's it! Now, we have to run creaContours and click on the newly +created button... and the File Selector window will pop up!
Image which shows the file selector window being shown once one clicks on the newly created button
Figure [10]. The file selector window pops up!

5. Button-click pipeline (sequence diagram)

6. Adding a panel

It +must be said that a button that shows a file selector window is not +really the most interesting thing that can be done. By playing around +for a bit with creaContours' other buttons, we'll quickly notice that +many of them add small panels to the space underneath all the buttons. +These panels let the user configure the parameters of the function +associated to the button's he's pressed. These panels are particularly +important when doing segmentations. As one of creaContours' main +functions is to let the user segment the images he's working with, +knowing how to create a panel and use it afterwards it's very +important. This part of the guide deals precisely with this process.

We'll +start with the button that we just created, which causes a file +selector window to pop up. In order to add a panel to the window, we +follow the same process until the onTest method in interfMainPanel. +This is where the process starts to diverge as it is precisely in this +method where we'll create the panel and add it to the window.

However, before doing that, we have created the panel that we're going to add!

At this moment we can pose ourselves the questions: where exactly do we have to add this new panel? Let's take a look at Interface_Icons_NDimensions_lib, where all of creaContours' graphical elements are to be found:
Image which shows creaContours' graphical classes, with the panel classes being highlighted
Figure [11]. The panel classes highlighted
Clearly, +interfSegmentationPanels.cxx and interfToolsPanels.cxx are the two +files we have to take a look at! Intuitively, we know that the +prefix associated to each class (SegmentationPanels and ToolsPanels) +represents to which button category the panels belong to it. The former +are the panels that are displayed once we press on a segmentation +button; the latter are the panels that are displayed once we press on a +Tools button. For the purpose of this guide, we will assume that our +button is going to be a Segmentation Button and therefore the panel +associated to it will be added to interfSegmentationPanels.

As a +matter of fact, these two files have within them the definition of each +panel that makes part of each particular category. For example, if we +go to interfSegmentationPanels.cxx and examine which class definitions +are contained within it, we'll see that there's three, one for each +panel.

Image which shows that within the interfSegmentationPanels.cxx file there's 3 class definiotns
Figure [12]. The three classes inside the interfSegmentationPanel class
If +we know look at the interfSegmentationPanels.h file, we'll see that in +it there's a brief definition of each of the three aforementioned +classes. This is where we must start, then. To get an idea of how to +proceed, let's look at the class definition for interfMirrorPanel:
Fragment of code whiwh shows the definition of the interfMirrorPanel class
Figure [13]. The definition of the interfMirrorPanel class.
As +we can see, the class in itself it's not very complicated, but this is +also because the panel that it represents is fairly basic. Let's take a +quick look at it:
Image which shows the mirroring segmentation panel, in order to give the reader a rough idea of its graphical distribution
Figure [14]. The graphical distribution of the mirroring panel.
What +we're going to try to achieve in this guide is actually a very similar +panel; it'll have just two buttons, each one of which will have an +associated functionality. We must begin by writing down the class +definition of our new panel, that we'll name interfTestPanel. Following +the pattern shown above, we'll have:

Fragment of code showing the declaration of the new panel
Figure [15]. The declaration of the interfTestPanel class.
As +we can see, we have two methods, onButton1Pressed and onButton2Pressed, +which receive two wxCommandEvent& events. These are the callback +methods that are called once we click on a button.

Now that we have our class definition, we proceed to declare each method of our class.

The full declaration of the interfTestPanel class
Figure [16]. The declaration of the new interfTestPanel class
The +button callback methods, as we can see, do nothing in particular; they +just print into std::cout a message informing the use that the +respective button's been pressed. Inside the constructor, we create +both buttons as new wxButtons. These +take as parameters the panel into which they're going to be added, an +ID, a label, and a position. Explaining in detail these parameters (as +well as those used in the call to the wxPanel constructor) goes beyond the scope of this guide.

We associated an event to each button with the Connect method. In this case it's a wxEVT_COMMAND_BUTTON_CLICKED event. +Furthermore, each button has an associated callback function, which +must also be specified through the Connect method. The wxFlexGridSizer which is added immediately afterwards serves as a way to organize the elements on the interface.

Having +done that, we must now make sure that once we click on our button the +panel is added to the interface. In order to make sure of this, we have +to remember the "pipeline" that is followed when we click on a button. +This time around, we will folllow it all the way to the "onTest" method +in interfMainPanel, as it's +here that we have the necessary tools to display our new panel. Before +getting down to it, we have to add to new parameters to the interfMainPanel.h file:
Fragment of code which shows the new parameters added to an existing class so that the new panels can be created
Figure [17]. The declaration of the new panel parameters.
The first parameter is a regular wxPanel which will contain within it the actual interfTestPanel, which is the second parameter that's been added. As soon as we have them in our header file, we can go to the OnTest method and modify it so the panel is shown in the right place. Basing ourselves on the existing onMirrorPressed method, we get the following code which does exactly what we want it to:

Fragment of code which shows where the panel is actually shown
Figure [18]. The fragment of code that serves to show the new panel
What is done here is actually quite simple. The new testPanel (of object type wxPanel) +contains within it the panel where the actual test panel is going to be +added. In other words, this is where we will store an instance of the +space underneath  the buttons, represented as a panel. Having +created it, we further configure it before creating an instance of the +actual interfMirrorPanel.  This is added to the wxFlexGridSizer which in turn has been set as the testPanel's Sizer. It is why by doing so we're adding the interfMirrorPanel to +the space beneath the buttons, which is exactly what we wanted to do! +We end by adding a little bit of text (just for the purpose of staying +close to the other, already existing buttons) and we end by showing our +panel by invoking the showPanel method and passing it an instance of testPanel, which now contains within it the interfMirrorPanel.

If we now run the interface and click on the new button, we'll obtain the following result...
Image which shows the new panel and the buttons it contains, as well as the result that's printed out when you click on one of the buttons
Figure [19]. The resulting panel
Mission accomplished!
\ No newline at end of file diff --git a/lib/doxygen/bouml/buttons/new_button_added.png b/lib/doxygen/bouml/buttons/new_button_added.png new file mode 100644 index 0000000..1e2f145 Binary files /dev/null and b/lib/doxygen/bouml/buttons/new_button_added.png differ diff --git a/lib/doxygen/bouml/buttons/panels-highlighted.png b/lib/doxygen/bouml/buttons/panels-highlighted.png new file mode 100644 index 0000000..6ad787a Binary files /dev/null and b/lib/doxygen/bouml/buttons/panels-highlighted.png differ diff --git a/lib/doxygen/bouml/buttons/test.png b/lib/doxygen/bouml/buttons/test.png new file mode 100644 index 0000000..4084656 Binary files /dev/null and b/lib/doxygen/bouml/buttons/test.png differ