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