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