+void interfMainPanel::onSnakePressed()
+{
+ axisshown=false;
+ wxContourMainFrame::getInstance()->showAxis(axisshown);
+ wxContourMainFrame::getInstance()->onSnakePressed();
+}
+
+void interfMainPanel::onMirrorPressed(){
+ if(mirrorPanel==NULL)
+ {
+
+ mirrorPanel = new wxPanel(interfMainPanel::getInstance()->getInfoPanel(), -1, wxDefaultPosition, wxDefaultSize, wxBORDER_STATIC, wxString(_T("")));
+ wxFlexGridSizer* flexsizer = new wxFlexGridSizer(1);
+ mirrorPanel->SetSizer(flexsizer, true);
+ mirrorPanel->SetAutoLayout( true );
+ panelMirror = new interfMirrorPanel(mirrorPanel);
+ wxStaticText* stattext = new wxStaticText(mirrorPanel, -1, wxString(_T(" Mirroring Tool ")), wxDefaultPosition,
+ wxDefaultSize, wxALIGN_CENTRE|wxBORDER_SIMPLE|wxFULL_REPAINT_ON_RESIZE, wxString(_T("")));
+
+ flexsizer->Add(stattext,wxALIGN_CENTER | wxALIGN_CENTRE);
+ flexsizer->Add(panelMirror, wxEXPAND);
+ mirrorPanel->Layout();
+ refLineShown=true;
+ wxContourMainFrame::getInstance()->referenceLine();
+ } else {
+ if (!refLineShown)
+ {
+ wxContourMainFrame::getInstance()->refLineShow();
+ refLineShown=true;
+ }
+ } // if mirrorPanel
+
+ showPanel(mirrorPanel);
+}
+
+void interfMainPanel::onMirror()
+{
+ wxContourMainFrame::getInstance()->onMirror();
+}
+
+void interfMainPanel::onMirrorAxisShow()
+{
+ if (!refLineShown)
+ {
+ wxContourMainFrame::getInstance()->refLineShow();
+ refLineShown=true;
+ }
+}
+
+void interfMainPanel::onMirrorAxisHide()
+{
+ if (refLineShown)
+ {
+ wxContourMainFrame::getInstance()->refLineHide();
+ refLineShown=false;
+ }
+}
+
+void interfMainPanel::onMirrorChangeWidth(int width)
+{
+ wxContourMainFrame::getInstance()->refLineChangeWidth(width);
+}
+
+//EED 07/07/2010
+void interfMainPanel::onColorLayerImagePressed()
+{
+ // Color Image Layer view control panel
+ if(colorImageLayerPanel == NULL){
+ colorImageLayerPanel = new wxPanel(interfMainPanel::getInstance()->getInfoPanel(), -1, wxDefaultPosition, wxDefaultSize, wxNO_BORDER, wxString(_T("")));
+ wxFlexGridSizer* flexsizer = new wxFlexGridSizer(1);
+ colorImageLayerPanel->SetSizer(flexsizer, true);
+ colorImageLayerPanel->SetAutoLayout( true );
+ //configPanel->SetEventHandler(this->contourevent);
+ wxPanel *panel = wxContourMainFrame::getInstance()->getColorLayerImageViewPanel( colorImageLayerPanel );
+ wxStaticText* stattext = new wxStaticText(colorImageLayerPanel, -1, wxString(_T(" Color Image Layer ")), wxDefaultPosition,
+ wxDefaultSize, wxALIGN_CENTRE|wxBORDER_SIMPLE|wxFULL_REPAINT_ON_RESIZE, wxString(_T("")));
+ flexsizer->Add(stattext,wxALIGN_CENTER | wxALIGN_CENTRE);
+ flexsizer->Add(panel, wxEXPAND);
+ colorImageLayerPanel->Layout();
+ }
+ showPanel(colorImageLayerPanel);
+ wxContourMainFrame::getInstance()->changeInstant();
+}
+
+//EED01
+void interfMainPanel::onThresholdPressed()
+{
+ // Threshold view control panel
+ if(thresholdPanel == NULL){
+ thresholdPanel = new wxPanel(interfMainPanel::getInstance()->getInfoPanel(), -1, wxDefaultPosition, wxDefaultSize, wxNO_BORDER, wxString(_T("")));
+ wxFlexGridSizer* flexsizer = new wxFlexGridSizer(1);
+ thresholdPanel->SetSizer(flexsizer, true);
+ thresholdPanel->SetAutoLayout( true );
+ //configPanel->SetEventHandler(this->contourevent);
+ wxPanel *panel = wxContourMainFrame::getInstance()->getThresholdImageViewPanel( thresholdPanel );
+ wxStaticText* stattext = new wxStaticText(thresholdPanel, -1, wxString(_T(" Threshold segmentation ")), wxDefaultPosition,
+ wxDefaultSize, wxALIGN_CENTRE|wxBORDER_SIMPLE|wxFULL_REPAINT_ON_RESIZE, wxString(_T("")));
+ flexsizer->Add(stattext,wxALIGN_CENTER | wxALIGN_CENTRE);
+ flexsizer->Add(panel, wxEXPAND);
+ thresholdPanel->Layout();
+ }
+ showPanel(thresholdPanel);
+ wxContourMainFrame::getInstance()->changeInstant();
+}
+
+
+void interfMainPanel::ShowResultImages(int typeContourGroup, int selection, int minZ, int maxZ)
+{
+ wxContourMainFrame::getInstance()->ShowResultImages(typeContourGroup, selection, minZ, maxZ);
+}
+
+
+void interfMainPanel::SetContourGroup(int contourGroup)
+{
+ wxContourMainFrame::getInstance()->SetContourGroup( contourGroup);
+}
+
+
+void interfMainPanel::onFlipContours()
+{
+ printf("EED interfMainPanel::onFlipContours() \n");
+ if(flipPanel==NULL)
+ {
+ flipPanel = new wxPanel(interfMainPanel::getInstance()->getInfoPanel(), -1, wxDefaultPosition,
+ wxDefaultSize, wxBORDER_STATIC, wxString(_T("")));
+ wxFlexGridSizer* flexsizer = new wxFlexGridSizer(1);
+ flipPanel->SetSizer(flexsizer, true);
+ flipPanel->SetAutoLayout( true );
+ panelFlip = new interfFlipPanel(flipPanel);
+ wxStaticText* stattext = new wxStaticText(flipPanel, -1,
+ wxString(_T(" Flip Contours ")),
+ wxDefaultPosition, wxDefaultSize,
+ wxALIGN_CENTRE|wxBORDER_SIMPLE|wxFULL_REPAINT_ON_RESIZE, wxString(_T("")));
+ flexsizer->Add(stattext,wxALIGN_CENTER | wxALIGN_CENTRE);
+ flexsizer->Add(panelFlip, wxEXPAND);
+ flipPanel->Layout();
+ }
+ showPanel(flipPanel);
+}
+
+
+void interfMainPanel::FlipContours(int typeContourFlip, int flipDirection)
+{
+ printf("EED interfMainPanel::FlipContours( %d , %d ) \n",typeContourFlip, flipDirection );
+ wxContourMainFrame::getInstance()->FlipContours( typeContourFlip , flipDirection );
+}
+
+
+
+//CMRU 17-08-09 ---------------------------------------------
+void interfMainPanel::onPrintLabel ()
+{
+ wxString label;
+ manualBaseModel* manualModel = wxContourMainFrame::getInstance()->getContour();
+
+ if(manualModel==NULL)
+ {
+ wxMessageDialog *dial = new wxMessageDialog(NULL, wxT("Please select a Contour"), wxT("Warning"), wxOK | wxICON_EXCLAMATION);
+ dial->ShowModal();
+ return;
+ }
+
+ wxTextEntryDialog* dialog = new wxTextEntryDialog(this,_T("Enter a tag name: ")) ;
+
+ if (dialog->ShowModal() == wxID_OK)
+ {
+ label = dialog->GetValue();
+
+ if(label.Len()!=0)
+ {
+ wxContourMainFrame::getInstance()->onPrintLabel(label,manualModel);
+ wxMessageDialog *dial = new wxMessageDialog(NULL, wxT("The tag name was updated"), wxT("Information"), wxOK | wxICON_INFORMATION);
+ dial->ShowModal();
+ }
+ else
+ {
+ wxMessageDialog *dial = new wxMessageDialog(NULL, wxT("Please enter a valid tag"), wxT("Warning"), wxOK | wxICON_EXCLAMATION);
+ dial->ShowModal();
+ }
+ }
+}
+
+void interfMainPanel::onCalibration(wxString size, int unit)
+{
+ int type = 0;
+ double contourSize = 0.0;
+ double realSizeDouble = 0.0;
+
+ type = wxContourMainFrame::getInstance()->getType();
+ contourSize = wxContourMainFrame::getInstance()->getContourSizeInPixels();
+
+ std::cout<<"Cata->Tama�o del contorno en pixeles:"<<contourSize<<endl;
+
+ if ( type == 6 )
+ {
+ if (size.ToDouble(&realSizeDouble))
+ {
+ if(unit==1)
+ {
+ realSizeDouble = realSizeDouble * 10;
+ }
+ if(unit==2)
+ {
+ realSizeDouble = realSizeDouble * 25.4;
+ }
+ std::cout<< "Valor del usuario" << realSizeDouble<< endl ;
+ onePixelSize (realSizeDouble,contourSize);
+ }
+ else
+ {
+ wxMessageDialog *dial = new wxMessageDialog(NULL, wxT("Please enter a numeric value"), wxT("Warning"), wxOK | wxICON_EXCLAMATION);
+ dial->ShowModal();
+ }
+ }
+ else
+ {
+ wxMessageDialog *dial = new wxMessageDialog(NULL, wxT("Please select a line contour"), wxT("Warning"), wxOK | wxICON_EXCLAMATION);
+ dial->ShowModal();
+ }
+
+ wxMessageDialog *dial = new wxMessageDialog(NULL, wxT("The calibration was made"), wxT("Information"), wxOK | wxICON_INFORMATION);
+ dial->ShowModal();
+ std::cout<< "Cata-> Se ha realizado la calibracion" << endl ;
+}
+
+double interfMainPanel::onePixelSize (double realSize,double sizePixel)
+{
+ _pixelValue = realSize/sizePixel;
+ std::cout<< "Valor del un pixel = " << _pixelValue<< endl ;
+ wxContourMainFrame::getInstance()->onePixelSize (_pixelValue);
+ return _pixelValue ;
+}
+
+double interfMainPanel::GetPixelValue()
+{
+ return _pixelValue;