1 #include "interfMainPanel.h"
4 #include "interfNewContourMenu.h"
5 #include "interfIOMenu.h"
6 #include "interfEditMenu.h"
7 #include "interfDeleteMenu.h"
8 #include "interfToolsMenu.h"
9 #include "interfToolsSpreadPanel.h"
10 #include "interfMenuBar.h"
11 #include "interfSegmentationMenu.h"
14 interfMainPanel* interfMainPanel::interfmainpanel=NULL;
15 wxFrame* interfMainPanel::_newframe=NULL;
17 interfMainPanel::interfMainPanel(wxWindow * parent, int sizex, int sizey, wxEvtHandler * evtHandler, std::string datadir)
18 : wxPanel(parent, -1, wxDefaultPosition, wxSize(sizex, sizey), wxBORDER_SUNKEN)
21 PANEL = "New Contour";
26 PANEL5 = "Segmentation";
28 segmentPanelITK = NULL;
34 informationPanel = NULL;
36 thresholdPanel = NULL;
39 //CMRU 17-08-09 ------------------------------------------------------------------
40 infoPanelCalibration = NULL;
42 //--------------------------------------------------------------------------------
43 splitterwindow = new wxSplitterWindow(this,-1, wxDefaultPosition, wxSize(sizex, sizey), wxSP_3DSASH, wxString(_T("")));
45 splitterwindow->SetMinimumPaneSize( 10 );
48 wxPanel* toolpanel = new wxPanel(splitterwindow, -1, wxDefaultPosition, wxDefaultSize, wxBORDER_NONE, wxString(_T("")));
50 wxFlexGridSizer* flexsizer = new wxFlexGridSizer(6,2,1,1);
51 toolpanel->SetSizer(flexsizer, true);
52 toolpanel->SetAutoLayout( true );
54 wxButton* b = getButton(toolpanel);
55 b->SetClientData(&PANEL);
56 wxButton* b1 = getButton(toolpanel);
57 b1->SetClientData(&PANEL1);
58 wxButton* b2 = getButton(toolpanel);
59 b2->SetClientData(&PANEL2);
60 wxButton* b3 = getButton(toolpanel);
61 b3->SetClientData(&PANEL3);
62 wxButton* b4 = getButton(toolpanel);
63 b4->SetClientData(&PANEL4);
64 wxButton* b5 = getButton(toolpanel);
65 b5->SetClientData(&PANEL5);
67 wxPanel* mentex = new wxPanel(toolpanel, -1, wxDefaultPosition, wxDefaultSize, wxBORDER_NONE, wxString(_T("")));
68 wxPanel* mentex1 = new wxPanel(toolpanel, -1, wxDefaultPosition, wxDefaultSize, wxBORDER_NONE, wxString(_T("")));
69 wxPanel* mentex2 = new wxPanel(toolpanel, -1, wxDefaultPosition, wxDefaultSize, wxBORDER_NONE, wxString(_T("")));
70 wxPanel* mentex3 = new wxPanel(toolpanel, -1, wxDefaultPosition, wxDefaultSize, wxBORDER_NONE, wxString(_T("")));
71 wxPanel* mentex4 = new wxPanel(toolpanel, -1, wxDefaultPosition, wxDefaultSize, wxBORDER_NONE, wxString(_T("")));
72 wxPanel* mentex5 = new wxPanel(toolpanel, -1, wxDefaultPosition, wxDefaultSize, wxBORDER_NONE, wxString(_T("")));
74 menubar = new interfNewContourMenu (mentex, sizex, sizey, evtHandler, datadir);
75 menubar1 = new interfIOMenu (mentex1, sizex, sizey, evtHandler, datadir);
76 menubar2 = new interfEditMenu (mentex2, sizex, sizey, evtHandler, datadir);
77 menubar3 = new interfDeleteMenu (mentex3, sizex, sizey, evtHandler, datadir);
78 menubar4 = new interfToolsMenu (mentex4, sizex ,sizey, evtHandler, datadir);
79 menubar5 = new interfSegmentationMenu(mentex5, sizex, sizey, evtHandler, datadir);
81 statictext = getText(mentex, PANEL);
82 statictext1 = getText(mentex1, PANEL1);
83 statictext2 = getText(mentex2, PANEL2);
84 statictext3 = getText(mentex3, PANEL3);
85 statictext4 = getText(mentex4, PANEL4);
86 statictext5 = getText(mentex5, PANEL5);
88 flexsizer->Add(b, wxFIXED_MINSIZE);
89 flexsizer->Add(setMenuTextSizer(mentex, menubar,statictext), wxFIXED_MINSIZE);
91 flexsizer->Add(b1, wxFIXED_MINSIZE);
92 flexsizer->Add(setMenuTextSizer(mentex1, menubar1,statictext1), wxFIXED_MINSIZE);
94 flexsizer->Add(b2, wxFIXED_MINSIZE);
95 flexsizer->Add(setMenuTextSizer(mentex2, menubar2,statictext2), wxFIXED_MINSIZE);
97 flexsizer->Add(b3, wxFIXED_MINSIZE);
98 flexsizer->Add(setMenuTextSizer(mentex3, menubar3,statictext3), wxFIXED_MINSIZE);
100 flexsizer->Add(b4, wxFIXED_MINSIZE);
101 flexsizer->Add(setMenuTextSizer(mentex4, menubar4,statictext4), wxFIXED_MINSIZE);
103 flexsizer->Add(b5, wxFIXED_MINSIZE);
104 flexsizer->Add(setMenuTextSizer(mentex5, menubar5,statictext5), wxFIXED_MINSIZE);
109 infoPanel = new wxPanel(splitterwindow, -1, wxDefaultPosition, wxDefaultSize, wxNO_BORDER, wxString(_T("")));
110 wxFlexGridSizer* infosizer = new wxFlexGridSizer(1,1,2,2);
111 infoPanel->SetSizer(infosizer, true);
112 infoPanel->SetAutoLayout( true );
114 splitterwindow->Initialize(toolpanel);
115 splitterwindow->SetSashGravity(1);
116 splitterwindow->SplitHorizontally(toolpanel, infoPanel);
118 Connect(b->GetId(), wxEVT_COMMAND_BUTTON_CLICKED, (wxObjectEventFunction)&interfMainPanel::onActionButtonPressed1);
119 Connect(b1->GetId(), wxEVT_COMMAND_BUTTON_CLICKED, (wxObjectEventFunction)&interfMainPanel::onActionButtonPressed1);
120 Connect(b2->GetId(), wxEVT_COMMAND_BUTTON_CLICKED, (wxObjectEventFunction)&interfMainPanel::onActionButtonPressed1);
121 Connect(b3->GetId(), wxEVT_COMMAND_BUTTON_CLICKED, (wxObjectEventFunction)&interfMainPanel::onActionButtonPressed1);
122 Connect(b4->GetId(), wxEVT_COMMAND_BUTTON_CLICKED, (wxObjectEventFunction)&interfMainPanel::onActionButtonPressed1);
123 Connect(b5->GetId(), wxEVT_COMMAND_BUTTON_CLICKED, (wxObjectEventFunction)&interfMainPanel::onActionButtonPressed1);
128 interfMainPanel::~interfMainPanel(void)
133 interfMainPanel* interfMainPanel::getInstance(wxWindow* parent, std::string datadir, wxEvtHandler * evtHandler)
135 _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);
137 if(interfmainpanel == NULL){
138 interfmainpanel = new interfMainPanel(_newframe, 350, 900, evtHandler, datadir);
140 _newframe->Show(TRUE);
141 return interfmainpanel;
144 interfMainPanel* interfMainPanel::getInstance(wxWindow* parent, wxEvtHandler * evtHandler)
147 _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 );
149 if(interfmainpanel == NULL){
150 interfmainpanel = new interfMainPanel(_newframe, 350, 900, evtHandler);
152 _newframe->Show(TRUE);
153 return interfmainpanel;
156 bool interfMainPanel::Show(bool show)
158 return _newframe->Show(show);
161 interfMainPanel* interfMainPanel::getInstance()
163 return interfmainpanel;
166 void interfMainPanel :: resetInstance()
168 //delete interfmainpanel;
170 interfmainpanel = NULL;
173 wxPanel* interfMainPanel::initializeToolsPanel(wxWindow* parent, int sizex, int sizey, wxEvtHandler * evtHandler)
175 wxPanel* panel = new wxPanel(parent, -1, wxDefaultPosition, wxSize(sizex, sizey), wxBORDER_SUNKEN, wxString(_T("Spread")));
177 wxFlexGridSizer* flexsizer = new wxFlexGridSizer(2,1,2,2) ;
178 panel->SetSizer(flexsizer, true);
179 panel->SetAutoLayout( true );
181 interfToolsMenu* menu = new interfToolsMenu(panel, sizex, sizey, evtHandler);
182 toolspread = new interfToolsSpreadPanel(panel, sizex, 300, evtHandler);
184 flexsizer->Add(menu, wxFIXED_MINSIZE);
185 flexsizer->Add(toolspread, wxFIXED_MINSIZE);
193 ** Adds a new checkbox to the scrolledwindow using the checkboxsizer
194 ** @Params id of contour
197 void interfMainPanel::addContourCheckBox(std::string id)
199 toolspread->addContourCheckBox(id);
203 ** Removes a checkbox from the list of checkboxes in the flexsizer (checkboxsizer)
204 ** @Params id of contour
207 void interfMainPanel::removeContourCheckBox(std::string id)
209 toolspread->removeContourCheckBox(id);
212 void interfMainPanel::onActionButtonPressed1( wxCommandEvent& event )
214 //((interfToolsMenu*)menubar4)->hideAxis();
215 wxButton* b = (wxButton*)event.GetEventObject();
218 std::string dstring = *((std::string*) b->GetClientData());
221 if(dstring.compare(PANEL)==0){
224 }else if(dstring.compare(PANEL1)==0 ){
227 }else if(dstring.compare(PANEL2)==0){
230 }else if(dstring.compare(PANEL3)==0){
233 }else if(dstring.compare(PANEL4)==0){
236 }else if(dstring.compare(PANEL5)==0){
241 if(wxStrcmp(b->GetLabel(),_T("+"))==0 ){
244 b->SetLabel(_T("-"));
248 b->SetLabel(_T("+"));
251 sizechange *= dmenu->GetSize().GetHeight();
252 splitterwindow->SetSashPosition(splitterwindow->GetSashPosition()+sizechange);
258 wxStaticText* interfMainPanel::getText(wxWindow* parent, std::string nom)
260 return new wxStaticText(parent, -1, wxString(nom.c_str(),wxConvUTF8), wxDefaultPosition,
261 wxDefaultSize, wxALIGN_CENTRE, wxString(nom.c_str(),wxConvUTF8));
264 wxButton* interfMainPanel::getButton(wxWindow* parent)
266 wxButton* b = new wxButton(parent, -1, wxString(_T("-")), wxDefaultPosition, wxDefaultSize, wxBU_EXACTFIT,
267 wxDefaultValidator, wxString(_T("-")));
271 wxPanel* interfMainPanel::setMenuTextSizer(wxWindow* parent, wxPanel* panel, wxStaticText* text)
274 wxFlexGridSizer* flexsizer = new wxFlexGridSizer(2,1,2,2);
275 parent->SetSizer(flexsizer, true);
276 parent->SetAutoLayout( true );
278 flexsizer->Add(text, wxFLEX_GROWMODE_ALL);
279 flexsizer->Add(panel, wxFLEX_GROWMODE_ALL);
282 return (wxPanel*)parent;
286 ** Shows the panel in the
288 void interfMainPanel::showPanel(wxWindow* panel)
290 wxContourMainFrame::getInstance()->showAxis(false);
291 wxSizer* sizer = infoPanel->GetSizer();
293 if(currentWindow != NULL){
294 currentWindow->Hide();
295 sizer->Remove(currentWindow);
298 currentWindow = panel;
299 currentWindow->Show(true);
301 splitterwindow->SetSashPosition(splitterwindow->GetSashPosition()+1);
302 splitterwindow->SetSashPosition(splitterwindow->GetSashPosition()-1);
305 infoPanel->Refresh();
311 ** Hide the panel in the lower box
313 void interfMainPanel::hidePanel( )
315 wxContourMainFrame::getInstance()->showAxis(false);
316 wxSizer* sizer = infoPanel->GetSizer();
318 if(currentWindow != NULL){
319 currentWindow->Hide();
320 sizer->Remove(currentWindow);
322 wxPanel * emptyPanel = new wxPanel(interfMainPanel::getInstance()->getInfoPanel(), -1, wxDefaultPosition, wxDefaultSize, wxBORDER_STATIC, wxString(_T("")));
323 sizer->Add(emptyPanel);
324 currentWindow = emptyPanel;
325 currentWindow->Show(true);
327 splitterwindow->SetSashPosition(splitterwindow->GetSashPosition()+1);
328 splitterwindow->SetSashPosition(splitterwindow->GetSashPosition()-1);
331 infoPanel->Refresh();
337 ** Gets the Information panel
339 wxPanel* interfMainPanel::getInfoPanel()
344 void interfMainPanel::onCreateContourSpline( )
346 wxContourMainFrame::getInstance()->showAxis(false);
347 wxContourMainFrame::getInstance()->onCreateContourSpline();
350 void interfMainPanel::onCreateContourRectangle( )
352 wxContourMainFrame::getInstance()->showAxis(false);
353 wxContourMainFrame::getInstance()->onCreateContourRectangle();
355 void interfMainPanel::onCreateContourCircle( )
357 wxContourMainFrame::getInstance()->showAxis(false);
358 wxContourMainFrame::getInstance()->onCreateContourCircle();
361 void interfMainPanel::onCreateContourLine( )
363 wxContourMainFrame::getInstance()->showAxis(false);
364 wxContourMainFrame::getInstance()->onCreateContourLine();
367 // RaC 09-09 ---------------------
368 void interfMainPanel::onCreateContourPoints( )
370 wxContourMainFrame::getInstance()->showAxis(false);
371 wxContourMainFrame::getInstance()->onCreateContourPoints();
373 // RaC 09-09 ---------------------
375 // RaC 10-09 ---------------------
376 void interfMainPanel::onCreateContourPolygon( )
378 wxContourMainFrame::getInstance()->showAxis(false);
379 wxContourMainFrame::getInstance()->onCreateContourPolygon();
381 // RaC 10-09 ---------------------
383 void interfMainPanel::onCreateContoursBullEye(wxPanel* panBull)
385 wxContourMainFrame::getInstance()->showAxis(false);
386 wxContourMainFrame::getInstance()->onCreateContourBullEye(panBull);
389 void interfMainPanel::onDeleteContour()
391 wxContourMainFrame::getInstance()->showAxis(false);
392 wxContourMainFrame::getInstance()->onDeleteContour();
395 void interfMainPanel::onDeleteContoursActSlice()
397 wxContourMainFrame::getInstance()->showAxis(false);
398 wxContourMainFrame::getInstance()->onDeleteContoursActSlice();
401 void interfMainPanel::onDeleteAllContours()
403 wxContourMainFrame::getInstance()->showAxis(false);
404 wxContourMainFrame::getInstance()->onDeleteAllContours();
407 void interfMainPanel::onCopy()
409 wxContourMainFrame::getInstance()->onCopy();
412 void interfMainPanel::onPaste()
414 wxContourMainFrame::getInstance()->onPaste();
417 void interfMainPanel::onUndo()
419 wxContourMainFrame::getInstance()->onUndo();
422 void interfMainPanel::onRedo()
424 wxContourMainFrame::getInstance()->onRedo();
427 void interfMainPanel::onLoad()
429 wxContourMainFrame::getInstance()->onLoad();
432 void interfMainPanel::onSave()
434 wxContourMainFrame::getInstance()->onSave();
437 void interfMainPanel::RefreshInterface()
439 wxContourMainFrame::getInstance()->RefreshInterface();
442 vtkImageData* interfMainPanel::getImageData()
444 return wxContourMainFrame::getInstance()->getImageData();
447 void interfMainPanel::getImageRange(double range[2] )
449 vtkImageData * img = getImageData();
450 img->GetScalarRange(range);
453 void interfMainPanel::onSegmentationOneSlice(int isovalue,int sampling,int method)
455 wxContourMainFrame::getInstance()->onSegmentationOneSlice(isovalue, sampling, method);
458 void interfMainPanel::onSegmentationOneSliceITK(wxString distance, wxString sigma, wxString alfa, wxString beta, wxString propagation, wxString iterations, wxString inflation)
460 wxContourMainFrame::getInstance()->onSegmentationOneSliceITK(distance, sigma, alfa, beta, propagation, iterations, inflation);
463 int interfMainPanel::GetImageDataSizeZ()
465 return wxContourMainFrame::getInstance()->GetImageDataSizeZ();
468 void interfMainPanel::onSegmentationAllSlice(int minZ,int maxZ,int isovalue,int sampling,int method)
470 wxContourMainFrame::getInstance()->onSegmentationAllSlice(minZ, maxZ,isovalue,sampling,method);
473 void interfMainPanel::setLabelSegmentationPanelVTK(wxString tmpString)
475 ((interfSegmentationPanelVTK*)segmentationPanel)->setLabel(tmpString);
477 void interfMainPanel::onSegmentationPressed()
479 if(segmentPanel == NULL){
480 segmentPanel = new wxPanel(getInfoPanel(), -1, wxDefaultPosition, wxDefaultSize, wxBORDER_STATIC, wxString(_T("")));
481 wxFlexGridSizer* flexsizer = new wxFlexGridSizer(1);
482 segmentPanel->SetSizer(flexsizer, true);
483 segmentPanel->SetAutoLayout(true);
484 segmentPanel->SetEventHandler(this);
486 //wxPanel* panel = contourevent->getSegmentationPanel(segmentPanel);
487 segmentationPanel = new interfSegmentationPanelVTK(segmentPanel);
490 wxStaticText* stattext = new wxStaticText(segmentPanel, -1, wxString(_T(" Automatic Segmentation ")), wxDefaultPosition,
491 wxDefaultSize, wxALIGN_CENTRE|wxBORDER_SIMPLE|wxFULL_REPAINT_ON_RESIZE, wxString(_T("")));
493 flexsizer->Add(stattext,wxALIGN_CENTER | wxALIGN_CENTRE);
494 flexsizer->Add(segmentationPanel, wxEXPAND);
495 segmentPanel->Layout();
497 showPanel(segmentPanel);
498 wxContourMainFrame::getInstance()->showAxis(true);
502 void interfMainPanel::onSegmentationPressedITK()
504 if(segmentPanelITK == NULL){
505 segmentPanelITK = new wxPanel(interfMainPanel::getInstance()->getInfoPanel(), -1, wxDefaultPosition, wxDefaultSize, wxBORDER_STATIC, wxString(_T("")));
508 wxFlexGridSizer* flexsizer = new wxFlexGridSizer(1);
509 segmentPanelITK->SetSizer(flexsizer, true);
510 segmentPanelITK->SetAutoLayout( true );
511 //segmentPanelITK->SetEventHandler(this->contourevent);
513 //wxPanel* panel = contourevent->getSegmentationPanelITK(segmentPanelITK);
514 wxPanel* panel = new interfSegmentationPanelITK(segmentPanelITK);
516 wxStaticText* stattext = new wxStaticText(segmentPanelITK, -1, wxString(_T(" Automatic ITK Segmentation ")), wxDefaultPosition,
517 wxDefaultSize, wxALIGN_CENTRE|wxBORDER_SIMPLE|wxFULL_REPAINT_ON_RESIZE, wxString(_T("")));
519 flexsizer->Add(stattext,wxALIGN_CENTER | wxALIGN_CENTRE);
520 flexsizer->Add(panel, wxEXPAND);
521 segmentPanelITK->Layout();
523 showPanel(segmentPanelITK);
524 wxContourMainFrame::getInstance()->showAxis(true);
528 void interfMainPanel::onRigidPressed()
530 wxContourMainFrame::getInstance()->onRigidPressed();
533 void interfMainPanel::onWidthOfContour(double width)
535 wxContourMainFrame::getInstance()->onWidthOfContour(width);
538 int interfMainPanel::getColorWindow()
540 return wxContourMainFrame::getInstance()->getColorWindow();
542 int interfMainPanel::getWindowLevel()
544 return wxContourMainFrame::getInstance()->getWindowLevel();
546 void interfMainPanel::onBrigthnessColorWindowLevel(int colorwindow,int windowlevel)
548 wxContourMainFrame::getInstance()->onBrigthnessColorWindowLevel(colorwindow, windowlevel);
551 void interfMainPanel::onInterpolation(bool interpolate)
553 wxContourMainFrame::getInstance()->onInterpolation(interpolate);
557 void interfMainPanel::onConfigurationPressed()
559 if(configPanel == NULL){
560 configPanel = new wxPanel(interfMainPanel::getInstance()->getInfoPanel(), -1, wxDefaultPosition, wxDefaultSize, wxNO_BORDER, wxString(_T("")));
561 wxFlexGridSizer* flexsizer = new wxFlexGridSizer(1);
562 configPanel->SetSizer(flexsizer, true);
563 configPanel->SetAutoLayout( true );
564 //configPanel->SetEventHandler(this->contourevent);
565 wxPanel* panel = new interfConfigurationPanel(configPanel);
566 wxStaticText* stattext = new wxStaticText(configPanel, -1, wxString(_T(" Interface Configuration ")), wxDefaultPosition,
567 wxDefaultSize, wxALIGN_CENTRE|wxBORDER_SIMPLE|wxFULL_REPAINT_ON_RESIZE, wxString(_T("")));
568 flexsizer->Add(stattext,wxALIGN_CENTER | wxALIGN_CENTRE);
569 flexsizer->Add(panel, wxEXPAND);
570 configPanel->Layout();
572 showPanel(configPanel);
575 void interfMainPanel::onSpreadPressed()
577 if(spreadPanel==NULL){
579 spreadPanel = new wxPanel(interfMainPanel::getInstance()->getInfoPanel(), -1, wxDefaultPosition, wxDefaultSize, wxBORDER_STATIC, wxString(_T("")));
580 wxFlexGridSizer* flexsizer = new wxFlexGridSizer(1);
581 spreadPanel->SetSizer(flexsizer, true);
582 spreadPanel->SetAutoLayout( true );
583 //spreadPanel->SetEventHandler(this->contourevent);
585 //wxPanel* panel = contourevent->getSpreadPanel(spreadPanel);
586 panelSpread = new interfSpreadPanel(spreadPanel);
589 wxStaticText* stattext = new wxStaticText(spreadPanel, -1, wxString(_T(" Automatic Spread ")), wxDefaultPosition,
590 wxDefaultSize, wxALIGN_CENTRE|wxBORDER_SIMPLE|wxFULL_REPAINT_ON_RESIZE, wxString(_T("")));
592 flexsizer->Add(stattext,wxALIGN_CENTER | wxALIGN_CENTRE);
593 flexsizer->Add(panelSpread, wxEXPAND);
594 spreadPanel->Layout();
596 showPanel(spreadPanel);
600 void interfMainPanel::resetAppend()
602 wxContourMainFrame::getInstance()->resetAppend();
605 void interfMainPanel::onSpreadAdd()
607 wxContourMainFrame::getInstance()->onSpreadAdd();
610 void interfMainPanel::appendStringSpread(std::string val)
612 panelSpread->appendStringSpread(val);
615 void interfMainPanel::onSpreadGo(int type)
617 wxContourMainFrame::getInstance()->onSpreadGo(type);
620 void interfMainPanel::setStringSpread(std::string stringtemp)
622 panelSpread->setStringSpread(stringtemp);
625 void interfMainPanel::onInformationPressed()
630 infoWin = new wxFrame (this, -1,_T(" Statistics "), wxDefaultPosition, wxDefaultSize, wxFRAME_TOOL_WINDOW|wxSYSTEM_MENU | wxCAPTION | wxCLIP_CHILDREN |wxFRAME_FLOAT_ON_PARENT | wxRESIZE_BORDER );
631 infoWin->SetSize( wxSize(825,650) );
633 wxSize sizepanel(825,675);
634 informationPanel = new interfInformationPanel(infoWin);//contourevent->getInformationPanel(infoWin);
636 wxBoxSizer * sizerPanel = new wxBoxSizer(wxHORIZONTAL);
637 sizerPanel -> Add( informationPanel, 1, wxEXPAND ,0);
639 infoWin->SetSizer( sizerPanel );
640 infoWin->SetAutoLayout( true );
645 if (infoWin->IsShown()==true)
647 infoWin->Show(false);
649 //contourevent->FillGridWithContoursInformation();
654 //CMRU 29-08-09-----------------------------------------------------------------------------------------------
657 panelAux = new wxPanel(interfMainPanel::getInstance()->getInfoPanel(), -1, wxDefaultPosition, wxDefaultSize, wxNO_BORDER, wxString(_T("")));
659 //------------------------------------------------------------------------------------------------------------
661 // mask view control panel
662 if(infoPanelMask == NULL){
663 infoPanelMask = new wxPanel(panelAux, -1, wxDefaultPosition, wxDefaultSize, wxNO_BORDER, wxString(_T("")));
664 wxFlexGridSizer* flexsizer = new wxFlexGridSizer(1);
665 infoPanelMask->SetSizer(flexsizer, true);
666 infoPanelMask->SetAutoLayout( true );
667 //configPanel->SetEventHandler(this->contourevent);
668 wxPanel *panel = wxContourMainFrame::getInstance()->getMaskImageViewPanel( infoPanelMask );
669 wxStaticText* stattext = new wxStaticText(infoPanelMask, -1, wxString(_T(" Mask segmentation ")), wxDefaultPosition,
670 wxDefaultSize, wxALIGN_CENTRE|wxBORDER_SIMPLE|wxFULL_REPAINT_ON_RESIZE, wxString(_T("")));
672 flexsizer->Add(stattext,wxALIGN_CENTER | wxALIGN_CENTRE);
674 flexsizer->Add(panel, wxEXPAND);
675 infoPanelMask->Layout();
679 //CMRU 29-08-09-----------------------------------------------------------------------------------------------
681 if(infoPanelCalibration == NULL)
683 infoPanelCalibration = new wxPanel(panelAux, -1, wxDefaultPosition, wxDefaultSize, wxNO_BORDER , wxString(_T("")));
684 wxFlexGridSizer* flexsizer = new wxFlexGridSizer(1);
685 infoPanelCalibration->SetSizer(flexsizer, true);
686 infoPanelCalibration->SetAutoLayout( true );
688 wxPanel *panel = new interfCalibrationPanel(infoPanelCalibration);
689 wxStaticText* stattext = new wxStaticText(infoPanelCalibration, -1, wxString(_T(" Calibration ")), wxDefaultPosition,
690 wxDefaultSize, wxALIGN_CENTRE|wxBORDER_SIMPLE|wxFULL_REPAINT_ON_RESIZE, wxString(_T("")));
692 flexsizer->Add(stattext,wxALIGN_CENTER | wxALIGN_CENTRE);
694 flexsizer->Add(panel, wxEXPAND);
695 infoPanelCalibration->Layout();
698 wxFlexGridSizer* sizer = new wxFlexGridSizer(1);
699 panelAux->SetSizer(sizer, true);
700 panelAux->SetAutoLayout( true );
701 sizer->Add(infoPanelMask);
702 sizer->Add(infoPanelCalibration);
706 //------------------------------------------------------------------
708 wxContourMainFrame::getInstance()->changeInstant();
711 void interfMainPanel::getInstantVector(std::vector<int>& tempVector)
713 wxContourMainFrame::getInstance()->getInstantVector(tempVector);
716 std::vector<std::string> interfMainPanel::getOutlinesName(int slide)
718 return wxContourMainFrame::getInstance()->getOutlinesName(slide);
721 void interfMainPanel::onInformationContourLabels(int typeContourGroup,int selection,int minZ,int maxZ,int grayRangeMin,int grayRangeMax){
722 wxContourMainFrame::getInstance()->onInformationContourLabels(typeContourGroup, selection, minZ, maxZ,grayRangeMin,grayRangeMax);
725 void interfMainPanel::setStringInfoPanel(wxString tmpString)
727 if(informationPanel!=NULL){
728 ((interfInformationPanel*)informationPanel)->setStringInfoPanel(tmpString);
732 void interfMainPanel::setRowLabelInfoPanel(int z, wxString tempString)
734 ((interfInformationPanel*)informationPanel)->setRowLabelInfoPanel(z, tempString);
737 int interfMainPanel::getNumberColsInformationPanel()
739 return ((interfInformationPanel*)informationPanel)->getNumberCols();
742 void interfMainPanel::appendColsInformationPanel(int _numberOfVariablesStatistics)
744 ((interfInformationPanel*)informationPanel)->appendCols(_numberOfVariablesStatistics);
747 void interfMainPanel::setCellValueInfoPanel(int z,int tmpIntA,wxString tempString)
749 ((interfInformationPanel*)informationPanel)->setCellValue(z, tmpIntA, tempString);
752 void interfMainPanel::setColLableInfoPanel(int tmpIntB,wxString tmpTitleString)
754 ((interfInformationPanel*)informationPanel)->setColLabel(tmpIntB, tmpTitleString);
758 void interfMainPanel::SetScalarRange(int grayRangeMin,int grayRangeMax)
760 wxContourMainFrame::getInstance()->SetScalarRange(grayRangeMin, grayRangeMax);
763 void interfMainPanel::onSaveResults(std::string directory,std::string namefile, std::string filename,
764 int typeContourGroup, int selection, int minZ, int maxZ ,bool XYZValues, bool contourImage, bool statistics)
766 wxContourMainFrame::getInstance()->onSaveResults(directory, namefile, filename,
767 typeContourGroup, selection, minZ,maxZ, XYZValues, contourImage, statistics);
770 wxString interfMainPanel::getCellValue(int j,int i){
771 return ((interfInformationPanel*)informationPanel)->getCellValue(j, i );
774 void interfMainPanel::onSnakePressed()
777 wxContourMainFrame::getInstance()->showAxis(axisshown);
778 wxContourMainFrame::getInstance()->onSnakePressed();
781 void interfMainPanel::onMirrorPressed(){
782 if(mirrorPanel==NULL)
785 mirrorPanel = new wxPanel(interfMainPanel::getInstance()->getInfoPanel(), -1, wxDefaultPosition, wxDefaultSize, wxBORDER_STATIC, wxString(_T("")));
786 wxFlexGridSizer* flexsizer = new wxFlexGridSizer(1);
787 mirrorPanel->SetSizer(flexsizer, true);
788 mirrorPanel->SetAutoLayout( true );
789 panelMirror = new interfMirrorPanel(mirrorPanel);
791 wxStaticText* stattext = new wxStaticText(mirrorPanel, -1, wxString(_T(" Mirroring Tool ")), wxDefaultPosition,
792 wxDefaultSize, wxALIGN_CENTRE|wxBORDER_SIMPLE|wxFULL_REPAINT_ON_RESIZE, wxString(_T("")));
794 flexsizer->Add(stattext,wxALIGN_CENTER | wxALIGN_CENTRE);
795 flexsizer->Add(panelMirror, wxEXPAND);
796 mirrorPanel->Layout();
799 wxContourMainFrame::getInstance()->referenceLine();
807 wxContourMainFrame::getInstance()->refLineShow();
812 showPanel(mirrorPanel);
815 void interfMainPanel::onMirror()
817 wxContourMainFrame::getInstance()->onMirror();
820 void interfMainPanel::onMirrorAxisShow()
824 wxContourMainFrame::getInstance()->refLineShow();
829 void interfMainPanel::onMirrorAxisHide()
833 wxContourMainFrame::getInstance()->refLineHide();
838 void interfMainPanel::onMirrorChangeWidth(int width)
840 wxContourMainFrame::getInstance()->refLineChangeWidth(width);
846 void interfMainPanel::onThresholdPressed()
849 // Threshold view control panel
850 if(thresholdPanel == NULL){
851 thresholdPanel = new wxPanel(interfMainPanel::getInstance()->getInfoPanel(), -1, wxDefaultPosition, wxDefaultSize, wxNO_BORDER, wxString(_T("")));
852 wxFlexGridSizer* flexsizer = new wxFlexGridSizer(1);
853 thresholdPanel->SetSizer(flexsizer, true);
854 thresholdPanel->SetAutoLayout( true );
855 //configPanel->SetEventHandler(this->contourevent);
856 wxPanel *panel = wxContourMainFrame::getInstance()->getThresholdImageViewPanel( thresholdPanel );
857 wxStaticText* stattext = new wxStaticText(thresholdPanel, -1, wxString(_T(" Threshold segmentation ")), wxDefaultPosition,
858 wxDefaultSize, wxALIGN_CENTRE|wxBORDER_SIMPLE|wxFULL_REPAINT_ON_RESIZE, wxString(_T("")));
860 flexsizer->Add(stattext,wxALIGN_CENTER | wxALIGN_CENTRE);
862 flexsizer->Add(panel, wxEXPAND);
863 thresholdPanel->Layout();
866 showPanel(thresholdPanel);
867 wxContourMainFrame::getInstance()->changeInstant();
871 void interfMainPanel::ShowResultImages(int typeContourGroup, int selection, int minZ, int maxZ)
873 wxContourMainFrame::getInstance()->ShowResultImages(typeContourGroup, selection, minZ, maxZ);
877 void interfMainPanel::SetContourGroup(int contourGroup)
879 wxContourMainFrame::getInstance()->SetContourGroup( contourGroup);
882 //CMRU 17-08-09 ---------------------------------------------
883 void interfMainPanel::onPrintLabel ()
886 manualBaseModel* manualModel = wxContourMainFrame::getInstance()->getContour();
888 if(manualModel==NULL)
890 wxMessageDialog *dial = new wxMessageDialog(NULL, wxT("Please select a Contour"), wxT("Warning"), wxOK | wxICON_EXCLAMATION);
895 wxTextEntryDialog* dialog = new wxTextEntryDialog(this,_T("Enter a tag name: ")) ;
897 if (dialog->ShowModal() == wxID_OK)
899 label = dialog->GetValue();
903 wxContourMainFrame::getInstance()->onPrintLabel(label,manualModel);
904 wxMessageDialog *dial = new wxMessageDialog(NULL, wxT("The tag name was updated"), wxT("Information"), wxOK | wxICON_INFORMATION);
909 wxMessageDialog *dial = new wxMessageDialog(NULL, wxT("Please enter a valid tag"), wxT("Warning"), wxOK | wxICON_EXCLAMATION);
915 void interfMainPanel::onCalibration(wxString size, int unit)
918 double contourSize = 0.0;
919 double realSizeDouble = 0.0;
921 type = wxContourMainFrame::getInstance()->getType();
922 contourSize = wxContourMainFrame::getInstance()->getContourSizeInPixels();
924 std::cout<<"Cata->TamaƱo del contorno en pixeles:"<<contourSize<<endl;
928 if (size.ToDouble(&realSizeDouble))
932 realSizeDouble = realSizeDouble * 10;
936 realSizeDouble = realSizeDouble * 25.4;
938 std::cout<< "Valor del usuario" << realSizeDouble<< endl ;
939 onePixelSize (realSizeDouble,contourSize);
943 wxMessageDialog *dial = new wxMessageDialog(NULL, wxT("Please enter a numeric value"), wxT("Warning"), wxOK | wxICON_EXCLAMATION);
949 wxMessageDialog *dial = new wxMessageDialog(NULL, wxT("Please select a line contour"), wxT("Warning"), wxOK | wxICON_EXCLAMATION);
953 wxMessageDialog *dial = new wxMessageDialog(NULL, wxT("The calibration was made"), wxT("Information"), wxOK | wxICON_INFORMATION);
955 std::cout<< "Cata-> Se ha realizado la calibracion" << endl ;
958 double interfMainPanel::onePixelSize (double realSize,double sizePixel)
960 _pixelValue = realSize/sizePixel;
961 std::cout<< "Valor del un pixel = " << _pixelValue<< endl ;
962 wxContourMainFrame::getInstance()->onePixelSize (_pixelValue);
966 double interfMainPanel::GetPixelValue()
970 //------------------------------------------------------------------------------------------------------------