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