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