]> Creatis software - creaContours.git/blob - lib/Interface_Icons_NDimensions/interfMainPanel.cxx
#3322 creaContours Feature New Normal - Show reference contour Befor After actual...
[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::onShowTextContour(bool show)
604 {
605         wxContourMainFrame::getInstance()->onShowTextContour(show);
606 }
607
608
609 void interfMainPanel::onConfigurationPressed()
610 {
611         if(configPanel == NULL)
612         {
613                 configPanel = new wxPanel(interfMainPanel::getInstance()->getInfoPanel(), -1, wxDefaultPosition, wxDefaultSize, wxNO_BORDER, wxString(_T("")));
614                 wxFlexGridSizer* flexsizer = new wxFlexGridSizer(1);
615                 configPanel->SetSizer(flexsizer, true);
616                 configPanel->SetAutoLayout( true );
617                 //configPanel->SetEventHandler(this->contourevent);
618                 wxPanel* panel = new interfConfigurationPanel(configPanel);
619                 wxStaticText* stattext = new wxStaticText(configPanel, -1, wxString(_T("   Interface Configuration   ")), wxDefaultPosition,
620                         wxDefaultSize, wxALIGN_CENTRE|wxBORDER_SIMPLE|wxFULL_REPAINT_ON_RESIZE, wxString(_T("")));
621                 flexsizer->Add(stattext,wxALIGN_CENTER | wxALIGN_CENTRE);
622                 flexsizer->Add(panel, wxEXPAND);
623                 configPanel->Layout();
624         }// if configPanel
625         showPanel(configPanel);
626 }
627
628 void interfMainPanel::onSpreadPressed()
629 {
630     if(spreadPanel==NULL)
631         {
632                 spreadPanel = new wxPanel(interfMainPanel::getInstance()->getInfoPanel(), -1, wxDefaultPosition, wxDefaultSize, wxBORDER_STATIC, wxString(_T("")));
633                 wxFlexGridSizer* flexsizer = new wxFlexGridSizer(1);
634                 spreadPanel->SetSizer(flexsizer, true);
635                 spreadPanel->SetAutoLayout( true );
636                 //spreadPanel->SetEventHandler(this->contourevent);
637                 //wxPanel* panel = contourevent->getSpreadPanel(spreadPanel);
638                 panelSpread = new interfSpreadPanel(spreadPanel);
639                 wxStaticText* stattext = new wxStaticText(spreadPanel, -1, wxString(_T("   Automatic Spread   ")), wxDefaultPosition,
640                         wxDefaultSize, wxALIGN_CENTRE|wxBORDER_SIMPLE|wxFULL_REPAINT_ON_RESIZE, wxString(_T("")));
641                 flexsizer->Add(stattext,wxALIGN_CENTER | wxALIGN_CENTRE);
642                 flexsizer->Add(panelSpread, wxEXPAND);
643                 spreadPanel->Layout();
644         } // spreadPanel
645         showPanel(spreadPanel);
646         //hideAxis();
647 }
648
649 void interfMainPanel::resetAppend()
650 {
651         wxContourMainFrame::getInstance()->resetAppend();
652 }
653
654 void interfMainPanel::onSpreadAdd()
655 {
656         wxContourMainFrame::getInstance()->onSpreadAdd();
657 }
658
659 void interfMainPanel::onSpreadAddAll()
660 {
661         wxContourMainFrame::getInstance()->onSpreadAddAll();
662 }
663
664
665 void interfMainPanel::appendStringSpread(std::string val)
666 {
667     panelSpread->appendStringSpread(val);
668 }
669
670 void interfMainPanel::onSpreadGo(int type)
671 {
672         wxContourMainFrame::getInstance()->onSpreadGo(type);
673 }
674
675 void interfMainPanel::setStringSpread(std::string stringtemp)
676 {
677         panelSpread->setStringSpread(stringtemp);
678 }
679
680 void interfMainPanel::onInformationPressed()
681 {
682         // Statistics frame
683         if(infoWin ==NULL)
684         {
685                 infoWin                 = new wxFrame (this, -1,_T("  Statistics  "), wxDefaultPosition, wxDefaultSize, wxFRAME_TOOL_WINDOW|wxSYSTEM_MENU | wxCAPTION |  wxCLIP_CHILDREN |wxFRAME_FLOAT_ON_PARENT | wxRESIZE_BORDER  );
686                 infoWin->SetSize( wxSize(825,650) );
687
688                 wxSize sizepanel(825,675);
689                 informationPanel        = new interfInformationPanel(infoWin);//contourevent->getInformationPanel(infoWin);
690
691                 wxFlexGridSizer * sizerPanel            = new wxFlexGridSizer(1);
692
693                 sizerPanel -> Add( informationPanel, 1, wxEXPAND ,0);
694
695                 infoWin->SetSizer( sizerPanel );
696                 infoWin->SetAutoLayout( true );
697                 infoWin->Layout();
698                 infoWin->Show();
699         }else {
700                 if (infoWin->IsShown()==true)
701                 {
702                         infoWin->Show(false);
703                 } else  {
704                         //contourevent->FillGridWithContoursInformation();
705                         infoWin->Show(true);
706                 }
707         }
708
709 //CMRU 29-08-09-----------------------------------------------------------------------------------------------
710         if(panelAux == NULL)
711         {
712                 panelAux = new wxPanel(interfMainPanel::getInstance()->getInfoPanel(), -1, wxDefaultPosition, wxDefaultSize, wxNO_BORDER, wxString(_T("")));
713         }
714 //------------------------------------------------------------------------------------------------------------
715         // mask view control panel
716         if(infoPanelMask == NULL){
717                 infoPanelMask = new wxPanel(panelAux, -1, wxDefaultPosition, wxDefaultSize, wxNO_BORDER, wxString(_T("")));
718                 wxFlexGridSizer* flexsizer = new wxFlexGridSizer(1);
719                 infoPanelMask->SetSizer(flexsizer, true);
720                 infoPanelMask->SetAutoLayout( true );
721                 //configPanel->SetEventHandler(this->contourevent);
722                 wxPanel *panel = wxContourMainFrame::getInstance()->getMaskImageViewPanel( infoPanelMask );
723                 wxStaticText* stattext = new wxStaticText(infoPanelMask, -1, wxString(_T("   Mask segmentation    ")), wxDefaultPosition,
724                                                                                                   wxDefaultSize, wxALIGN_CENTRE|wxBORDER_SIMPLE|wxFULL_REPAINT_ON_RESIZE, wxString(_T("")));
725                 flexsizer->Add(stattext,wxALIGN_CENTER | wxALIGN_CENTRE);
726                 flexsizer->Add(panel, wxEXPAND);
727                 infoPanelMask->Layout();
728         }
729
730 //CMRU 29-08-09-----------------------------------------------------------------------------------------------
731         //Calibration panel
732         if(infoPanelCalibration == NULL)
733         {
734                 infoPanelCalibration = new wxPanel(panelAux, -1, wxDefaultPosition, wxDefaultSize, wxNO_BORDER , wxString(_T("")));
735                 wxFlexGridSizer* flexsizer = new wxFlexGridSizer(1);
736                 infoPanelCalibration->SetSizer(flexsizer, true);
737                 infoPanelCalibration->SetAutoLayout( true );
738                 wxPanel *panel = new interfCalibrationPanel(infoPanelCalibration);
739                 wxStaticText* stattext = new wxStaticText(infoPanelCalibration, -1, wxString(_T("              Calibration               ")), wxDefaultPosition,
740                                                                                                   wxDefaultSize, wxALIGN_CENTRE|wxBORDER_SIMPLE|wxFULL_REPAINT_ON_RESIZE, wxString(_T("")));
741                 flexsizer->Add(stattext,wxALIGN_CENTER | wxALIGN_CENTRE);
742                 flexsizer->Add(panel, wxEXPAND);
743                 infoPanelCalibration->Layout();
744         }
745
746 //EED 2017-09-16 Migration wxWidgets 2.8 to 3.0
747 #if wxMAJOR_VERSION <= 2
748         wxFlexGridSizer* sizer = new wxFlexGridSizer(1);
749 #else
750         wxFlexGridSizer* sizer = new wxFlexGridSizer(2);
751 #endif
752         sizer->Add(infoPanelMask);
753         sizer->Add(infoPanelCalibration);
754         panelAux->SetSizer(sizer, true);
755         panelAux->SetAutoLayout( true );
756         showPanel(panelAux);
757
758 //------------------------------------------------------------------
759         wxContourMainFrame::getInstance()->changeInstant();
760 }
761
762
763 void interfMainPanel::getInstantVector(std::vector<int>& tempVector)
764 {
765         wxContourMainFrame::getInstance()->getInstantVector(tempVector);
766 }
767
768 std::vector<std::string> interfMainPanel::getOutlinesName(int slide)
769 {
770         return wxContourMainFrame::getInstance()->getOutlinesName(slide);
771 }
772
773 void interfMainPanel::onInformationContourLabels(int typeContourGroup,int selection,int minZ,int maxZ,int grayRangeMin,int grayRangeMax){
774         wxContourMainFrame::getInstance()->onInformationContourLabels(typeContourGroup, selection, minZ, maxZ,grayRangeMin,grayRangeMax);
775 }
776
777 void interfMainPanel::setStringInfoPanel(wxString tmpString)
778 {
779         if(informationPanel!=NULL){
780                 ((interfInformationPanel*)informationPanel)->setStringInfoPanel(tmpString);
781         }
782 }
783
784 void interfMainPanel::setRowLabelInfoPanel(int z, wxString tempString)
785 {
786         ((interfInformationPanel*)informationPanel)->setRowLabelInfoPanel(z, tempString);
787 }
788
789 int interfMainPanel::getNumberColsInformationPanel()
790 {
791         return ((interfInformationPanel*)informationPanel)->getNumberCols();
792 }
793
794 void interfMainPanel::appendColsInformationPanel(int _numberOfVariablesStatistics)
795 {
796         ((interfInformationPanel*)informationPanel)->appendCols(_numberOfVariablesStatistics);
797 }
798
799 void interfMainPanel::setCellValueInfoPanel(int z,int tmpIntA,wxString tempString)
800 {
801         ((interfInformationPanel*)informationPanel)->setCellValue(z, tmpIntA, tempString);
802 }
803
804 void interfMainPanel::setColLableInfoPanel(int tmpIntB,wxString tmpTitleString)
805 {
806         ((interfInformationPanel*)informationPanel)->setColLabel(tmpIntB, tmpTitleString);
807
808 }
809
810 void interfMainPanel::SetScalarRange(int grayRangeMin,int grayRangeMax)
811 {
812         wxContourMainFrame::getInstance()->SetScalarRange(grayRangeMin, grayRangeMax);
813 }
814
815 void interfMainPanel::onSaveResults(std::string directory,std::string namefile, std::string filename,
816                                                                         int typeContourGroup, int selection, int minZ, int maxZ ,bool XYZValues, bool contourImage, bool statistics)
817 {
818         wxContourMainFrame::getInstance()->onSaveResults(directory, namefile, filename,
819                 typeContourGroup, selection, minZ,maxZ, XYZValues, contourImage, statistics);
820 }
821
822 wxString interfMainPanel::getCellValue(int j,int i){
823         return ((interfInformationPanel*)informationPanel)->getCellValue(j, i );
824 }
825
826 void interfMainPanel::onSnakePressed()
827 {
828         axisshown=false;
829         wxContourMainFrame::getInstance()->showAxis(axisshown);
830         wxContourMainFrame::getInstance()->onSnakePressed();
831 }
832
833 void interfMainPanel::onMirrorPressed(){
834     if(mirrorPanel==NULL)
835         {
836
837                 mirrorPanel = new wxPanel(interfMainPanel::getInstance()->getInfoPanel(), -1, wxDefaultPosition, wxDefaultSize, wxBORDER_STATIC, wxString(_T("")));
838                 wxFlexGridSizer* flexsizer = new wxFlexGridSizer(1);
839                 mirrorPanel->SetSizer(flexsizer, true);
840                 mirrorPanel->SetAutoLayout( true );
841                 panelMirror = new interfMirrorPanel(mirrorPanel);
842                 wxStaticText* stattext = new wxStaticText(mirrorPanel, -1, wxString(_T("   Mirroring Tool   ")), wxDefaultPosition,
843                         wxDefaultSize, wxALIGN_CENTRE|wxBORDER_SIMPLE|wxFULL_REPAINT_ON_RESIZE, wxString(_T("")));
844
845                 flexsizer->Add(stattext,wxALIGN_CENTER | wxALIGN_CENTRE);
846                 flexsizer->Add(panelMirror, wxEXPAND);
847                 mirrorPanel->Layout();
848                 refLineShown=true;
849                 wxContourMainFrame::getInstance()->referenceLine();
850         } else {
851                 if (!refLineShown)
852                 {
853                         wxContourMainFrame::getInstance()->refLineShow();
854                         refLineShown=true;
855                 }
856         } // if mirrorPanel
857
858         showPanel(mirrorPanel);
859 }
860
861 void interfMainPanel::onMirror()
862 {
863         wxContourMainFrame::getInstance()->onMirror();
864 }
865
866 void interfMainPanel::onMirrorAxisShow()
867 {
868         if (!refLineShown)
869         {
870                 wxContourMainFrame::getInstance()->refLineShow();
871                 refLineShown=true;
872         }
873 }
874
875 void interfMainPanel::onMirrorAxisHide()
876 {
877         if (refLineShown)
878         {
879                 wxContourMainFrame::getInstance()->refLineHide();
880                 refLineShown=false;
881         }
882 }
883
884 void interfMainPanel::onMirrorChangeWidth(int width)
885 {
886         wxContourMainFrame::getInstance()->refLineChangeWidth(width);
887 }
888
889 //EED 07/07/2010
890 void interfMainPanel::onColorLayerImagePressed()
891 {
892         // Color Image Layer  view control panel
893         if(colorImageLayerPanel == NULL){
894                 colorImageLayerPanel = new wxPanel(interfMainPanel::getInstance()->getInfoPanel(), -1, wxDefaultPosition, wxDefaultSize, wxNO_BORDER, wxString(_T("")));
895                 wxFlexGridSizer* flexsizer = new wxFlexGridSizer(1);
896                 colorImageLayerPanel->SetSizer(flexsizer, true);
897                 colorImageLayerPanel->SetAutoLayout( true );
898                 //configPanel->SetEventHandler(this->contourevent);
899                 wxPanel *panel = wxContourMainFrame::getInstance()->getColorLayerImageViewPanel( colorImageLayerPanel );
900                 wxStaticText* stattext = new wxStaticText(colorImageLayerPanel, -1, wxString(_T("   Color Image Layer     ")), wxDefaultPosition,
901                                                                                                   wxDefaultSize, wxALIGN_CENTRE|wxBORDER_SIMPLE|wxFULL_REPAINT_ON_RESIZE, wxString(_T("")));
902                 flexsizer->Add(stattext,wxALIGN_CENTER | wxALIGN_CENTRE);
903                 flexsizer->Add(panel, wxEXPAND);
904                 colorImageLayerPanel->Layout();
905         }
906         showPanel(colorImageLayerPanel);
907         wxContourMainFrame::getInstance()->changeInstant();
908 }
909
910 //EED01
911 void interfMainPanel::onThresholdPressed()
912 {
913         // Threshold view control panel
914         if(thresholdPanel == NULL){
915                 thresholdPanel = new wxPanel(interfMainPanel::getInstance()->getInfoPanel(), -1, wxDefaultPosition, wxDefaultSize, wxNO_BORDER, wxString(_T("")));
916                 wxFlexGridSizer* flexsizer = new wxFlexGridSizer(1);
917                 thresholdPanel->SetSizer(flexsizer, true);
918                 thresholdPanel->SetAutoLayout( true );
919                 //configPanel->SetEventHandler(this->contourevent);
920                 wxPanel *panel = wxContourMainFrame::getInstance()->getThresholdImageViewPanel( thresholdPanel );
921                 wxStaticText* stattext = new wxStaticText(thresholdPanel, -1, wxString(_T("   Threshold segmentation    ")), wxDefaultPosition,
922                                                                                                   wxDefaultSize, wxALIGN_CENTRE|wxBORDER_SIMPLE|wxFULL_REPAINT_ON_RESIZE, wxString(_T("")));
923                 flexsizer->Add(stattext,wxALIGN_CENTER | wxALIGN_CENTRE);
924                 flexsizer->Add(panel, wxEXPAND);
925                 thresholdPanel->Layout();
926         }
927         showPanel(thresholdPanel);
928         wxContourMainFrame::getInstance()->changeInstant();
929 }
930
931
932 void interfMainPanel::ShowResultImages(int typeContourGroup, int selection, int minZ, int maxZ)
933 {
934         wxContourMainFrame::getInstance()->ShowResultImages(typeContourGroup, selection, minZ, maxZ);
935 }
936
937
938 void interfMainPanel::SetContourGroup(int contourGroup)
939 {
940         wxContourMainFrame::getInstance()->SetContourGroup( contourGroup);
941 }
942
943
944 void interfMainPanel::onFlipContours()
945 {
946         printf("EED interfMainPanel::onFlipContours() \n");
947         if(flipPanel==NULL)
948         {
949                 flipPanel = new wxPanel(interfMainPanel::getInstance()->getInfoPanel(), -1, wxDefaultPosition,
950                         wxDefaultSize, wxBORDER_STATIC, wxString(_T("")));
951                 wxFlexGridSizer* flexsizer = new wxFlexGridSizer(1);
952                 flipPanel->SetSizer(flexsizer, true);
953                 flipPanel->SetAutoLayout( true );
954                 panelFlip = new interfFlipPanel(flipPanel);
955                 wxStaticText* stattext = new wxStaticText(flipPanel,  -1,
956                         wxString(_T("         Flip Contours   ")),
957                         wxDefaultPosition, wxDefaultSize,
958                         wxALIGN_CENTRE|wxBORDER_SIMPLE|wxFULL_REPAINT_ON_RESIZE, wxString(_T("")));
959                 flexsizer->Add(stattext,wxALIGN_CENTER | wxALIGN_CENTRE);
960                 flexsizer->Add(panelFlip, wxEXPAND);
961                 flipPanel->Layout();
962         }
963         showPanel(flipPanel);
964 }
965
966
967 void interfMainPanel::FlipContours(int typeContourFlip, int flipDirection)
968 {
969         printf("EED interfMainPanel::FlipContours( %d , %d ) \n",typeContourFlip,  flipDirection );
970         wxContourMainFrame::getInstance()->FlipContours( typeContourFlip , flipDirection );
971 }
972
973
974
975 //CMRU 17-08-09 ---------------------------------------------
976 void interfMainPanel::onPrintLabel ()
977 {
978         wxString label;
979         manualBaseModel* manualModel = wxContourMainFrame::getInstance()->getContour();
980
981         if(manualModel==NULL)
982         {
983         wxMessageDialog *dial = new wxMessageDialog(NULL, wxT("Please select a Contour"), wxT("Warning"), wxOK | wxICON_EXCLAMATION);
984                 dial->ShowModal();
985                 return;
986         }
987
988         wxTextEntryDialog* dialog = new wxTextEntryDialog(this,_T("Enter a tag name: ")) ;
989
990         if (dialog->ShowModal() == wxID_OK)
991         {
992                 label = dialog->GetValue();
993
994                 if(label.Len()!=0)
995                 {
996                         wxContourMainFrame::getInstance()->onPrintLabel(label,manualModel);
997                         wxMessageDialog *dial = new wxMessageDialog(NULL, wxT("The tag name was updated"), wxT("Information"), wxOK | wxICON_INFORMATION);
998                         dial->ShowModal();
999                 }
1000                 else
1001                 {
1002                         wxMessageDialog *dial = new wxMessageDialog(NULL, wxT("Please enter a valid tag"), wxT("Warning"), wxOK | wxICON_EXCLAMATION);
1003                         dial->ShowModal();
1004                 }
1005         }
1006 }
1007
1008 void interfMainPanel::onCalibration(wxString size, int unit)
1009 {
1010         int type = 0;
1011         double contourSize = 0.0;
1012         double realSizeDouble = 0.0;
1013
1014         type = wxContourMainFrame::getInstance()->getType();
1015         contourSize = wxContourMainFrame::getInstance()->getContourSizeInPixels();
1016
1017         std::cout<<"Cata->Tama�o del contorno en pixeles:"<<contourSize<<endl;
1018
1019         if ( type == 6 )
1020         {
1021                 if (size.ToDouble(&realSizeDouble))
1022                 {
1023                         if(unit==1)
1024                         {
1025                                 realSizeDouble = realSizeDouble * 10;
1026                         }
1027                         if(unit==2)
1028                         {
1029                                 realSizeDouble = realSizeDouble * 25.4;
1030                         }
1031                         std::cout<< "Valor del usuario" << realSizeDouble<< endl ;
1032                         onePixelSize (realSizeDouble,contourSize);
1033                  }
1034                  else
1035                  {
1036                         wxMessageDialog *dial = new wxMessageDialog(NULL, wxT("Please enter a numeric value"), wxT("Warning"), wxOK | wxICON_EXCLAMATION);
1037                         dial->ShowModal();
1038                  }
1039         }
1040         else
1041         {
1042                 wxMessageDialog *dial = new wxMessageDialog(NULL, wxT("Please select a line contour"), wxT("Warning"), wxOK | wxICON_EXCLAMATION);
1043                 dial->ShowModal();
1044         }
1045
1046         wxMessageDialog *dial = new wxMessageDialog(NULL, wxT("The calibration was made"), wxT("Information"), wxOK | wxICON_INFORMATION);
1047         dial->ShowModal();
1048         std::cout<< "Cata-> Se ha realizado la calibracion" << endl ;
1049 }
1050
1051 double interfMainPanel::onePixelSize (double realSize,double sizePixel)
1052 {
1053         _pixelValue = realSize/sizePixel;
1054         std::cout<< "Valor del un pixel = " << _pixelValue<< endl ;
1055         wxContourMainFrame::getInstance()->onePixelSize (_pixelValue);
1056         return _pixelValue ;
1057 }
1058
1059 double interfMainPanel::GetPixelValue()
1060 {
1061         return _pixelValue;
1062 }
1063 //------------------------------------------------------------------------------------------------------------