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