]> Creatis software - creaContours.git/blob - lib/Interface_Icons_NDimensions/interfMainPanel.cxx
#3145 creaContours Bug New Normal - changeWx28to30
[creaContours.git] / lib / Interface_Icons_NDimensions / interfMainPanel.cxx
1 /*# ---------------------------------------------------------------------
2 #
3 # Copyright (c) CREATIS (Centre de Recherche en Acquisition et Traitement de l'Image
4 #                        pour la Sant�)
5 # Authors : Eduardo Davila, Frederic Cervenansky, Claire Mouton
6 # Previous Authors : Laurent Guigues, Jean-Pierre Roux
7 # CreaTools website : www.creatis.insa-lyon.fr/site/fr/creatools_accueil
8 #
9 #  This software is governed by the CeCILL-B license under French law and
10 #  abiding by the rules of distribution of free software. You can  use,
11 #  modify and/ or redistribute the software under the terms of the CeCILL-B
12 #  license as circulated by CEA, CNRS and INRIA at the following URL
13 #  http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html
14 #  or in the file LICENSE.txt.
15 #
16 #  As a counterpart to the access to the source code and  rights to copy,
17 #  modify and redistribute granted by the license, users are provided only
18 #  with a limited warranty  and the software's author,  the holder of the
19 #  economic rights,  and the successive licensors  have only  limited
20 #  liability.
21 #
22 #  The fact that you are presently reading this means that you have had
23 #  knowledge of the CeCILL-B license and that you accept its terms.
24 # ------------------------------------------------------------------------ */
25
26 #include "interfMainPanel.h"
27
28
29 interfMainPanel* interfMainPanel::interfmainpanel=NULL;
30 wxFrame* interfMainPanel::_newframe=NULL;
31
32 interfMainPanel::interfMainPanel(wxWindow * parent, int sizex, int sizey, wxEvtHandler * evtHandler, std::string datadir)
33 : wxPanel(parent, -1, wxDefaultPosition, wxSize(sizex, sizey), wxBORDER_SUNKEN)
34 {
35 printf("EED interfMainPanel::interfMainPanel Start\n");
36         PANEL                                   = "New Contour";
37         PANEL1                                  = "I/O";
38         PANEL2                                  = "Edit";
39         PANEL3                                  = "Delete";
40         PANEL4                                  = "Contour Tools";
41         PANEL5                                  = "Segmentation";
42 //EED 07/07/2010
43         PANEL6                                  = "Image Tools";
44
45         segmentPanel                    = NULL;
46         segmentPanelITK                 = NULL;
47         configPanel                             = NULL;
48         spreadPanel                             = NULL;
49         infoWin                                 = NULL;
50         infoPanel                               = NULL;
51         infoPanelMask                   = NULL;
52         informationPanel                = NULL;
53         mirrorPanel                             = NULL;
54         thresholdPanel                  = NULL;
55         colorImageLayerPanel    = NULL;
56         currentWindow                   = NULL;
57         testPanel                               = NULL;
58         flipPanel                               = NULL;
59
60 //CMRU 17-08-09 ------------------------------------------------------------------
61         infoPanelCalibration = NULL;
62         panelAux = NULL;
63 //--------------------------------------------------------------------------------
64         splitterwindow = new wxSplitterWindow(this,-1, wxDefaultPosition, wxSize(sizex, sizey), wxSP_3DSASH, wxString(_T("")));
65
66         splitterwindow->SetMinimumPaneSize( 10 );
67         sizey = sizey/8;
68
69         wxPanel* toolpanel = new wxPanel(splitterwindow, -1, wxDefaultPosition, wxDefaultSize, wxBORDER_DOUBLE, wxString(_T("")));
70
71 //EED 2017-09-16 Migration wxWidgets 2.8 to 3.0
72 #if wxMAJOR_VERSION <= 2
73         wxFlexGridSizer* flexsizer = new wxFlexGridSizer(6,2,1,1);
74 #else
75         wxFlexGridSizer* flexsizer = new wxFlexGridSizer(6);
76 #endif
77         toolpanel->SetSizer(flexsizer, true);
78         toolpanel->SetAutoLayout( true );
79
80         wxButton* b = getButton(toolpanel);
81         b->SetClientData(&PANEL);
82         wxButton* b1 = getButton(toolpanel);
83         b1->SetClientData(&PANEL1);
84         wxButton* b2 = getButton(toolpanel);
85         b2->SetClientData(&PANEL2);
86         wxButton* b3 = getButton(toolpanel);
87         b3->SetClientData(&PANEL3);
88         wxButton* b4 = getButton(toolpanel);
89         b4->SetClientData(&PANEL4);
90         wxButton* b5 = getButton(toolpanel);
91         b5->SetClientData(&PANEL5);
92 //EED 07/07/2010
93         wxButton* b6 = getButton(toolpanel);
94         b6->SetClientData(&PANEL6);
95
96         wxPanel* mentex  = new wxPanel(toolpanel, -1, wxDefaultPosition, wxDefaultSize, wxBORDER_NONE, wxString(_T("")));
97         wxPanel* mentex1 = new wxPanel(toolpanel, -1, wxDefaultPosition, wxDefaultSize, wxBORDER_NONE, wxString(_T("")));
98         wxPanel* mentex2 = new wxPanel(toolpanel, -1, wxDefaultPosition, wxDefaultSize, wxBORDER_NONE, wxString(_T("")));
99         wxPanel* mentex3 = new wxPanel(toolpanel, -1, wxDefaultPosition, wxDefaultSize, wxBORDER_NONE, wxString(_T("")));
100         wxPanel* mentex4 = new wxPanel(toolpanel, -1, wxDefaultPosition, wxDefaultSize, wxBORDER_NONE, wxString(_T("")));
101         wxPanel* mentex5 = new wxPanel(toolpanel, -1, wxDefaultPosition, wxDefaultSize, wxBORDER_NONE, wxString(_T("")));
102 //EED 07/07/2010
103         wxPanel* mentex6 = new wxPanel(toolpanel, -1, wxDefaultPosition, wxDefaultSize, wxBORDER_NONE, wxString(_T("")));
104
105         menubar  = new interfNewContourMenu  (mentex,  sizex, sizey, evtHandler, datadir);
106         menubar1 = new interfIOMenu          (mentex1, sizex, sizey, evtHandler, datadir);
107         menubar2 = new interfEditMenu        (mentex2, sizex, sizey, evtHandler, datadir);
108         menubar3 = new interfDeleteMenu      (mentex3, sizex, sizey, evtHandler, datadir);
109         menubar4 = new interfToolsMenu       (mentex4, sizex ,sizey, evtHandler, datadir);
110         menubar5 = new interfSegmentationMenu(mentex5, sizex, sizey, evtHandler, datadir);
111         menubar6 = new interfImageToolsMenu(mentex6, sizex, sizey, evtHandler, datadir);
112
113         statictext  = getText(mentex,  PANEL);
114         statictext1 = getText(mentex1, PANEL1);
115         statictext2 = getText(mentex2, PANEL2);
116         statictext3 = getText(mentex3, PANEL3);
117         statictext4 = getText(mentex4, PANEL4);
118         statictext5 = getText(mentex5, PANEL5);
119         statictext6 = getText(mentex6, PANEL6);
120
121         flexsizer->Add(b, wxFIXED_MINSIZE);
122         flexsizer->Add(setMenuTextSizer(mentex, menubar,statictext), wxFIXED_MINSIZE);
123
124         flexsizer->Add(b1, wxFIXED_MINSIZE);
125         flexsizer->Add(setMenuTextSizer(mentex1, menubar1,statictext1), wxFIXED_MINSIZE);
126
127         flexsizer->Add(b2, wxFIXED_MINSIZE);
128         flexsizer->Add(setMenuTextSizer(mentex2, menubar2,statictext2), wxFIXED_MINSIZE);
129
130         flexsizer->Add(b3, wxFIXED_MINSIZE);
131         flexsizer->Add(setMenuTextSizer(mentex3, menubar3,statictext3), wxFIXED_MINSIZE);
132
133         flexsizer->Add(b4, wxFIXED_MINSIZE);
134         flexsizer->Add(setMenuTextSizer(mentex4, menubar4,statictext4), wxFIXED_MINSIZE);
135
136         flexsizer->Add(b5, wxFIXED_MINSIZE);
137         flexsizer->Add(setMenuTextSizer(mentex5, menubar5,statictext5), wxFIXED_MINSIZE);
138         flexsizer->Add(b6, wxFIXED_MINSIZE);
139         flexsizer->Add(setMenuTextSizer(mentex6, menubar6,statictext6), wxFIXED_MINSIZE);
140
141         toolpanel->Update();
142         toolpanel->Layout();
143
144         infoPanel = new wxPanel(splitterwindow, -1, wxDefaultPosition, wxDefaultSize, wxBORDER_DOUBLE, wxString(_T("")));
145         wxFlexGridSizer* infosizer = new wxFlexGridSizer(1,1,2,2);
146         infoPanel->SetSizer(infosizer, true);
147         infoPanel->SetAutoLayout( true );
148
149         splitterwindow->Initialize(toolpanel);
150         splitterwindow->SetSashGravity(1);
151 //EED   splitterwindow->SetSashPosition(600);
152         splitterwindow->SetSashSize(5);
153         splitterwindow->SplitHorizontally(toolpanel, infoPanel,8*73);
154
155         Connect(b->GetId(),  wxEVT_COMMAND_BUTTON_CLICKED, (wxObjectEventFunction)&interfMainPanel::onActionButtonPressed1);
156         Connect(b1->GetId(), wxEVT_COMMAND_BUTTON_CLICKED, (wxObjectEventFunction)&interfMainPanel::onActionButtonPressed1);
157         Connect(b2->GetId(), wxEVT_COMMAND_BUTTON_CLICKED, (wxObjectEventFunction)&interfMainPanel::onActionButtonPressed1);
158         Connect(b3->GetId(), wxEVT_COMMAND_BUTTON_CLICKED, (wxObjectEventFunction)&interfMainPanel::onActionButtonPressed1);
159         Connect(b4->GetId(), wxEVT_COMMAND_BUTTON_CLICKED, (wxObjectEventFunction)&interfMainPanel::onActionButtonPressed1);
160         Connect(b5->GetId(), wxEVT_COMMAND_BUTTON_CLICKED, (wxObjectEventFunction)&interfMainPanel::onActionButtonPressed1);
161         Connect(b6->GetId(), wxEVT_COMMAND_BUTTON_CLICKED, (wxObjectEventFunction)&interfMainPanel::onActionButtonPressed1);
162
163         this->Layout();
164 printf("EED interfMainPanel::interfMainPanel End\n");
165 }
166
167 interfMainPanel::~interfMainPanel(void)
168 {
169
170 }
171
172 interfMainPanel* interfMainPanel::getInstance(wxWindow* parent, std::string datadir, wxEvtHandler * evtHandler)
173 {
174         _newframe = new wxFrame(parent, -1, wxT(" Contour Tools "), wxPoint(25,50), wxSize(350,900),wxFRAME_TOOL_WINDOW|wxSYSTEM_MENU | wxCAPTION |  wxCLIP_CHILDREN |wxFRAME_FLOAT_ON_PARENT);
175
176         if(interfmainpanel == NULL){
177                 interfmainpanel = new interfMainPanel(_newframe, 350, 900, evtHandler, datadir);
178         }
179         _newframe->Show(TRUE);
180         return interfmainpanel;
181 }
182
183 interfMainPanel* interfMainPanel::getInstance(wxWindow* parent, wxEvtHandler * evtHandler)
184 {
185
186         _newframe = new wxFrame(parent, -1, wxT(" Contour Tools "), wxPoint(25,50), wxSize(350,900),wxFRAME_TOOL_WINDOW|wxSYSTEM_MENU | wxCAPTION |  wxCLIP_CHILDREN |wxFRAME_FLOAT_ON_PARENT );
187
188         if(interfmainpanel == NULL){
189                 interfmainpanel = new interfMainPanel(_newframe, 350, 900, evtHandler);
190         }
191         _newframe->Show(TRUE);
192         return interfmainpanel;
193 }
194
195 bool interfMainPanel::Show(bool show)
196 {
197         return _newframe->Show(show);
198 }
199
200 interfMainPanel* interfMainPanel::getInstance()
201 {
202         return interfmainpanel;
203 }
204
205 void interfMainPanel :: resetInstance()
206 {
207         //delete interfmainpanel;
208         delete _newframe;
209         interfmainpanel = NULL;
210 }
211
212 wxPanel* interfMainPanel::initializeToolsPanel(wxWindow* parent, int sizex, int sizey, wxEvtHandler * evtHandler)
213 {
214         wxPanel* panel = new wxPanel(parent, -1, wxDefaultPosition, wxSize(sizex, sizey), wxBORDER_SUNKEN, wxString(_T("Spread")));
215
216         wxFlexGridSizer* flexsizer = new wxFlexGridSizer(2,1,2,2)       ;
217         panel->SetSizer(flexsizer, true);
218         panel->SetAutoLayout( true );
219
220         interfToolsMenu* menu = new interfToolsMenu(panel, sizex, sizey, evtHandler);
221         toolspread = new interfToolsSpreadPanel(panel, sizex, 300, evtHandler);
222
223         flexsizer->Add(menu, wxFIXED_MINSIZE);
224         flexsizer->Add(toolspread, wxFIXED_MINSIZE);
225
226         panel->Layout();
227
228         return panel;
229 }
230
231 /**
232 **      Adds a new checkbox to the scrolledwindow using the checkboxsizer
233 **      @Params id of contour
234 **
235 **/
236 void interfMainPanel::addContourCheckBox(std::string id)
237 {
238         toolspread->addContourCheckBox(id);
239 }
240
241 /**
242 **      Removes a checkbox from the list of checkboxes in the flexsizer (checkboxsizer)
243 **      @Params id of contour
244 **
245 **/
246 void interfMainPanel::removeContourCheckBox(std::string id)
247 {
248         toolspread->removeContourCheckBox(id);
249 }
250
251 void interfMainPanel::onActionButtonPressed1( wxCommandEvent& event )
252 {
253         //((interfToolsMenu*)menubar4)->hideAxis();
254         wxButton* b = (wxButton*)event.GetEventObject();
255         wxPanel* dmenu;
256         wxStaticText* text;
257         std::string dstring = *((std::string*) b->GetClientData());
258         int sizechange=0;
259
260         if(dstring.compare(PANEL)==0){
261                 dmenu = menubar;
262                 text = statictext;
263         }else if(dstring.compare(PANEL1)==0 ){
264                 dmenu = menubar1;
265                 text = statictext1;
266         }else if(dstring.compare(PANEL2)==0){
267                 dmenu = menubar2;
268                 text = statictext2;
269         }else if(dstring.compare(PANEL3)==0){
270                 dmenu = menubar3;
271                 text = statictext3;
272         }else if(dstring.compare(PANEL4)==0){
273                 dmenu = menubar4;
274                 text = statictext4;
275         }else if(dstring.compare(PANEL5)==0){
276                 dmenu = menubar5;
277                 text = statictext5;
278         }else if(dstring.compare(PANEL6)==0){
279                 dmenu = menubar6;
280                 text = statictext6;
281         }
282
283         if(wxStrcmp(b->GetLabel(),_T("+"))==0 ){
284                 dmenu->Show(true);
285                 sizechange = 1;
286                 b->SetLabel(_T("-"));
287         }else{
288                 dmenu->Show(false);
289                 sizechange = -1;
290                 b->SetLabel(_T("+"));
291         }
292
293         sizechange *= (dmenu->GetSize().GetHeight()-10);
294         splitterwindow->SetSashPosition(splitterwindow->GetSashPosition()+sizechange);
295
296         this->Layout();
297         this->Refresh();
298 }
299
300 wxStaticText* interfMainPanel::getText(wxWindow* parent, std::string nom)
301 {
302         return new wxStaticText(parent, -1, wxString(nom.c_str(),wxConvUTF8), wxDefaultPosition,
303                                         wxDefaultSize, wxALIGN_CENTRE, wxString(nom.c_str(),wxConvUTF8));
304 }
305
306 wxButton* interfMainPanel::getButton(wxWindow* parent)
307 {
308         wxButton* b = new wxButton(parent, -1, wxString(_T("-")), wxDefaultPosition, wxDefaultSize, wxBU_EXACTFIT,
309                                         wxDefaultValidator, wxString(_T("-")));
310         return b;
311 }
312
313 wxPanel* interfMainPanel::setMenuTextSizer(wxWindow* parent, wxPanel* panel, wxStaticText* text)
314 {
315
316         wxFlexGridSizer* flexsizer = new wxFlexGridSizer(2,1,2,2);
317         parent->SetSizer(flexsizer, true);
318         parent->SetAutoLayout( true );
319
320         flexsizer->Add(text, wxFLEX_GROWMODE_ALL);
321         flexsizer->Add(panel, wxFLEX_GROWMODE_ALL);
322
323         parent->Layout();
324         return (wxPanel*)parent;
325 }
326
327 /**
328 **      Shows the panel in the
329 **/
330 void interfMainPanel::showPanel(wxWindow* panel)
331 {
332         wxContourMainFrame::getInstance()->showAxis(false);
333         wxSizer* sizer = infoPanel->GetSizer();
334
335         if(currentWindow != NULL){
336                 currentWindow->Hide();
337                 /// \TODO fix warning: virtual bool wxSizer::Remove(wxWindow*) is deprecated 
338 //EED 2017-09-16 Migration wxWidgets 2.8 to 3.0
339 #if wxMAJOR_VERSION <= 2
340                 sizer->Remove(currentWindow);
341 #else
342                 sizer->Detach(currentWindow);
343 #endif
344
345         }
346         sizer->Add(panel);
347         currentWindow = panel;
348         currentWindow->Show(true);
349
350         splitterwindow->SetSashPosition(splitterwindow->GetSashPosition()+1);
351         splitterwindow->SetSashPosition(splitterwindow->GetSashPosition()-1);
352
353         infoPanel->Layout();
354         infoPanel->Refresh();
355         this->Layout();
356         this->Refresh();
357 }
358
359 /**
360 **      Hide the panel in the lower box
361 **/
362 void interfMainPanel::hidePanel( )
363 {
364         wxContourMainFrame::getInstance()->showAxis(false);
365         wxSizer* sizer = infoPanel->GetSizer();
366
367         if(currentWindow != NULL){
368                 currentWindow->Hide();
369                 /// \TODO fix warning: virtual bool wxSizer::Remove(wxWindow*) is deprecated 
370 //EED 2017-09-16 Migration wxWidgets 2.8 to 3.0
371 #if wxMAJOR_VERSION <= 2
372                 sizer->Remove(currentWindow);
373 #else
374                 sizer->Detach(currentWindow);
375 #endif
376
377         }
378         wxPanel * emptyPanel = new wxPanel(interfMainPanel::getInstance()->getInfoPanel(), -1, wxDefaultPosition, wxDefaultSize, wxBORDER_STATIC, wxString(_T("")));
379         sizer->Add(emptyPanel);
380         currentWindow = emptyPanel;
381         currentWindow->Show(true);
382
383         splitterwindow->SetSashPosition(splitterwindow->GetSashPosition()+1);
384         splitterwindow->SetSashPosition(splitterwindow->GetSashPosition()-1);
385
386         infoPanel->Layout();
387         infoPanel->Refresh();
388         this->Layout();
389         this->Refresh();
390 }
391
392 /**
393 **      Gets the Information panel
394 **/
395 wxPanel* interfMainPanel::getInfoPanel()
396 {
397         return infoPanel;
398 }
399
400 void interfMainPanel::onCreateContourSpline( )
401 {
402         wxContourMainFrame::getInstance()->showAxis(false);
403         wxContourMainFrame::getInstance()->onCreateContourSpline();
404 }
405
406 void interfMainPanel::onCreateContourRectangle( )
407 {
408         wxContourMainFrame::getInstance()->showAxis(false);
409     wxContourMainFrame::getInstance()->onCreateContourRectangle();
410 }
411 void interfMainPanel::onCreateContourCircle( )
412 {
413         wxContourMainFrame::getInstance()->showAxis(false);
414     wxContourMainFrame::getInstance()->onCreateContourCircle();
415 }
416
417 void interfMainPanel::onCreateContourLine( )
418 {
419         wxContourMainFrame::getInstance()->showAxis(false);
420     wxContourMainFrame::getInstance()->onCreateContourLine();
421 }
422
423 // RaC 09-09 ---------------------
424 void interfMainPanel::onCreateContourPoints( )
425 {
426         wxContourMainFrame::getInstance()->showAxis(false);
427     wxContourMainFrame::getInstance()->onCreateContourPoints();
428 }
429 // RaC 09-09 ---------------------
430
431 // RaC 10-09 ---------------------
432 void interfMainPanel::onCreateContourPolygon( )
433 {
434         wxContourMainFrame::getInstance()->showAxis(false);
435     wxContourMainFrame::getInstance()->onCreateContourPolygon();
436 }
437 // RaC 10-09 ---------------------
438
439 void interfMainPanel::onCreateContoursBullEye(wxPanel* panBull)
440 {
441         wxContourMainFrame::getInstance()->showAxis(false);
442         wxContourMainFrame::getInstance()->onCreateContourBullEye(panBull);
443 }
444
445 void interfMainPanel::onDeleteContour()
446 {
447         wxContourMainFrame::getInstance()->showAxis(false);
448         wxContourMainFrame::getInstance()->onDeleteContour();
449 }
450
451 void interfMainPanel::onDeleteContoursActSlice()
452 {
453         wxContourMainFrame::getInstance()->showAxis(false);
454         wxContourMainFrame::getInstance()->onDeleteContoursActSlice();
455 }
456
457 void interfMainPanel::onDeleteAllContours()
458 {
459         wxContourMainFrame::getInstance()->showAxis(false);
460         wxContourMainFrame::getInstance()->onDeleteAllContours();
461 }
462
463 void interfMainPanel::onCopy()
464 {
465         wxContourMainFrame::getInstance()->onCopy();
466 }
467
468 void interfMainPanel::onPaste()
469 {
470         wxContourMainFrame::getInstance()->onPaste();
471 }
472
473 void interfMainPanel::onUndo()
474 {
475         wxContourMainFrame::getInstance()->onUndo();
476 }
477
478 void interfMainPanel::onRedo()
479 {
480         wxContourMainFrame::getInstance()->onRedo();
481 }
482
483 void interfMainPanel::onLoad()
484 {
485         wxContourMainFrame::getInstance()->onLoad();
486 }
487
488 void interfMainPanel::onSave()
489 {
490         wxContourMainFrame::getInstance()->onSave();
491 }
492
493 void interfMainPanel::onImport()
494 {
495         wxContourMainFrame::getInstance()->onImport();
496 }
497
498 void interfMainPanel::onTest()
499 {
500         printf("EED interfMainPanel::onTest \n");
501         if(testPanel==NULL)
502         {
503                 testPanel = new wxPanel(interfMainPanel::getInstance()->getInfoPanel(), -1, wxDefaultPosition,
504                         wxDefaultSize, wxBORDER_STATIC, wxString(_T("")));
505                 wxFlexGridSizer* flexsizer = new wxFlexGridSizer(1);
506                 testPanel->SetSizer(flexsizer, true);
507                 testPanel->SetAutoLayout( true );
508                 panelTest = new interfTestPanel(testPanel);
509                 wxStaticText* stattext = new wxStaticText(testPanel,  -1,
510                         wxString(_T("   Test Panel   ")),
511                         wxDefaultPosition, wxDefaultSize,
512                         wxALIGN_CENTRE|wxBORDER_SIMPLE|wxFULL_REPAINT_ON_RESIZE, wxString(_T("")));
513                 flexsizer->Add(stattext,wxALIGN_CENTER | wxALIGN_CENTRE);
514                 flexsizer->Add(panelTest, wxEXPAND);
515                 testPanel->Layout();
516         }
517         showPanel(testPanel);
518 }
519
520 void interfMainPanel::RefreshInterface()
521 {
522         wxContourMainFrame::getInstance()->RefreshInterface();
523 }
524
525 vtkImageData* interfMainPanel::getImageData()
526 {
527         return wxContourMainFrame::getInstance()->getImageData();
528 }
529
530 void interfMainPanel::getImageRange(double  range[2] )
531 {
532         vtkImageData * img = getImageData();
533         img->GetScalarRange(range);
534 }
535
536 void interfMainPanel::onSegmentationOneSlice(int isovalue,int sampling,int method)
537 {
538         wxContourMainFrame::getInstance()->onSegmentationOneSlice(isovalue, sampling, method);
539 }
540
541 void interfMainPanel::onSegmentationOneSliceITK(wxString distance, wxString sigma, wxString alfa, wxString beta, wxString propagation, wxString iterations, wxString inflation)
542 {
543         wxContourMainFrame::getInstance()->onSegmentationOneSliceITK(distance, sigma, alfa, beta, propagation, iterations, inflation);
544 }
545
546 int interfMainPanel::GetImageDataSizeZ()
547 {
548         return wxContourMainFrame::getInstance()->GetImageDataSizeZ();
549 }
550
551 void interfMainPanel::onSegmentationAllSlice(int minZ,int maxZ,int isovalue,int sampling,int method)
552 {
553         wxContourMainFrame::getInstance()->onSegmentationAllSlice(minZ, maxZ,isovalue,sampling,method);
554 }
555
556 void interfMainPanel::setLabelSegmentationPanelVTK(wxString tmpString)
557 {
558     ((interfSegmentationPanelVTK*)segmentationPanel)->setLabel(tmpString);
559 }
560 void interfMainPanel::onSegmentationPressed()
561 {
562         if(segmentPanel == NULL){
563                 segmentPanel = new wxPanel(getInfoPanel(), -1, wxDefaultPosition, wxDefaultSize, wxBORDER_STATIC, wxString(_T("")));
564                 wxFlexGridSizer* flexsizer = new wxFlexGridSizer(1);
565                 segmentPanel->SetSizer(flexsizer, true);
566                 segmentPanel->SetAutoLayout(true);
567                 segmentPanel->SetEventHandler(this);
568
569                 //wxPanel* panel = contourevent->getSegmentationPanel(segmentPanel);
570                 segmentationPanel = new interfSegmentationPanelVTK(segmentPanel);
571
572
573                 wxStaticText* stattext = new wxStaticText(segmentPanel, -1, wxString(_T("   Automatic Segmentation   ")), wxDefaultPosition,
574                         wxDefaultSize, wxALIGN_CENTRE|wxBORDER_SIMPLE|wxFULL_REPAINT_ON_RESIZE, wxString(_T("")));
575
576                 flexsizer->Add(stattext,wxALIGN_CENTER | wxALIGN_CENTRE);
577                 flexsizer->Add(segmentationPanel, wxEXPAND);
578                 segmentPanel->Layout();
579         }
580         showPanel(segmentPanel);
581         wxContourMainFrame::getInstance()->showAxis(true);
582         axisshown = true;
583 }
584
585 void interfMainPanel::onSegmentationPressedITK()
586 {
587     if(segmentPanelITK == NULL){
588                 segmentPanelITK = new wxPanel(interfMainPanel::getInstance()->getInfoPanel(), -1, wxDefaultPosition, wxDefaultSize, wxBORDER_STATIC, wxString(_T("")));
589
590
591                 wxFlexGridSizer* flexsizer = new wxFlexGridSizer(1);
592                 segmentPanelITK->SetSizer(flexsizer, true);
593                 segmentPanelITK->SetAutoLayout( true );
594                 //segmentPanelITK->SetEventHandler(this->contourevent);
595
596                 //wxPanel* panel = contourevent->getSegmentationPanelITK(segmentPanelITK);
597                 wxPanel* panel = new interfSegmentationPanelITK(segmentPanelITK);
598
599                 wxStaticText* stattext = new wxStaticText(segmentPanelITK, -1, wxString(_T("   Automatic ITK Segmentation   ")), wxDefaultPosition,
600                         wxDefaultSize, wxALIGN_CENTRE|wxBORDER_SIMPLE|wxFULL_REPAINT_ON_RESIZE, wxString(_T("")));
601
602                 flexsizer->Add(stattext,wxALIGN_CENTER | wxALIGN_CENTRE);
603                 flexsizer->Add(panel, wxEXPAND);
604                 segmentPanelITK->Layout();
605         }
606         showPanel(segmentPanelITK);
607         wxContourMainFrame::getInstance()->showAxis(true);
608         axisshown = true;
609 }
610
611 void interfMainPanel::onRigidPressed()
612 {
613         wxContourMainFrame::getInstance()->onRigidPressed();
614 }
615
616 void interfMainPanel::onWidthOfContour(double width)
617 {
618         wxContourMainFrame::getInstance()->onWidthOfContour(width);
619 }
620
621 int interfMainPanel::getColorWindow()
622 {
623         return wxContourMainFrame::getInstance()->getColorWindow();
624 }
625 int interfMainPanel::getWindowLevel()
626 {
627         return wxContourMainFrame::getInstance()->getWindowLevel();
628 }
629 void interfMainPanel::onBrigthnessColorWindowLevel(int colorwindow,int windowlevel)
630 {
631         wxContourMainFrame::getInstance()->onBrigthnessColorWindowLevel(colorwindow, windowlevel);
632 }
633
634 void interfMainPanel::onInterpolation(bool interpolate)
635 {
636         wxContourMainFrame::getInstance()->onInterpolation(interpolate);
637 }
638
639
640 void interfMainPanel::onConfigurationPressed()
641 {
642         if(configPanel == NULL){
643                 configPanel = new wxPanel(interfMainPanel::getInstance()->getInfoPanel(), -1, wxDefaultPosition, wxDefaultSize, wxNO_BORDER, wxString(_T("")));
644                 wxFlexGridSizer* flexsizer = new wxFlexGridSizer(1);
645                 configPanel->SetSizer(flexsizer, true);
646                 configPanel->SetAutoLayout( true );
647                 //configPanel->SetEventHandler(this->contourevent);
648                 wxPanel* panel = new interfConfigurationPanel(configPanel);
649                 wxStaticText* stattext = new wxStaticText(configPanel, -1, wxString(_T("   Interface Configuration   ")), wxDefaultPosition,
650                         wxDefaultSize, wxALIGN_CENTRE|wxBORDER_SIMPLE|wxFULL_REPAINT_ON_RESIZE, wxString(_T("")));
651                 flexsizer->Add(stattext,wxALIGN_CENTER | wxALIGN_CENTRE);
652                 flexsizer->Add(panel, wxEXPAND);
653                 configPanel->Layout();
654         }
655         showPanel(configPanel);
656 }
657
658 void interfMainPanel::onSpreadPressed()
659 {
660     if(spreadPanel==NULL){
661
662                 spreadPanel = new wxPanel(interfMainPanel::getInstance()->getInfoPanel(), -1, wxDefaultPosition, wxDefaultSize, wxBORDER_STATIC, wxString(_T("")));
663                 wxFlexGridSizer* flexsizer = new wxFlexGridSizer(1);
664                 spreadPanel->SetSizer(flexsizer, true);
665                 spreadPanel->SetAutoLayout( true );
666                 //spreadPanel->SetEventHandler(this->contourevent);
667
668                 //wxPanel* panel = contourevent->getSpreadPanel(spreadPanel);
669                 panelSpread = new interfSpreadPanel(spreadPanel);
670
671
672                 wxStaticText* stattext = new wxStaticText(spreadPanel, -1, wxString(_T("   Automatic Spread   ")), wxDefaultPosition,
673                         wxDefaultSize, wxALIGN_CENTRE|wxBORDER_SIMPLE|wxFULL_REPAINT_ON_RESIZE, wxString(_T("")));
674
675                 flexsizer->Add(stattext,wxALIGN_CENTER | wxALIGN_CENTRE);
676                 flexsizer->Add(panelSpread, wxEXPAND);
677                 spreadPanel->Layout();
678         }
679         showPanel(spreadPanel);
680         //hideAxis();
681 }
682
683 void interfMainPanel::resetAppend()
684 {
685         wxContourMainFrame::getInstance()->resetAppend();
686 }
687
688 void interfMainPanel::onSpreadAdd()
689 {
690         wxContourMainFrame::getInstance()->onSpreadAdd();
691 }
692
693 void interfMainPanel::onSpreadAddAll()
694 {
695         wxContourMainFrame::getInstance()->onSpreadAddAll();
696 }
697
698
699 void interfMainPanel::appendStringSpread(std::string val)
700 {
701     panelSpread->appendStringSpread(val);
702 }
703
704 void interfMainPanel::onSpreadGo(int type)
705 {
706         wxContourMainFrame::getInstance()->onSpreadGo(type);
707 }
708
709 void interfMainPanel::setStringSpread(std::string stringtemp)
710 {
711         panelSpread->setStringSpread(stringtemp);
712 }
713
714 void interfMainPanel::onInformationPressed()
715 {
716
717         // Statistics frame
718         if(infoWin ==NULL){
719                 infoWin                 = new wxFrame (this, -1,_T("  Statistics  "), wxDefaultPosition, wxDefaultSize, wxFRAME_TOOL_WINDOW|wxSYSTEM_MENU | wxCAPTION |  wxCLIP_CHILDREN |wxFRAME_FLOAT_ON_PARENT | wxRESIZE_BORDER  );
720                 infoWin->SetSize( wxSize(825,650) );
721
722                 wxSize sizepanel(825,675);
723                 informationPanel        = new interfInformationPanel(infoWin);//contourevent->getInformationPanel(infoWin);
724
725                 wxBoxSizer * sizerPanel = new wxBoxSizer(wxHORIZONTAL);
726                 sizerPanel -> Add( informationPanel, 1, wxEXPAND ,0);
727
728                 infoWin->SetSizer( sizerPanel );
729                 infoWin->SetAutoLayout( true );
730                 infoWin->Layout();
731                 infoWin->Show();
732         }else {
733
734                 if (infoWin->IsShown()==true)
735                 {
736                         infoWin->Show(false);
737                 } else  {
738                         //contourevent->FillGridWithContoursInformation();
739                         infoWin->Show(true);
740                 }
741         }
742
743 //CMRU 29-08-09-----------------------------------------------------------------------------------------------
744         if(panelAux == NULL)
745         {
746                 panelAux = new wxPanel(interfMainPanel::getInstance()->getInfoPanel(), -1, wxDefaultPosition, wxDefaultSize, wxNO_BORDER, wxString(_T("")));
747         }
748 //------------------------------------------------------------------------------------------------------------
749
750         // mask view control panel
751         if(infoPanelMask == NULL){
752                 infoPanelMask = new wxPanel(panelAux, -1, wxDefaultPosition, wxDefaultSize, wxNO_BORDER, wxString(_T("")));
753                 wxFlexGridSizer* flexsizer = new wxFlexGridSizer(1);
754                 infoPanelMask->SetSizer(flexsizer, true);
755                 infoPanelMask->SetAutoLayout( true );
756                 //configPanel->SetEventHandler(this->contourevent);
757                 wxPanel *panel = wxContourMainFrame::getInstance()->getMaskImageViewPanel( infoPanelMask );
758                 wxStaticText* stattext = new wxStaticText(infoPanelMask, -1, wxString(_T("   Mask segmentation    ")), wxDefaultPosition,
759                                                                                                   wxDefaultSize, wxALIGN_CENTRE|wxBORDER_SIMPLE|wxFULL_REPAINT_ON_RESIZE, wxString(_T("")));
760
761                 flexsizer->Add(stattext,wxALIGN_CENTER | wxALIGN_CENTRE);
762
763                 flexsizer->Add(panel, wxEXPAND);
764                 infoPanelMask->Layout();
765
766         }
767
768 //CMRU 29-08-09-----------------------------------------------------------------------------------------------
769         //Calibration panel
770         if(infoPanelCalibration == NULL)
771         {
772                 infoPanelCalibration = new wxPanel(panelAux, -1, wxDefaultPosition, wxDefaultSize, wxNO_BORDER , wxString(_T("")));
773                 wxFlexGridSizer* flexsizer = new wxFlexGridSizer(1);
774                 infoPanelCalibration->SetSizer(flexsizer, true);
775                 infoPanelCalibration->SetAutoLayout( true );
776
777                 wxPanel *panel = new interfCalibrationPanel(infoPanelCalibration);
778                 wxStaticText* stattext = new wxStaticText(infoPanelCalibration, -1, wxString(_T("              Calibration               ")), wxDefaultPosition,
779                                                                                                   wxDefaultSize, wxALIGN_CENTRE|wxBORDER_SIMPLE|wxFULL_REPAINT_ON_RESIZE, wxString(_T("")));
780
781                 flexsizer->Add(stattext,wxALIGN_CENTER | wxALIGN_CENTRE);
782
783                 flexsizer->Add(panel, wxEXPAND);
784                 infoPanelCalibration->Layout();
785         }
786
787         wxFlexGridSizer* sizer = new wxFlexGridSizer(1);
788         panelAux->SetSizer(sizer, true);
789         panelAux->SetAutoLayout( true );
790         sizer->Add(infoPanelMask);
791         sizer->Add(infoPanelCalibration);
792
793         showPanel(panelAux);
794
795 //------------------------------------------------------------------
796
797         wxContourMainFrame::getInstance()->changeInstant();
798 }
799
800 void interfMainPanel::getInstantVector(std::vector<int>& tempVector)
801 {
802         wxContourMainFrame::getInstance()->getInstantVector(tempVector);
803 }
804
805 std::vector<std::string> interfMainPanel::getOutlinesName(int slide)
806 {
807         return wxContourMainFrame::getInstance()->getOutlinesName(slide);
808 }
809
810 void interfMainPanel::onInformationContourLabels(int typeContourGroup,int selection,int minZ,int maxZ,int grayRangeMin,int grayRangeMax){
811         wxContourMainFrame::getInstance()->onInformationContourLabels(typeContourGroup, selection, minZ, maxZ,grayRangeMin,grayRangeMax);
812 }
813
814 void interfMainPanel::setStringInfoPanel(wxString tmpString)
815 {
816         if(informationPanel!=NULL){
817                 ((interfInformationPanel*)informationPanel)->setStringInfoPanel(tmpString);
818         }
819 }
820
821 void interfMainPanel::setRowLabelInfoPanel(int z, wxString tempString)
822 {
823         ((interfInformationPanel*)informationPanel)->setRowLabelInfoPanel(z, tempString);
824 }
825
826 int interfMainPanel::getNumberColsInformationPanel()
827 {
828         return ((interfInformationPanel*)informationPanel)->getNumberCols();
829 }
830
831 void interfMainPanel::appendColsInformationPanel(int _numberOfVariablesStatistics)
832 {
833         ((interfInformationPanel*)informationPanel)->appendCols(_numberOfVariablesStatistics);
834 }
835
836 void interfMainPanel::setCellValueInfoPanel(int z,int tmpIntA,wxString tempString)
837 {
838         ((interfInformationPanel*)informationPanel)->setCellValue(z, tmpIntA, tempString);
839 }
840
841 void interfMainPanel::setColLableInfoPanel(int tmpIntB,wxString tmpTitleString)
842 {
843         ((interfInformationPanel*)informationPanel)->setColLabel(tmpIntB, tmpTitleString);
844
845 }
846
847 void interfMainPanel::SetScalarRange(int grayRangeMin,int grayRangeMax)
848 {
849         wxContourMainFrame::getInstance()->SetScalarRange(grayRangeMin, grayRangeMax);
850 }
851
852 void interfMainPanel::onSaveResults(std::string directory,std::string namefile, std::string filename,
853                                                                         int typeContourGroup, int selection, int minZ, int maxZ ,bool XYZValues, bool contourImage, bool statistics)
854 {
855         wxContourMainFrame::getInstance()->onSaveResults(directory, namefile, filename,
856                 typeContourGroup, selection, minZ,maxZ, XYZValues, contourImage, statistics);
857 }
858
859 wxString interfMainPanel::getCellValue(int j,int i){
860         return ((interfInformationPanel*)informationPanel)->getCellValue(j, i );
861 }
862
863 void interfMainPanel::onSnakePressed()
864 {
865         axisshown=false;
866         wxContourMainFrame::getInstance()->showAxis(axisshown);
867         wxContourMainFrame::getInstance()->onSnakePressed();
868 }
869
870 void interfMainPanel::onMirrorPressed(){
871     if(mirrorPanel==NULL)
872         {
873
874                 mirrorPanel = new wxPanel(interfMainPanel::getInstance()->getInfoPanel(), -1, wxDefaultPosition, wxDefaultSize, wxBORDER_STATIC, wxString(_T("")));
875                 wxFlexGridSizer* flexsizer = new wxFlexGridSizer(1);
876                 mirrorPanel->SetSizer(flexsizer, true);
877                 mirrorPanel->SetAutoLayout( true );
878                 panelMirror = new interfMirrorPanel(mirrorPanel);
879
880                 wxStaticText* stattext = new wxStaticText(mirrorPanel, -1, wxString(_T("   Mirroring Tool   ")), wxDefaultPosition,
881                         wxDefaultSize, wxALIGN_CENTRE|wxBORDER_SIMPLE|wxFULL_REPAINT_ON_RESIZE, wxString(_T("")));
882
883                 flexsizer->Add(stattext,wxALIGN_CENTER | wxALIGN_CENTRE);
884                 flexsizer->Add(panelMirror, wxEXPAND);
885                 mirrorPanel->Layout();
886
887                 refLineShown=true;
888                 wxContourMainFrame::getInstance()->referenceLine();
889         }
890
891         else
892         {
893
894                 if (!refLineShown)
895                 {
896                         wxContourMainFrame::getInstance()->refLineShow();
897                         refLineShown=true;
898                 }
899         }
900
901         showPanel(mirrorPanel);
902 }
903
904 void interfMainPanel::onMirror()
905 {
906         wxContourMainFrame::getInstance()->onMirror();
907 }
908
909 void interfMainPanel::onMirrorAxisShow()
910 {
911         if (!refLineShown)
912         {
913                 wxContourMainFrame::getInstance()->refLineShow();
914                 refLineShown=true;
915         }
916 }
917
918 void interfMainPanel::onMirrorAxisHide()
919 {
920         if (refLineShown)
921         {
922                 wxContourMainFrame::getInstance()->refLineHide();
923                 refLineShown=false;
924         }
925 }
926
927 void interfMainPanel::onMirrorChangeWidth(int width)
928 {
929         wxContourMainFrame::getInstance()->refLineChangeWidth(width);
930 }
931
932 //EED 07/07/2010
933 void interfMainPanel::onColorLayerImagePressed()
934 {
935         // Color Image Layer  view control panel
936         if(colorImageLayerPanel == NULL){
937                 colorImageLayerPanel = new wxPanel(interfMainPanel::getInstance()->getInfoPanel(), -1, wxDefaultPosition, wxDefaultSize, wxNO_BORDER, wxString(_T("")));
938                 wxFlexGridSizer* flexsizer = new wxFlexGridSizer(1);
939                 colorImageLayerPanel->SetSizer(flexsizer, true);
940                 colorImageLayerPanel->SetAutoLayout( true );
941                 //configPanel->SetEventHandler(this->contourevent);
942                 wxPanel *panel = wxContourMainFrame::getInstance()->getColorLayerImageViewPanel( colorImageLayerPanel );
943                 wxStaticText* stattext = new wxStaticText(colorImageLayerPanel, -1, wxString(_T("   Color Image Layer     ")), wxDefaultPosition,
944                                                                                                   wxDefaultSize, wxALIGN_CENTRE|wxBORDER_SIMPLE|wxFULL_REPAINT_ON_RESIZE, wxString(_T("")));
945                 flexsizer->Add(stattext,wxALIGN_CENTER | wxALIGN_CENTRE);
946                 flexsizer->Add(panel, wxEXPAND);
947                 colorImageLayerPanel->Layout();
948         }
949         showPanel(colorImageLayerPanel);
950         wxContourMainFrame::getInstance()->changeInstant();
951 }
952
953 //EED01
954 void interfMainPanel::onThresholdPressed()
955 {
956         // Threshold view control panel
957         if(thresholdPanel == NULL){
958                 thresholdPanel = new wxPanel(interfMainPanel::getInstance()->getInfoPanel(), -1, wxDefaultPosition, wxDefaultSize, wxNO_BORDER, wxString(_T("")));
959                 wxFlexGridSizer* flexsizer = new wxFlexGridSizer(1);
960                 thresholdPanel->SetSizer(flexsizer, true);
961                 thresholdPanel->SetAutoLayout( true );
962                 //configPanel->SetEventHandler(this->contourevent);
963                 wxPanel *panel = wxContourMainFrame::getInstance()->getThresholdImageViewPanel( thresholdPanel );
964                 wxStaticText* stattext = new wxStaticText(thresholdPanel, -1, wxString(_T("   Threshold segmentation    ")), wxDefaultPosition,
965                                                                                                   wxDefaultSize, wxALIGN_CENTRE|wxBORDER_SIMPLE|wxFULL_REPAINT_ON_RESIZE, wxString(_T("")));
966                 flexsizer->Add(stattext,wxALIGN_CENTER | wxALIGN_CENTRE);
967                 flexsizer->Add(panel, wxEXPAND);
968                 thresholdPanel->Layout();
969         }
970         showPanel(thresholdPanel);
971         wxContourMainFrame::getInstance()->changeInstant();
972 }
973
974
975 void interfMainPanel::ShowResultImages(int typeContourGroup, int selection, int minZ, int maxZ)
976 {
977         wxContourMainFrame::getInstance()->ShowResultImages(typeContourGroup, selection, minZ, maxZ);
978 }
979
980
981 void interfMainPanel::SetContourGroup(int contourGroup)
982 {
983         wxContourMainFrame::getInstance()->SetContourGroup( contourGroup);
984 }
985
986
987 void interfMainPanel::onFlipContours()
988 {
989         printf("EED interfMainPanel::onFlipContours() \n");
990         if(flipPanel==NULL)
991         {
992                 flipPanel = new wxPanel(interfMainPanel::getInstance()->getInfoPanel(), -1, wxDefaultPosition,
993                         wxDefaultSize, wxBORDER_STATIC, wxString(_T("")));
994                 wxFlexGridSizer* flexsizer = new wxFlexGridSizer(1);
995                 flipPanel->SetSizer(flexsizer, true);
996                 flipPanel->SetAutoLayout( true );
997                 panelFlip = new interfFlipPanel(flipPanel);
998                 wxStaticText* stattext = new wxStaticText(flipPanel,  -1,
999                         wxString(_T("         Flip Contours   ")),
1000                         wxDefaultPosition, wxDefaultSize,
1001                         wxALIGN_CENTRE|wxBORDER_SIMPLE|wxFULL_REPAINT_ON_RESIZE, wxString(_T("")));
1002                 flexsizer->Add(stattext,wxALIGN_CENTER | wxALIGN_CENTRE);
1003                 flexsizer->Add(panelFlip, wxEXPAND);
1004                 flipPanel->Layout();
1005         }
1006         showPanel(flipPanel);
1007 }
1008
1009
1010 void interfMainPanel::FlipContours(int typeContourFlip, int flipDirection)
1011 {
1012         printf("EED interfMainPanel::FlipContours( %d , %d ) \n",typeContourFlip,  flipDirection );
1013         wxContourMainFrame::getInstance()->FlipContours( typeContourFlip , flipDirection );
1014 }
1015
1016
1017
1018 //CMRU 17-08-09 ---------------------------------------------
1019 void interfMainPanel::onPrintLabel ()
1020 {
1021         wxString label;
1022         manualBaseModel* manualModel = wxContourMainFrame::getInstance()->getContour();
1023
1024         if(manualModel==NULL)
1025         {
1026         wxMessageDialog *dial = new wxMessageDialog(NULL, wxT("Please select a Contour"), wxT("Warning"), wxOK | wxICON_EXCLAMATION);
1027                 dial->ShowModal();
1028                 return;
1029         }
1030
1031         wxTextEntryDialog* dialog = new wxTextEntryDialog(this,_T("Enter a tag name: ")) ;
1032
1033         if (dialog->ShowModal() == wxID_OK)
1034         {
1035                 label = dialog->GetValue();
1036
1037                 if(label.Len()!=0)
1038                 {
1039                         wxContourMainFrame::getInstance()->onPrintLabel(label,manualModel);
1040                         wxMessageDialog *dial = new wxMessageDialog(NULL, wxT("The tag name was updated"), wxT("Information"), wxOK | wxICON_INFORMATION);
1041                         dial->ShowModal();
1042                 }
1043                 else
1044                 {
1045                         wxMessageDialog *dial = new wxMessageDialog(NULL, wxT("Please enter a valid tag"), wxT("Warning"), wxOK | wxICON_EXCLAMATION);
1046                         dial->ShowModal();
1047                 }
1048         }
1049 }
1050
1051 void interfMainPanel::onCalibration(wxString size, int unit)
1052 {
1053         int type = 0;
1054         double contourSize = 0.0;
1055         double realSizeDouble = 0.0;
1056
1057         type = wxContourMainFrame::getInstance()->getType();
1058         contourSize = wxContourMainFrame::getInstance()->getContourSizeInPixels();
1059
1060         std::cout<<"Cata->Tama�o del contorno en pixeles:"<<contourSize<<endl;
1061
1062         if ( type == 6 )
1063         {
1064                 if (size.ToDouble(&realSizeDouble))
1065                 {
1066                         if(unit==1)
1067                         {
1068                                 realSizeDouble = realSizeDouble * 10;
1069                         }
1070                         if(unit==2)
1071                         {
1072                                 realSizeDouble = realSizeDouble * 25.4;
1073                         }
1074                         std::cout<< "Valor del usuario" << realSizeDouble<< endl ;
1075                         onePixelSize (realSizeDouble,contourSize);
1076                  }
1077                  else
1078                  {
1079                         wxMessageDialog *dial = new wxMessageDialog(NULL, wxT("Please enter a numeric value"), wxT("Warning"), wxOK | wxICON_EXCLAMATION);
1080                         dial->ShowModal();
1081                  }
1082         }
1083         else
1084         {
1085                 wxMessageDialog *dial = new wxMessageDialog(NULL, wxT("Please select a line contour"), wxT("Warning"), wxOK | wxICON_EXCLAMATION);
1086                 dial->ShowModal();
1087         }
1088
1089         wxMessageDialog *dial = new wxMessageDialog(NULL, wxT("The calibration was made"), wxT("Information"), wxOK | wxICON_INFORMATION);
1090         dial->ShowModal();
1091         std::cout<< "Cata-> Se ha realizado la calibracion" << endl ;
1092 }
1093
1094 double interfMainPanel::onePixelSize (double realSize,double sizePixel)
1095 {
1096         _pixelValue = realSize/sizePixel;
1097         std::cout<< "Valor del un pixel = " << _pixelValue<< endl ;
1098         wxContourMainFrame::getInstance()->onePixelSize (_pixelValue);
1099         return _pixelValue ;
1100 }
1101
1102 double interfMainPanel::GetPixelValue()
1103 {
1104         return _pixelValue;
1105 }
1106 //------------------------------------------------------------------------------------------------------------