From 7ef64acb00d37e665e0bf019b9a7ede2495bf155 Mon Sep 17 00:00:00 2001 From: Eduardo DAVILA Date: Wed, 22 Nov 2017 15:37:59 +0100 Subject: [PATCH] #3140 creaContours Feature New Normal - branch vtk7itk4wx3 --- .../interfImageToolsMenu.cxx | 14 +- .../interfMainPanel.cxx | 143 ++++++------- .../interfMenuBar.h | 25 ++- .../interfNewContourMenu.cxx | 48 ++--- .../interfSegmentationPanels.cxx | 80 ++----- .../interfSegmentationPanels.h | 61 ++---- .../interfToolsPanels.cxx | 102 ++++++--- .../interfToolsPanels.h | 21 +- .../wxContourMainFrame.cxx | 27 +-- .../wxContourMainFrame.h | 29 +-- .../wxContourViewPanel.cxx | 9 +- .../wxContourViewPanel.h | 14 +- .../wxVtkBaseView_SceneManager.cxx | 22 +- .../KernelManagerContour.cxx | 199 ++++++++---------- 14 files changed, 361 insertions(+), 433 deletions(-) diff --git a/lib/Interface_Icons_NDimensions/interfImageToolsMenu.cxx b/lib/Interface_Icons_NDimensions/interfImageToolsMenu.cxx index 8a9d563..32f8294 100644 --- a/lib/Interface_Icons_NDimensions/interfImageToolsMenu.cxx +++ b/lib/Interface_Icons_NDimensions/interfImageToolsMenu.cxx @@ -44,8 +44,9 @@ interfImageToolsMenu::interfImageToolsMenu(wxWindow * parent, int sizex, int siz initButtons(this); } -void interfImageToolsMenu::initButtons(wxEvtHandler* evtHandler) { - +void interfImageToolsMenu::initButtons(wxEvtHandler* evtHandler) +{ +printf("EED interfImageToolsMenu::initButtons start\n"); std::vector path, nom; std::vector funct; @@ -82,13 +83,10 @@ void interfImageToolsMenu::initButtons(wxEvtHandler* evtHandler) { nom.push_back("Show help page with information about the tools"); funct.push_back((wxObjectEventFunction) &interfImageToolsMenu:: onHelpPressed); - this->addButtons(path, nom); this->setVectorFunction(funct); - this->connectEvents(evtHandler); - - +printf("EED interfImageToolsMenu::initButtons End\n"); } interfImageToolsMenu::~interfImageToolsMenu() @@ -121,7 +119,9 @@ void interfSegmentationMenu::onSnakePressed(wxCommandEvent& event) void interfImageToolsMenu::onInformationPressed(wxCommandEvent& event) { +printf("EED interfImageToolsMenu::onInformationPressed start\n"); interfMainPanel::getInstance()->onInformationPressed(); +printf("EED interfImageToolsMenu::onInformationPressed end\n"); } void interfImageToolsMenu::onConfigurationPressed(wxCommandEvent& event) @@ -141,7 +141,7 @@ void interfImageToolsMenu::onColorLayerImage(wxCommandEvent& event) void interfImageToolsMenu::onHelpPressed(wxCommandEvent& event) { - wxLaunchDefaultBrowser(_T("http://www.creatis.insa-lyon.fr/site/fr/EndUserGuide"), 0); + wxLaunchDefaultBrowser(_T("http://www.creatis.insa-lyon.fr/site7/fr/EndUserGuide"), 0); } //------------------------------------------------------------------------------------------------------------ diff --git a/lib/Interface_Icons_NDimensions/interfMainPanel.cxx b/lib/Interface_Icons_NDimensions/interfMainPanel.cxx index 64fb2ee..b9123cb 100644 --- a/lib/Interface_Icons_NDimensions/interfMainPanel.cxx +++ b/lib/Interface_Icons_NDimensions/interfMainPanel.cxx @@ -61,21 +61,12 @@ interfMainPanel::interfMainPanel(wxWindow * parent, int sizex, int sizey, wxEvtH panelAux = NULL; //-------------------------------------------------------------------------------- splitterwindow = new wxSplitterWindow(this,-1, wxDefaultPosition, wxSize(sizex, sizey), wxSP_3DSASH, wxString(_T(""))); - splitterwindow->SetMinimumPaneSize( 10 ); sizey = sizey/8; - wxPanel* toolpanel = new wxPanel(splitterwindow, -1, wxDefaultPosition, wxDefaultSize, wxBORDER_DOUBLE, wxString(_T(""))); - -//EED 2017-09-16 Migration wxWidgets 2.8 to 3.0 -#if wxMAJOR_VERSION <= 2 - wxFlexGridSizer* flexsizer = new wxFlexGridSizer(6,2,1,1); -#else - wxFlexGridSizer* flexsizer = new wxFlexGridSizer(6); -#endif + wxFlexGridSizer* flexsizer = new wxFlexGridSizer(20,2,1,1); toolpanel->SetSizer(flexsizer, true); toolpanel->SetAutoLayout( true ); - wxButton* b = getButton(toolpanel); b->SetClientData(&PANEL); wxButton* b1 = getButton(toolpanel); @@ -91,7 +82,6 @@ interfMainPanel::interfMainPanel(wxWindow * parent, int sizex, int sizey, wxEvtH //EED 07/07/2010 wxButton* b6 = getButton(toolpanel); b6->SetClientData(&PANEL6); - wxPanel* mentex = new wxPanel(toolpanel, -1, wxDefaultPosition, wxDefaultSize, wxBORDER_NONE, wxString(_T(""))); wxPanel* mentex1 = new wxPanel(toolpanel, -1, wxDefaultPosition, wxDefaultSize, wxBORDER_NONE, wxString(_T(""))); wxPanel* mentex2 = new wxPanel(toolpanel, -1, wxDefaultPosition, wxDefaultSize, wxBORDER_NONE, wxString(_T(""))); @@ -100,7 +90,6 @@ interfMainPanel::interfMainPanel(wxWindow * parent, int sizex, int sizey, wxEvtH wxPanel* mentex5 = new wxPanel(toolpanel, -1, wxDefaultPosition, wxDefaultSize, wxBORDER_NONE, wxString(_T(""))); //EED 07/07/2010 wxPanel* mentex6 = new wxPanel(toolpanel, -1, wxDefaultPosition, wxDefaultSize, wxBORDER_NONE, wxString(_T(""))); - menubar = new interfNewContourMenu (mentex, sizex, sizey, evtHandler, datadir); menubar1 = new interfIOMenu (mentex1, sizex, sizey, evtHandler, datadir); menubar2 = new interfEditMenu (mentex2, sizex, sizey, evtHandler, datadir); @@ -108,7 +97,6 @@ interfMainPanel::interfMainPanel(wxWindow * parent, int sizex, int sizey, wxEvtH menubar4 = new interfToolsMenu (mentex4, sizex ,sizey, evtHandler, datadir); menubar5 = new interfSegmentationMenu(mentex5, sizex, sizey, evtHandler, datadir); menubar6 = new interfImageToolsMenu(mentex6, sizex, sizey, evtHandler, datadir); - statictext = getText(mentex, PANEL); statictext1 = getText(mentex1, PANEL1); statictext2 = getText(mentex2, PANEL2); @@ -116,41 +104,31 @@ interfMainPanel::interfMainPanel(wxWindow * parent, int sizex, int sizey, wxEvtH statictext4 = getText(mentex4, PANEL4); statictext5 = getText(mentex5, PANEL5); statictext6 = getText(mentex6, PANEL6); - flexsizer->Add(b, wxFIXED_MINSIZE); flexsizer->Add(setMenuTextSizer(mentex, menubar,statictext), wxFIXED_MINSIZE); - flexsizer->Add(b1, wxFIXED_MINSIZE); flexsizer->Add(setMenuTextSizer(mentex1, menubar1,statictext1), wxFIXED_MINSIZE); - flexsizer->Add(b2, wxFIXED_MINSIZE); flexsizer->Add(setMenuTextSizer(mentex2, menubar2,statictext2), wxFIXED_MINSIZE); - flexsizer->Add(b3, wxFIXED_MINSIZE); flexsizer->Add(setMenuTextSizer(mentex3, menubar3,statictext3), wxFIXED_MINSIZE); - flexsizer->Add(b4, wxFIXED_MINSIZE); flexsizer->Add(setMenuTextSizer(mentex4, menubar4,statictext4), wxFIXED_MINSIZE); - flexsizer->Add(b5, wxFIXED_MINSIZE); flexsizer->Add(setMenuTextSizer(mentex5, menubar5,statictext5), wxFIXED_MINSIZE); flexsizer->Add(b6, wxFIXED_MINSIZE); flexsizer->Add(setMenuTextSizer(mentex6, menubar6,statictext6), wxFIXED_MINSIZE); - toolpanel->Update(); toolpanel->Layout(); - infoPanel = new wxPanel(splitterwindow, -1, wxDefaultPosition, wxDefaultSize, wxBORDER_DOUBLE, wxString(_T(""))); wxFlexGridSizer* infosizer = new wxFlexGridSizer(1,1,2,2); infoPanel->SetSizer(infosizer, true); infoPanel->SetAutoLayout( true ); - splitterwindow->Initialize(toolpanel); splitterwindow->SetSashGravity(1); //EED splitterwindow->SetSashPosition(600); splitterwindow->SetSashSize(5); splitterwindow->SplitHorizontally(toolpanel, infoPanel,8*73); - Connect(b->GetId(), wxEVT_COMMAND_BUTTON_CLICKED, (wxObjectEventFunction)&interfMainPanel::onActionButtonPressed1); Connect(b1->GetId(), wxEVT_COMMAND_BUTTON_CLICKED, (wxObjectEventFunction)&interfMainPanel::onActionButtonPressed1); Connect(b2->GetId(), wxEVT_COMMAND_BUTTON_CLICKED, (wxObjectEventFunction)&interfMainPanel::onActionButtonPressed1); @@ -158,7 +136,6 @@ interfMainPanel::interfMainPanel(wxWindow * parent, int sizex, int sizey, wxEvtH Connect(b4->GetId(), wxEVT_COMMAND_BUTTON_CLICKED, (wxObjectEventFunction)&interfMainPanel::onActionButtonPressed1); Connect(b5->GetId(), wxEVT_COMMAND_BUTTON_CLICKED, (wxObjectEventFunction)&interfMainPanel::onActionButtonPressed1); Connect(b6->GetId(), wxEVT_COMMAND_BUTTON_CLICKED, (wxObjectEventFunction)&interfMainPanel::onActionButtonPressed1); - this->Layout(); } @@ -170,8 +147,8 @@ interfMainPanel::~interfMainPanel(void) interfMainPanel* interfMainPanel::getInstance(wxWindow* parent, std::string datadir, wxEvtHandler * evtHandler) { _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); - - if(interfmainpanel == NULL){ + if(interfmainpanel == NULL) + { interfmainpanel = new interfMainPanel(_newframe, 350, 900, evtHandler, datadir); } _newframe->Show(TRUE); @@ -180,10 +157,9 @@ interfMainPanel* interfMainPanel::getInstance(wxWindow* parent, std::string data interfMainPanel* interfMainPanel::getInstance(wxWindow* parent, wxEvtHandler * evtHandler) { - _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 ); - - if(interfmainpanel == NULL){ + if(interfmainpanel == NULL) + { interfmainpanel = new interfMainPanel(_newframe, 350, 900, evtHandler); } _newframe->Show(TRUE); @@ -210,19 +186,14 @@ void interfMainPanel :: resetInstance() wxPanel* interfMainPanel::initializeToolsPanel(wxWindow* parent, int sizex, int sizey, wxEvtHandler * evtHandler) { wxPanel* panel = new wxPanel(parent, -1, wxDefaultPosition, wxSize(sizex, sizey), wxBORDER_SUNKEN, wxString(_T("Spread"))); - wxFlexGridSizer* flexsizer = new wxFlexGridSizer(2,1,2,2) ; panel->SetSizer(flexsizer, true); panel->SetAutoLayout( true ); - - interfToolsMenu* menu = new interfToolsMenu(panel, sizex, sizey, evtHandler); - toolspread = new interfToolsSpreadPanel(panel, sizex, 300, evtHandler); - + interfToolsMenu *menu = new interfToolsMenu(panel, sizex, sizey, evtHandler); + toolspread = new interfToolsSpreadPanel(panel, sizex, 300, evtHandler); flexsizer->Add(menu, wxFIXED_MINSIZE); flexsizer->Add(toolspread, wxFIXED_MINSIZE); - panel->Layout(); - return panel; } @@ -310,14 +281,11 @@ wxButton* interfMainPanel::getButton(wxWindow* parent) wxPanel* interfMainPanel::setMenuTextSizer(wxWindow* parent, wxPanel* panel, wxStaticText* text) { - wxFlexGridSizer* flexsizer = new wxFlexGridSizer(2,1,2,2); parent->SetSizer(flexsizer, true); parent->SetAutoLayout( true ); - flexsizer->Add(text, wxFLEX_GROWMODE_ALL); flexsizer->Add(panel, wxFLEX_GROWMODE_ALL); - parent->Layout(); return (wxPanel*)parent; } @@ -329,8 +297,8 @@ void interfMainPanel::showPanel(wxWindow* panel) { wxContourMainFrame::getInstance()->showAxis(false); wxSizer* sizer = infoPanel->GetSizer(); - - if(currentWindow != NULL){ + if(currentWindow != NULL) + { currentWindow->Hide(); /// \TODO fix warning: virtual bool wxSizer::Remove(wxWindow*) is deprecated //EED 2017-09-16 Migration wxWidgets 2.8 to 3.0 @@ -339,15 +307,12 @@ void interfMainPanel::showPanel(wxWindow* panel) #else sizer->Detach(currentWindow); #endif - - } + } // if currentWindow sizer->Add(panel); currentWindow = panel; currentWindow->Show(true); - splitterwindow->SetSashPosition(splitterwindow->GetSashPosition()+1); splitterwindow->SetSashPosition(splitterwindow->GetSashPosition()-1); - infoPanel->Layout(); infoPanel->Refresh(); this->Layout(); @@ -361,8 +326,8 @@ void interfMainPanel::hidePanel( ) { wxContourMainFrame::getInstance()->showAxis(false); wxSizer* sizer = infoPanel->GetSizer(); - - if(currentWindow != NULL){ + if(currentWindow != NULL) + { currentWindow->Hide(); /// \TODO fix warning: virtual bool wxSizer::Remove(wxWindow*) is deprecated //EED 2017-09-16 Migration wxWidgets 2.8 to 3.0 @@ -377,10 +342,8 @@ void interfMainPanel::hidePanel( ) sizer->Add(emptyPanel); currentWindow = emptyPanel; currentWindow->Show(true); - splitterwindow->SetSashPosition(splitterwindow->GetSashPosition()+1); splitterwindow->SetSashPosition(splitterwindow->GetSashPosition()-1); - infoPanel->Layout(); infoPanel->Refresh(); this->Layout(); @@ -555,26 +518,25 @@ void interfMainPanel::setLabelSegmentationPanelVTK(wxString tmpString) { ((interfSegmentationPanelVTK*)segmentationPanel)->setLabel(tmpString); } + void interfMainPanel::onSegmentationPressed() { - if(segmentPanel == NULL){ + if(segmentPanel == NULL) + { segmentPanel = new wxPanel(getInfoPanel(), -1, wxDefaultPosition, wxDefaultSize, wxBORDER_STATIC, wxString(_T(""))); wxFlexGridSizer* flexsizer = new wxFlexGridSizer(1); segmentPanel->SetSizer(flexsizer, true); segmentPanel->SetAutoLayout(true); segmentPanel->SetEventHandler(this); - //wxPanel* panel = contourevent->getSegmentationPanel(segmentPanel); segmentationPanel = new interfSegmentationPanelVTK(segmentPanel); - - wxStaticText* stattext = new wxStaticText(segmentPanel, -1, wxString(_T(" Automatic Segmentation ")), wxDefaultPosition, wxDefaultSize, wxALIGN_CENTRE|wxBORDER_SIMPLE|wxFULL_REPAINT_ON_RESIZE, wxString(_T(""))); flexsizer->Add(stattext,wxALIGN_CENTER | wxALIGN_CENTRE); flexsizer->Add(segmentationPanel, wxEXPAND); segmentPanel->Layout(); - } + }// if segmentPanel showPanel(segmentPanel); wxContourMainFrame::getInstance()->showAxis(true); axisshown = true; @@ -582,10 +544,9 @@ void interfMainPanel::onSegmentationPressed() void interfMainPanel::onSegmentationPressedITK() { - if(segmentPanelITK == NULL){ + if(segmentPanelITK == NULL) + { segmentPanelITK = new wxPanel(interfMainPanel::getInstance()->getInfoPanel(), -1, wxDefaultPosition, wxDefaultSize, wxBORDER_STATIC, wxString(_T(""))); - - wxFlexGridSizer* flexsizer = new wxFlexGridSizer(1); segmentPanelITK->SetSizer(flexsizer, true); segmentPanelITK->SetAutoLayout( true ); @@ -600,7 +561,7 @@ void interfMainPanel::onSegmentationPressedITK() flexsizer->Add(stattext,wxALIGN_CENTER | wxALIGN_CENTRE); flexsizer->Add(panel, wxEXPAND); segmentPanelITK->Layout(); - } + }// if segmentPanelITK showPanel(segmentPanelITK); wxContourMainFrame::getInstance()->showAxis(true); axisshown = true; @@ -637,7 +598,8 @@ void interfMainPanel::onInterpolation(bool interpolate) void interfMainPanel::onConfigurationPressed() { - if(configPanel == NULL){ + if(configPanel == NULL) + { configPanel = new wxPanel(interfMainPanel::getInstance()->getInfoPanel(), -1, wxDefaultPosition, wxDefaultSize, wxNO_BORDER, wxString(_T(""))); wxFlexGridSizer* flexsizer = new wxFlexGridSizer(1); configPanel->SetSizer(flexsizer, true); @@ -649,31 +611,27 @@ void interfMainPanel::onConfigurationPressed() flexsizer->Add(stattext,wxALIGN_CENTER | wxALIGN_CENTRE); flexsizer->Add(panel, wxEXPAND); configPanel->Layout(); - } + }// if configPanel showPanel(configPanel); } void interfMainPanel::onSpreadPressed() { - if(spreadPanel==NULL){ - + if(spreadPanel==NULL) + { spreadPanel = new wxPanel(interfMainPanel::getInstance()->getInfoPanel(), -1, wxDefaultPosition, wxDefaultSize, wxBORDER_STATIC, wxString(_T(""))); wxFlexGridSizer* flexsizer = new wxFlexGridSizer(1); spreadPanel->SetSizer(flexsizer, true); spreadPanel->SetAutoLayout( true ); //spreadPanel->SetEventHandler(this->contourevent); - //wxPanel* panel = contourevent->getSpreadPanel(spreadPanel); panelSpread = new interfSpreadPanel(spreadPanel); - - wxStaticText* stattext = new wxStaticText(spreadPanel, -1, wxString(_T(" Automatic Spread ")), wxDefaultPosition, wxDefaultSize, wxALIGN_CENTRE|wxBORDER_SIMPLE|wxFULL_REPAINT_ON_RESIZE, wxString(_T(""))); - flexsizer->Add(stattext,wxALIGN_CENTER | wxALIGN_CENTRE); flexsizer->Add(panelSpread, wxEXPAND); spreadPanel->Layout(); - } + } // spreadPanel showPanel(spreadPanel); //hideAxis(); } @@ -711,39 +669,54 @@ void interfMainPanel::setStringSpread(std::string stringtemp) void interfMainPanel::onInformationPressed() { - +printf("EED interfMainPanel::onInformationPressed Start\n"); // Statistics frame - if(infoWin ==NULL){ + if(infoWin ==NULL) + { +printf("EED interfMainPanel::onInformationPressed 0.1\n"); infoWin = new wxFrame (this, -1,_T(" Statistics "), wxDefaultPosition, wxDefaultSize, wxFRAME_TOOL_WINDOW|wxSYSTEM_MENU | wxCAPTION | wxCLIP_CHILDREN |wxFRAME_FLOAT_ON_PARENT | wxRESIZE_BORDER ); +printf("EED interfMainPanel::onInformationPressed 0.2\n"); infoWin->SetSize( wxSize(825,650) ); wxSize sizepanel(825,675); +printf("EED interfMainPanel::onInformationPressed 0.3\n"); informationPanel = new interfInformationPanel(infoWin);//contourevent->getInformationPanel(infoWin); +printf("EED interfMainPanel::onInformationPressed 0.3a\n"); wxBoxSizer * sizerPanel = new wxBoxSizer(wxHORIZONTAL); sizerPanel -> Add( informationPanel, 1, wxEXPAND ,0); +printf("EED interfMainPanel::onInformationPressed 0.4\n"); infoWin->SetSizer( sizerPanel ); +printf("EED interfMainPanel::onInformationPressed 0.41\n"); infoWin->SetAutoLayout( true ); +printf("EED interfMainPanel::onInformationPressed 0.42\n"); infoWin->Layout(); +printf("EED interfMainPanel::onInformationPressed 0.43\n"); infoWin->Show(); }else { +printf("EED interfMainPanel::onInformationPressed 0.5\n"); if (infoWin->IsShown()==true) { +printf("EED interfMainPanel::onInformationPressed 0.6\n"); infoWin->Show(false); } else { //contourevent->FillGridWithContoursInformation(); +printf("EED interfMainPanel::onInformationPressed 0.7\n"); infoWin->Show(true); } } +printf("EED interfMainPanel::onInformationPressed 1\n"); + //CMRU 29-08-09----------------------------------------------------------------------------------------------- if(panelAux == NULL) { panelAux = new wxPanel(interfMainPanel::getInstance()->getInfoPanel(), -1, wxDefaultPosition, wxDefaultSize, wxNO_BORDER, wxString(_T(""))); } //------------------------------------------------------------------------------------------------------------ +printf("EED interfMainPanel::onInformationPressed 2\n"); // mask view control panel if(infoPanelMask == NULL){ @@ -763,6 +736,7 @@ void interfMainPanel::onInformationPressed() } +printf("EED interfMainPanel::onInformationPressed 3\n"); //CMRU 29-08-09----------------------------------------------------------------------------------------------- //Calibration panel if(infoPanelCalibration == NULL) @@ -771,7 +745,6 @@ void interfMainPanel::onInformationPressed() wxFlexGridSizer* flexsizer = new wxFlexGridSizer(1); infoPanelCalibration->SetSizer(flexsizer, true); infoPanelCalibration->SetAutoLayout( true ); - wxPanel *panel = new interfCalibrationPanel(infoPanelCalibration); wxStaticText* stattext = new wxStaticText(infoPanelCalibration, -1, wxString(_T(" Calibration ")), wxDefaultPosition, wxDefaultSize, wxALIGN_CENTRE|wxBORDER_SIMPLE|wxFULL_REPAINT_ON_RESIZE, wxString(_T(""))); @@ -781,20 +754,32 @@ void interfMainPanel::onInformationPressed() flexsizer->Add(panel, wxEXPAND); infoPanelCalibration->Layout(); } +printf("EED interfMainPanel::onInformationPressed 4\n"); +//EED 2017-09-16 Migration wxWidgets 2.8 to 3.0 +#if wxMAJOR_VERSION <= 2 wxFlexGridSizer* sizer = new wxFlexGridSizer(1); - panelAux->SetSizer(sizer, true); - panelAux->SetAutoLayout( true ); +#else + wxFlexGridSizer* sizer = new wxFlexGridSizer(2); +#endif sizer->Add(infoPanelMask); +printf("EED interfMainPanel::onInformationPressed 4.1\n"); sizer->Add(infoPanelCalibration); - +printf("EED interfMainPanel::onInformationPressed 4.2\n"); + panelAux->SetSizer(sizer, true); +printf("EED interfMainPanel::onInformationPressed 4.3\n"); + panelAux->SetAutoLayout( true ); +printf("EED interfMainPanel::onInformationPressed 4.4\n"); showPanel(panelAux); +printf("EED interfMainPanel::onInformationPressed 4.5\n"); //------------------------------------------------------------------ - +printf("EED interfMainPanel::onInformationPressed OOJJOOOOOOOOOO......\n"); wxContourMainFrame::getInstance()->changeInstant(); +printf("EED interfMainPanel::onInformationPressed End\n"); } + void interfMainPanel::getInstantVector(std::vector& tempVector) { wxContourMainFrame::getInstance()->getInstantVector(tempVector); @@ -874,27 +859,21 @@ void interfMainPanel::onMirrorPressed(){ 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 - { - + } else { if (!refLineShown) { wxContourMainFrame::getInstance()->refLineShow(); refLineShown=true; } - } + } // if mirrorPanel showPanel(mirrorPanel); } diff --git a/lib/Interface_Icons_NDimensions/interfMenuBar.h b/lib/Interface_Icons_NDimensions/interfMenuBar.h index 7ce218c..d3b054e 100644 --- a/lib/Interface_Icons_NDimensions/interfMenuBar.h +++ b/lib/Interface_Icons_NDimensions/interfMenuBar.h @@ -69,12 +69,12 @@ public: //RaC 11-09 //This constructor function as well but it is neccessary to change vpath.size() by 6 //flexsizer = new wxFlexGridSizer(2,vpath.size(),2,2); - flexsizer = new wxFlexGridSizer(6); + flexsizer = new wxFlexGridSizer(5); this->SetSizer(flexsizer, true); this->SetAutoLayout( true ); - //first row of the sizer, the buttons are being added - for(int i = 0; i < (int)(vpath.size());i++){ + for(int i = 0; i < (int)(vpath.size());i++) + { std::string p = vpath[i]; wxBitmapButton* bitmapbutton = this->getButton(p, sizex, sizey); flexsizer->Add(bitmapbutton,wxFIXED_MINSIZE); @@ -82,7 +82,8 @@ public: } //second row of the sizer, the names are being added - for(int i = 0; i < (int)(vnom.size()); i++){ + for(int i = 0; i < (int)(vnom.size()); i++) + { //sizex = vectbutton[i]->GetSize().GetWidth(); std::string n = vnom[i]; vectbutton[i]->SetToolTip(wxString(n.c_str(),wxConvUTF8)); @@ -99,10 +100,9 @@ public: ** @param int y indicates the y coordinate where the button should be located **/ - virtual wxBitmapButton* getButton(std::string imgpath, int sizex, int sizey){ - vectimgpath.push_back(imgpath); - - + virtual wxBitmapButton* getButton(std::string imgpath, int sizex, int sizey) + { + vectimgpath.push_back(imgpath); wxBitmap* bitmap = new wxBitmap(wxString(imgpath.c_str(),wxConvUTF8), wxBITMAP_TYPE_PNG); //wxSize(sizex,sizey) @@ -120,7 +120,8 @@ public: ** @param int sizex size of the text ** @param int sizey size of the text **/ - virtual wxStaticText* getText(std::string nom, int sizex, int sizey){ + virtual wxStaticText* getText(std::string nom, int sizex, int sizey) + { vectnom.push_back(nom); return new wxStaticText(this, -1, wxString(nom.c_str(),wxConvUTF8), wxDefaultPosition, wxSize(sizex,sizey), wxALIGN_CENTRE, wxString(nom.c_str(),wxConvUTF8)); @@ -130,8 +131,10 @@ public: ** they must be ordered in the same way as the vector that contains the image path ** and name of the button. See addButton(, ) **/ - virtual void setVectorFunction(std::vector vectf){ - for(int i = 0; i < (int)(vectf.size());i++){ + virtual void setVectorFunction(std::vector vectf) + { + for(int i = 0; i < (int)(vectf.size());i++) + { vectfunct.push_back(vectf[i]); } } diff --git a/lib/Interface_Icons_NDimensions/interfNewContourMenu.cxx b/lib/Interface_Icons_NDimensions/interfNewContourMenu.cxx index f4435ce..6ac78ab 100644 --- a/lib/Interface_Icons_NDimensions/interfNewContourMenu.cxx +++ b/lib/Interface_Icons_NDimensions/interfNewContourMenu.cxx @@ -31,77 +31,61 @@ interfNewContourMenu::interfNewContourMenu(wxWindow * parent, int sizex, int siz { this->datadir = datdir; //eventHandler = (wxContourEventHandler*)evtHandler; - panBull = NULL; created = false; - initButtons(this); } -void interfNewContourMenu::initButtons(wxEvtHandler* evtHandler) { - +void interfNewContourMenu::initButtons(wxEvtHandler* evtHandler) +{ std::vector path, nom; std::vector funct; - std::vector hand; - + std::vector hand; path.push_back(datadir + "/Spline.png"); nom.push_back("Create a contour using splines"); funct.push_back((wxObjectEventFunction)&interfNewContourMenu::onCreateContourSpline); hand.push_back(evtHandler); - path.push_back(datadir+"/Rectangle.png"); nom.push_back("Create a contour using the basic shape of a rectangle"); funct.push_back((wxObjectEventFunction)&interfNewContourMenu::onCreateContourRectangle); hand.push_back(evtHandler); - path.push_back(datadir + "/Circle.png"); nom.push_back("Create a contour using the basic shape of a Circle"); funct.push_back((wxObjectEventFunction)&interfNewContourMenu::onCreateContourCircle); hand.push_back(evtHandler); - path.push_back(datadir + "/bullseye.png"); nom.push_back("Create a contour using the bulls eye"); funct.push_back((wxObjectEventFunction) &interfNewContourMenu::onCreateContourBullseye); hand.push_back(this); - path.push_back(datadir + "/Line.png"); nom.push_back("Create a Line"); funct.push_back((wxObjectEventFunction) &interfNewContourMenu::onCreateContourLine); hand.push_back(this); - // RaC 09-09 --------------------- path.push_back(datadir + "/Points.png"); nom.push_back("Create Points"); funct.push_back((wxObjectEventFunction) &interfNewContourMenu::onCreateContourPoints); hand.push_back(this); // RaC 09-09 --------------------- - // RaC 10-09 --------------------- path.push_back(datadir + "/Polygon.png"); nom.push_back("Create Polygon"); funct.push_back((wxObjectEventFunction) &interfNewContourMenu::onCreateContourPolygon); hand.push_back(this); // RaC 10-09 --------------------- - this->addButtons(path, nom); - this->setVectorFunction(funct); this->setEventHandlers(hand); this->connectEvents(); - } - - interfNewContourMenu::~interfNewContourMenu() { } -void interfNewContourMenu::onCreateContourBullseye(wxCommandEvent& event){ - - +void interfNewContourMenu::onCreateContourBullseye(wxCommandEvent& event) +{ if(!created){ - panBull = new PanelBullEyeOptions(interfMainPanel::getInstance()->getInfoPanel(), wxSize(100,200)); created = true; @@ -109,30 +93,38 @@ void interfNewContourMenu::onCreateContourBullseye(wxCommandEvent& event){ interfMainPanel::getInstance()->onCreateContoursBullEye(panBull); //eventHandler->createContourBullsEye(panBull); interfMainPanel::getInstance()->showPanel(panBull); - } -void interfNewContourMenu::onCreateContourSpline( wxCommandEvent& event ){ +void interfNewContourMenu::onCreateContourSpline( wxCommandEvent& event ) +{ interfMainPanel::getInstance()->onCreateContourSpline(); } -void interfNewContourMenu::onCreateContourRectangle( wxCommandEvent& event ){ + +void interfNewContourMenu::onCreateContourRectangle( wxCommandEvent& event ) +{ interfMainPanel::getInstance()->onCreateContourRectangle(); } -void interfNewContourMenu::onCreateContourCircle( wxCommandEvent& event ){ + +void interfNewContourMenu::onCreateContourCircle( wxCommandEvent& event ) +{ interfMainPanel::getInstance()->onCreateContourCircle(); } -void interfNewContourMenu::onCreateContourLine( wxCommandEvent& event ){ + +void interfNewContourMenu::onCreateContourLine( wxCommandEvent& event ) +{ interfMainPanel::getInstance()->onCreateContourLine(); } // RaC 09-09 --------------------- -void interfNewContourMenu::onCreateContourPoints( wxCommandEvent& event ){ +void interfNewContourMenu::onCreateContourPoints( wxCommandEvent& event ) +{ interfMainPanel::getInstance()->onCreateContourPoints(); } // RaC 09-09 --------------------- // RaC 10-09 --------------------- -void interfNewContourMenu::onCreateContourPolygon( wxCommandEvent& event ){ +void interfNewContourMenu::onCreateContourPolygon( wxCommandEvent& event ) +{ interfMainPanel::getInstance()->onCreateContourPolygon(); } // RaC 10-09 --------------------- diff --git a/lib/Interface_Icons_NDimensions/interfSegmentationPanels.cxx b/lib/Interface_Icons_NDimensions/interfSegmentationPanels.cxx index e7bb971..46fb279 100644 --- a/lib/Interface_Icons_NDimensions/interfSegmentationPanels.cxx +++ b/lib/Interface_Icons_NDimensions/interfSegmentationPanels.cxx @@ -30,17 +30,15 @@ interfSegmentationPanelVTK::interfSegmentationPanelVTK(wxWindow * parent) : wxPanel(parent, -1, wxDefaultPosition, wxDefaultSize, wxBORDER_SUNKEN) { int sizeZ = interfMainPanel::getInstance()->GetImageDataSizeZ(); - double range[2]; interfMainPanel::getInstance()->getImageRange(range); - int min = (int)floor (range[0]); int max = (int)ceil (range[1]); wxButton *segmentationOneSliceBtn = new wxButton(this,-1,_T("Current slice"), wxDefaultPosition, wxSize(200,35) ); wxButton *segmentationAllSliceBtn = new wxButton(this,-1,_T("All slices") ,wxDefaultPosition, wxSize(200,35) ); - _isovalue = new wxSlider(this, -1, 40 , min, max, wxDefaultPosition, wxSize(200,35), wxSL_HORIZONTAL|wxSL_LABELS, wxDefaultValidator); - _sampling = new wxSlider(this, -1, 20 , 4, 50, wxDefaultPosition, wxSize(200,35), wxSL_HORIZONTAL|wxSL_LABELS, wxDefaultValidator); + _isovalue = new wxSlider(this, -1, 40 , min, max, wxDefaultPosition, wxDefaultSize, wxSL_HORIZONTAL|wxSL_LABELS, wxDefaultValidator); + _sampling = new wxSlider(this, -1, 20 , 4, 50, wxDefaultPosition, wxDefaultSize, wxSL_HORIZONTAL|wxSL_LABELS, wxDefaultValidator); wxString lstOptions[3]; lstOptions[0]=_T("A"); lstOptions[1]=_T("B"); @@ -48,11 +46,9 @@ interfSegmentationPanelVTK::interfSegmentationPanelVTK(wxWindow * parent) methodRadiobox = new wxRadioBox(this, -1, _T("Method (find ctrl. Points)"), wxDefaultPosition, wxSize(200,45), 3 , lstOptions, 3, wxRA_SPECIFY_COLS); methodRadiobox->SetSelection(2); _staticTextSegmentation = new wxStaticText(this,-1,_T(" ")); - _mbarrange = new mBarRange(this,70, 65); _mbarrange->SetMin(0); _mbarrange->SetStart(0); - _mbarrange->SetOrientation( true ); _mbarrange->setActiveStateTo(true); _mbarrange->setVisibleLabels( true ); @@ -62,8 +58,7 @@ interfSegmentationPanelVTK::interfSegmentationPanelVTK(wxWindow * parent) _mbarrange->setIfWithActualDrawed( false ); _mbarrange->SetStart( 0 ); _mbarrange->SetEnd( sizeZ ); - - wxFlexGridSizer * sizer = new wxFlexGridSizer(1); + wxFlexGridSizer * sizer = new wxFlexGridSizer(20,1,0,0); sizer->Add( new wxStaticText(this, -1, _T("Isovalue (Gray level)")), 1, wxGROW ); sizer->Add( _isovalue, 1, wxGROW ); sizer->Add( methodRadiobox , 1, wxGROW ); @@ -74,13 +69,9 @@ interfSegmentationPanelVTK::interfSegmentationPanelVTK(wxWindow * parent) sizer->Add( _staticTextSegmentation, 1, wxGROW ); sizer->Add( segmentationAllSliceBtn, 1, wxGROW ); sizer->Add( _mbarrange, 1, wxGROW ); - this->SetSizer( sizer ); -// panel->SetSize( sizePanel ); - this->SetSize( wxDefaultSize ); this->SetAutoLayout( true ); this->Layout(); - //_segmentationFrame->SetEventHandler( this ); //segmentationOneSliceBtn->SetEventHandler( this ); //segmentationAllSliceBtn->SetEventHandler( this ); @@ -89,7 +80,6 @@ interfSegmentationPanelVTK::interfSegmentationPanelVTK(wxWindow * parent) Connect( segmentationAllSliceBtn->GetId(), wxEVT_COMMAND_BUTTON_CLICKED, (wxObjectEventFunction) &interfSegmentationPanelVTK::onSegmentationAllSlice); } - interfSegmentationPanelVTK::~interfSegmentationPanelVTK() { } @@ -108,9 +98,7 @@ void interfSegmentationPanelVTK::onSegmentationPressedITK(wxCommandEvent& event wxFlexGridSizer* flexsizer = new wxFlexGridSizer(1); segmentPanelITK->SetSizer(flexsizer, true); segmentPanelITK->SetAutoLayout( true ); - wxPanel* panel = new wxPanel(this, -1);//contourevent->getSegmentationPanelITK(segmentPanelITK); - wxStaticText* stattext = new wxStaticText(segmentPanelITK, -1, wxString(_T(" Automatic ITK Segmentation ")), wxDefaultPosition, wxDefaultSize, wxALIGN_CENTRE|wxBORDER_SIMPLE|wxFULL_REPAINT_ON_RESIZE, wxString(_T(""))); @@ -129,23 +117,23 @@ void interfSegmentationPanelVTK::onSegmentationOneSlice( wxCommandEvent& event ) int sampling = _sampling->GetValue(); int method = methodRadiobox->GetSelection(); interfMainPanel::getInstance()->onSegmentationOneSlice(isovalue, sampling, method); - } + void interfSegmentationPanelVTK::onSegmentationAllSlice( wxCommandEvent& event ) { int minZ=_mbarrange->GetStart(); int maxZ=_mbarrange->GetEnd(); - int isovalue = _isovalue->GetValue(); int sampling = _sampling->GetValue(); int method = methodRadiobox->GetSelection(); - interfMainPanel::getInstance()->onSegmentationAllSlice(minZ, maxZ, isovalue, sampling, method); } -void interfSegmentationPanelVTK::setLabel(wxString tmpString){ +void interfSegmentationPanelVTK::setLabel(wxString tmpString) +{ _staticTextSegmentation->SetLabel(tmpString); } + /** ** start of new implementation ** interfSegmentationPanelITK @@ -155,10 +143,8 @@ interfSegmentationPanelITK::interfSegmentationPanelITK(wxWindow * parent) { double range[2]; interfMainPanel::getInstance()->getImageRange(range); - // int min = (int)floor (range[0]); // int max = (int)ceil (range[1]); - //The labels //wxStaticText * distance = new wxStaticText(this, wxID_ANY, wxT("Initial Distance"), wxPoint(5, 5)); @@ -174,9 +160,7 @@ interfSegmentationPanelITK::interfSegmentationPanelITK(wxWindow * parent) new wxStaticText(this, wxID_ANY, wxT("Iterations"), wxPoint(5, 130)); //wxStaticText * infStrength = new wxStaticText(this, wxID_ANY, wxT("Inflation Strength"), wxPoint(5, 155)); - //Text Controls - _distance = new wxTextCtrl(this, wxID_ANY, wxT("5.0"), wxPoint(98,5), wxSize(80, 20), 0, wxDefaultValidator, wxTextCtrlNameStr); _sigma = new wxTextCtrl(this, wxID_ANY, wxT("1.2"), wxPoint(98,30), wxSize(80, 20), 0, wxDefaultValidator, wxTextCtrlNameStr); _alfa = new wxTextCtrl(this, wxID_ANY, wxT("-1.0"), wxPoint(98,55), wxSize(80, 20), 0, wxDefaultValidator, wxTextCtrlNameStr); @@ -184,46 +168,37 @@ interfSegmentationPanelITK::interfSegmentationPanelITK(wxWindow * parent) _propagation = new wxTextCtrl(this, wxID_ANY, wxT("6.0"), wxPoint(98,105), wxSize(80, 20), 0, wxDefaultValidator, wxTextCtrlNameStr); _iterations = new wxTextCtrl(this, wxID_ANY, wxT("800"), wxPoint(98,130), wxSize(80, 20), 0, wxDefaultValidator, wxTextCtrlNameStr); _infStrength = new wxTextCtrl(this, wxID_ANY, wxT("3.0"), wxPoint(98,155), wxSize(80, 20), 0, wxDefaultValidator, wxTextCtrlNameStr); - //El boton //wxButton * bot = new wxButton(this, 6, wxT("One Slice"), wxPoint(98, 180), wxSize(70, 25), 0, wxDefaultValidator, wxT("button")); - //Conexion del boton con su respectivo manejador Connect(6, wxEVT_COMMAND_BUTTON_CLICKED,(wxObjectEventFunction) &interfSegmentationPanelITK::onSegmentationOneSlice); - - } -interfSegmentationPanelITK::~interfSegmentationPanelITK(){ +interfSegmentationPanelITK::~interfSegmentationPanelITK() +{ } void interfSegmentationPanelITK::onSegmentationOneSlice( wxCommandEvent& event ) { - wxString distanc=_distance->GetValue(); - wxString sigm=_sigma->GetValue(); - wxString alf=_alfa->GetValue(); - wxString bet=_beta->GetValue(); - wxString prop=_propagation->GetValue(); - wxString iter=_iterations->GetValue(); - wxString infS=_infStrength->GetValue(); - + wxString distanc = _distance->GetValue(); + wxString sigm = _sigma->GetValue(); + wxString alf = _alfa->GetValue(); + wxString bet = _beta->GetValue(); + wxString prop = _propagation->GetValue(); + wxString iter = _iterations->GetValue(); + wxString infS = _infStrength->GetValue(); interfMainPanel::getInstance()->onSegmentationOneSliceITK(distanc, sigm, alf, bet, prop, iter, infS); - } + void interfSegmentationPanelITK::onSegmentationAllSlice( wxCommandEvent& event ) { - /*int minZ=_mbarrange->GetStart(); int maxZ=_mbarrange->GetEnd(); - int isovalue = _isovalue->GetValue(); int sampling = _sampling->GetValue(); int method = methodRadiobox->GetSelection(); - - interfMainPanel::getInstance()->onSegmentationAllSlice(minZ, maxZ, isovalue, sampling, method);*/ - } //------------------------------------------------------------------------------------------------------------ @@ -237,39 +212,33 @@ interfMirrorPanel::interfMirrorPanel(wxWindow* parent) : wxPanel(parent, -1, wxDefaultPosition, wxDefaultSize, wxBORDER_SUNKEN) { _axisStatus = true; - wxButton *axisShowBtn = new wxButton(this,wxID_ANY,_T("Show/Hide Axis"), wxDefaultPosition, wxSize(200,35) ); wxButton *mirrorGoBtn = new wxButton(this,wxID_ANY,_T("Mirror Contour"), wxDefaultPosition, wxSize(200,35) ); _thickness = new wxSlider(this, -1, 4, 1, 10, wxDefaultPosition, wxDefaultSize, wxSL_HORIZONTAL|wxSL_LABELS, wxDefaultValidator); - Connect( axisShowBtn->GetId(), wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &interfMirrorPanel::onAxisShow ); Connect( mirrorGoBtn->GetId(), wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &interfMirrorPanel::onMirrorGo ); - - wxFlexGridSizer * sizer = new wxFlexGridSizer(1); + wxFlexGridSizer * sizer = new wxFlexGridSizer(20,1,0,0); sizer -> Add( axisShowBtn, 1, wxGROW ); sizer -> Add( new wxStaticText(this,-1,_T(" ")) , 1, wxGROW ); sizer -> Add( new wxStaticText(this,-1,_T("Thickness")) , 1, wxGROW ); sizer -> Add( _thickness, 1, wxGROW ); sizer -> Add( mirrorGoBtn, 1, wxGROW ); - this->SetSizer( sizer ); this->SetAutoLayout( true ); this->Layout(); } -interfMirrorPanel::~interfMirrorPanel(){ +interfMirrorPanel::~interfMirrorPanel() +{ } void interfMirrorPanel::onAxisShow(wxCommandEvent& event) { - if (!_axisStatus) { interfMainPanel::getInstance()->onMirrorAxisShow(); _axisStatus=true; - } - else - { + } else { interfMainPanel::getInstance()->onMirrorAxisHide(); _axisStatus=false; } @@ -301,15 +270,12 @@ interfTestPanel::interfTestPanel(wxWindow* parent) : wxPanel(parent, -1, wxDefaultPosition, wxDefaultSize, wxBORDER_SUNKEN) { wxButton *button1 = new wxButton(this,wxID_ANY,_T("Button 1"), wxDefaultPosition, wxSize(200,35) ); - wxButton *button2 = new wxButton(this,wxID_ANY,_T("Button 2"), wxDefaultPosition, wxSize(200,35) ); - + wxButton *button2 = new wxButton(this,wxID_ANY,_T("Button 2"), wxDefaultPosition, wxSize(200,35) ); Connect( button1->GetId(), wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &interfTestPanel::onButton1Pressed ); Connect( button2->GetId(), wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &interfTestPanel::onButton2Pressed ); - - wxFlexGridSizer * sizer = new wxFlexGridSizer(1); + wxFlexGridSizer * sizer = new wxFlexGridSizer(20); sizer -> Add( button1, 1, wxGROW ); sizer -> Add( button2, 1, wxGROW ); - this->SetSizer( sizer ); this->SetAutoLayout( true ); this->Layout(); diff --git a/lib/Interface_Icons_NDimensions/interfSegmentationPanels.h b/lib/Interface_Icons_NDimensions/interfSegmentationPanels.h index 3f45505..c1a4468 100644 --- a/lib/Interface_Icons_NDimensions/interfSegmentationPanels.h +++ b/lib/Interface_Icons_NDimensions/interfSegmentationPanels.h @@ -43,40 +43,27 @@ public: ** it uses attribute eventHandler to call the methods define by the application. ** see setEventHandler(wxEventHandler*) **/ - - void onSegmentationPressed(wxCommandEvent& event); - - void onSegmentationPressedITK(wxCommandEvent& event); - + void onSegmentationPressed(wxCommandEvent& event); + void onSegmentationPressedITK(wxCommandEvent& event); void setLabel(wxString tmpString); - private: - //wxContourEventHandler* contourevent; - wxPanel* configPanel; - wxWindow* infoWin; - wxPanel* segmentPanel; - wxPanel* spreadPanel; - wxPanel* segmentPanelITK; - bool axisshown; - - void hideAxis(); - - wxPanel* getSegmentationPanel(wxWindow* parent); - - void onSegmentationOneSlice( wxCommandEvent& event ); - - void onSegmentationAllSlice( wxCommandEvent& event ); - - wxSlider* _isovalue; - - mBarRange* _mbarrange; - - wxSlider* _sampling; - - wxStaticText* _staticTextSegmentation; - - wxRadioBox* methodRadiobox; + wxPanel *configPanel; + wxWindow *infoWin; + wxPanel *segmentPanel; + wxPanel *spreadPanel; + wxPanel *segmentPanelITK; + bool axisshown; + void hideAxis(); + wxSlider *_isovalue; + mBarRange *_mbarrange; + wxSlider *_sampling; + wxStaticText*_staticTextSegmentation; + wxRadioBox *methodRadiobox; + + wxPanel* getSegmentationPanel(wxWindow* parent); + void onSegmentationOneSlice( wxCommandEvent& event ); + void onSegmentationAllSlice( wxCommandEvent& event ); }; class interfSegmentationPanelITK @@ -85,14 +72,9 @@ class interfSegmentationPanelITK public: interfSegmentationPanelITK(wxWindow * parent); ~interfSegmentationPanelITK(); - - void onSegmentationOneSlice( wxCommandEvent& event ); - void onSegmentationAllSlice( wxCommandEvent& event ); - private: - wxTextCtrl * _distance; wxTextCtrl * _sigma; wxTextCtrl * _alfa; @@ -109,19 +91,12 @@ class interfMirrorPanel public: interfMirrorPanel(wxWindow * parent); ~interfMirrorPanel(); - private: - wxSlider* _thickness; - bool _axisStatus; - void onAxisShow(wxCommandEvent& event); - void onMirrorGo(wxCommandEvent& event); - void onChangeWidth(wxScrollEvent& event); - DECLARE_EVENT_TABLE() }; diff --git a/lib/Interface_Icons_NDimensions/interfToolsPanels.cxx b/lib/Interface_Icons_NDimensions/interfToolsPanels.cxx index f59c2e2..d2505d5 100644 --- a/lib/Interface_Icons_NDimensions/interfToolsPanels.cxx +++ b/lib/Interface_Icons_NDimensions/interfToolsPanels.cxx @@ -223,6 +223,7 @@ void interfSpreadPanel::setStringSpread(std::string stringtemp){ interfInformationPanel::interfInformationPanel(wxWindow * parent) : wxPanel(parent, -1, wxDefaultPosition, wxDefaultSize, wxBORDER_SUNKEN) { +printf("EED interfInformationPanel::interfInformationPanel Start\n"); //wxPanel *panel = new wxPanel(parent,-1,wxDefaultPosition, wxDefaultSize,wxTAB_TRAVERSAL); wxString lstOptions[4]; lstOptions[0]=_T("Current Slice"); @@ -230,7 +231,6 @@ interfInformationPanel::interfInformationPanel(wxWindow * parent) // lstOptions[2]=_T("All Slices"); _informationRadiobox = new wxRadioBox(this, -1, _T("Slice analysis"), wxDefaultPosition, wxSize(270,45), 2 , lstOptions, 2, wxRA_SPECIFY_COLS); - wxString lstOptContOperation[5]; lstOptContOperation[0]=_T("AND"); lstOptContOperation[1]=_T("OR"); @@ -240,53 +240,73 @@ interfInformationPanel::interfInformationPanel(wxWindow * parent) _radiolstboxContourGroup->SetSelection(1); Connect( _radiolstboxContourGroup->GetId(), wxEVT_COMMAND_RADIOBOX_SELECTED , (wxObjectEventFunction) &interfInformationPanel::onContourGroup ); +printf("EED interfInformationPanel::interfInformationPanel 1\n"); - _XYZValues = new wxCheckBox(this, -1, _T("Save Contour Values") ); - _XYZValues->SetValue(true); - _contourImage = new wxCheckBox(this, -1, _T("Extract Contours as Images") ); + _XYZValues = new wxCheckBox(this, -1, _T("Save Contour Values") ); + _XYZValues->SetValue(true); + _contourImage = new wxCheckBox(this, -1, _T("Extract Contours as Images") ); _contourImage->SetValue(true); - - _statistics = new wxCheckBox(this, -1, _T("Save Statistics") ); + _statistics = new wxCheckBox(this, -1, _T("Save Statistics") ); _statistics->SetValue(true); + wxButton *informationContourLabelsBtn = new wxButton(this,-1,_T("Contour labels"),wxDefaultPosition, wxSize(140,35) ); +#if wxMAJOR_VERSION <= 2 informationContourLabelsBtn->SetEventHandler( this ); +#else + // informationContourLabelsBtn->SetEventHandler( this ); + printf("EED interfInformationPanel::interfInformationPanel OOOjjjooooooo informationContourLabelsBtn->SetEventHandler \n"); +#endif Connect( informationContourLabelsBtn->GetId(), wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &interfInformationPanel::onInformationContourLabels ); wxButton *statisticsContourBtn = new wxButton(this,-1,_T("Contour statistics"),wxDefaultPosition, wxSize(140,35) ); +#if wxMAJOR_VERSION <= 2 statisticsContourBtn->SetEventHandler( this ); +#else + //statisticsContourBtn->SetEventHandler( this ); + printf("EED interfInformationPanel::interfInformationPanel OOOjjjooooooo statisticsContourBtn->SetEventHandler \n"); +#endif Connect( statisticsContourBtn->GetId(), wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &interfInformationPanel::onExtractInformation ); wxButton *showResultImagesBtn = new wxButton(this,-1,_T("Show result images"),wxDefaultPosition, wxSize(140,35) ); +#if wxMAJOR_VERSION <= 2 showResultImagesBtn->SetEventHandler( this ); +#else + //showResultImagesBtn->SetEventHandler( this ); + printf("EED interfInformationPanel::interfInformationPanel OOOjjjooooooo showResultImagesBtn->SetEventHandler \n"); +#endif Connect( showResultImagesBtn->GetId(), wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &interfInformationPanel::onShowResultImages ); - wxButton *saveResultsBtn = new wxButton(this,-1,_T("Save Results"),wxDefaultPosition, wxSize(140,35) ); +#if wxMAJOR_VERSION <= 2 saveResultsBtn->SetEventHandler( this ); - Connect( saveResultsBtn->GetId(), wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &interfInformationPanel::onSaveResults ); +#else +//EED saveResultsBtn->SetEventHandler( this ); +printf("EED interfInformationPanel::interfInformationPanel OOOjjjooooooo saveResultsBtn->SetEventHandler \n"); +#endif + Connect( saveResultsBtn->GetId(), wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &interfInformationPanel::onSaveResults ); int sizeZ = interfMainPanel::getInstance()->GetImageDataSizeZ(); + //_theViewPanel->getSceneManager()->GetImageDataSizeZ(); _mbarrangeSliceInformation = new mBarRange(this,65,65); _mbarrangeSliceInformation->SetMin(0); _mbarrangeSliceInformation->SetStart(0); - _mbarrangeSliceInformation-> SetOrientation( true ); - _mbarrangeSliceInformation-> setActiveStateTo(true); - _mbarrangeSliceInformation-> setVisibleLabels( true ); - _mbarrangeSliceInformation-> setDeviceEndMargin(10); - _mbarrangeSliceInformation-> setRepresentedValues( 0 , sizeZ-1 ); - _mbarrangeSliceInformation-> setDeviceBlitStart(10,10); - _mbarrangeSliceInformation-> setIfWithActualDrawed( false ); - _mbarrangeSliceInformation-> SetStart( 0 ); - _mbarrangeSliceInformation-> SetEnd( sizeZ-1 ); - - + _mbarrangeSliceInformation->SetOrientation( true ); + _mbarrangeSliceInformation->setActiveStateTo(true); + _mbarrangeSliceInformation->setVisibleLabels( true ); + _mbarrangeSliceInformation->setDeviceEndMargin(10); + _mbarrangeSliceInformation->setRepresentedValues( 0 , sizeZ-1 ); + _mbarrangeSliceInformation->setDeviceBlitStart(10,10); + _mbarrangeSliceInformation->setIfWithActualDrawed( false ); + _mbarrangeSliceInformation->SetStart( 0 ); + _mbarrangeSliceInformation->SetEnd( sizeZ-1 ); double range[2]; interfMainPanel::getInstance()->getImageRange(range); +printf("EED interfInformationPanel::interfInformationPanel 2\n"); int min = (int)floor (range[0]); int max = (int)ceil (range[1]); @@ -313,45 +333,54 @@ interfInformationPanel::interfInformationPanel(wxWindow * parent) Connect(_mbarrangeRangeInformation->GetId(),wxEVT_TSBAR_MOVED,(wxObjectEventFunction) (wxCommandEventFunction) &interfInformationPanel::onRangeSliceInformation ); +printf("EED interfInformationPanel::interfInformationPanel 3\n"); _staticTextInformation = new wxStaticText(this,-1,_T(" ")); - _grid = new wxGrid( this, wxID_ANY, wxPoint( 0, 0 ), wxSize( 200, 500 ) ); - int i,gridCol=10,gridRow=sizeZ+2; _grid->CreateGrid( 0, 0 ); _grid->AppendRows(gridRow); _grid->AppendCols(gridCol); - for (i=0;iSetRowLabelValue(i, _T(" ") ); } // _grid->SetColLabelSize(0); - - FillGridWithContoursInformation(); + //EED 2017-09-16 Migration wxWidgets 2.8 to 3.0 #if wxMAJOR_VERSION <= 2 wxFlexGridSizer * sizerSave = new wxFlexGridSizer(2,2); #else - wxFlexGridSizer * sizerSave = new wxFlexGridSizer(2); + wxFlexGridSizer * sizerSave = new wxFlexGridSizer(2,2,0,0); #endif sizerSave -> Add( new wxStaticText(this,-1,_T("Save Options: ")) , 1, wxGROW ); sizerSave->Add( _XYZValues, 1, wxALL, 2 ); sizerSave->Add( _statistics, 1, wxALL, 2 ); sizerSave->Add( _contourImage, 1, wxALL, 2 ); + +printf("EED interfInformationPanel::interfInformationPanel 4\n"); +//EED 2017-09-16 Migration wxWidgets 2.8 to 3.0 +#if wxMAJOR_VERSION <= 2 wxFlexGridSizer * sizerA = new wxFlexGridSizer(10); +#else + wxFlexGridSizer * sizerA = new wxFlexGridSizer(1,10,0,0); +#endif sizerA->Add( _informationRadiobox, 1, wxALL, 2 ); sizerA->Add( _radiolstboxContourGroup, 1, wxALL, 2 ); sizerA->Add( sizerSave, 1, wxALL, 2 ); +//EED 2017-09-16 Migration wxWidgets 2.8 to 3.0 +#if wxMAJOR_VERSION <= 2 wxFlexGridSizer * sizerB = new wxFlexGridSizer(10); +#else + wxFlexGridSizer * sizerB = new wxFlexGridSizer(1,4,0,0); +#endif sizerB->Add( informationContourLabelsBtn, 1, wxALL, 2 ); sizerB->Add( statisticsContourBtn, 1, wxALL, 2 ); sizerB->Add( showResultImagesBtn, 1, wxALL, 2 ); @@ -361,23 +390,38 @@ interfInformationPanel::interfInformationPanel(wxWindow * parent) #if wxMAJOR_VERSION <= 2 wxFlexGridSizer * sizer = new wxFlexGridSizer(1,8); #else - wxFlexGridSizer * sizer = new wxFlexGridSizer(8); + wxFlexGridSizer * sizer = new wxFlexGridSizer(20,1,0,0); #endif +printf("EED interfInformationPanel::interfInformationPanel 5\n"); sizer->Add( sizerA , 1, wxALL , 0 ); - sizer->Add( new wxStaticText(this ,-1,_T("Slice Range")) , 1, wxALL , 0 ); +printf("EED interfInformationPanel::interfInformationPanel 5.1\n"); + sizer->Add( new wxStaticText(this ,1,_T("Slice Range")) , 1, wxALL , 0 ); +printf("EED interfInformationPanel::interfInformationPanel 5.2\n"); sizer->Add( _mbarrangeSliceInformation , 1, wxALL|wxGROW , 2 ); - sizer->Add( new wxStaticText(this ,-1,_T("Gray Range")) , 1, wxALL , 0 ); +printf("EED interfInformationPanel::interfInformationPanel 5.3\n"); + sizer->Add( new wxStaticText(this ,1,_T("Gray Range")) , 1, wxALL , 0 ); +printf("EED interfInformationPanel::interfInformationPanel 5.4\n"); sizer->Add( _mbarrangeRangeInformation , 1, wxALL|wxGROW , 2 ); +printf("EED interfInformationPanel::interfInformationPanel 5.5\n"); + sizer->Add( sizerB , 1, wxEXPAND , 0 ); + +printf("EED interfInformationPanel::interfInformationPanel 5.6\n"); sizer->Add( _staticTextInformation , 1, wxEXPAND , 0 ); +printf("EED interfInformationPanel::interfInformationPanel 5.7\n"); sizer->Add( _grid , 1, wxEXPAND , 0 ); - +printf("EED interfInformationPanel::interfInformationPanel 5.8\n"); this->SetSizer( sizer ); +printf("EED interfInformationPanel::interfInformationPanel 5.9\n"); this->SetSize( wxSize(1500,1500) ); //this->SetBackgroundColour( wxColour(100,100,100) ); this->SetAutoLayout( true ); +printf("EED interfInformationPanel::interfInformationPanel 5.10\n"); this->Layout(); //return panel; + +printf("EED interfInformationPanel::interfInformationPanel End\n"); + } interfInformationPanel::~interfInformationPanel() diff --git a/lib/Interface_Icons_NDimensions/interfToolsPanels.h b/lib/Interface_Icons_NDimensions/interfToolsPanels.h index 23d2011..6279a6b 100644 --- a/lib/Interface_Icons_NDimensions/interfToolsPanels.h +++ b/lib/Interface_Icons_NDimensions/interfToolsPanels.h @@ -86,7 +86,6 @@ class interfInformationPanel public: interfInformationPanel(wxWindow * parent); ~interfInformationPanel(); - void setStringInfoPanel(wxString tmpString); void setRowLabelInfoPanel(int z,wxString tempString); void appendCols(int numcols); @@ -95,17 +94,15 @@ public: void setColLabel(int tmpIntB,wxString tmpTitleString); wxString getCellValue(int j,int i); private: - - mBarRange* _mbarrangeRangeInformation; - mBarRange* _mbarrangeSliceInformation; - wxGrid* _grid; - wxRadioBox* _informationRadiobox; - wxRadioBox* _radiolstboxContourGroup; - wxStaticText* _staticTextInformation; - wxCheckBox* _XYZValues; - wxCheckBox* _contourImage; - wxCheckBox* _statistics; - + mBarRange* _mbarrangeRangeInformation; + mBarRange* _mbarrangeSliceInformation; + wxGrid* _grid; + wxRadioBox* _informationRadiobox; + wxRadioBox* _radiolstboxContourGroup; + wxStaticText* _staticTextInformation; + wxCheckBox* _XYZValues; + wxCheckBox* _contourImage; + wxCheckBox* _statistics; void onInformationContourLabels(wxCommandEvent& event); void onExtractInformation(wxCommandEvent& event); void onShowResultImages(wxCommandEvent& event); diff --git a/lib/Interface_ManagerContour_NDimensions/wxContourMainFrame.cxx b/lib/Interface_ManagerContour_NDimensions/wxContourMainFrame.cxx index 760f543..ca8e2bc 100644 --- a/lib/Interface_ManagerContour_NDimensions/wxContourMainFrame.cxx +++ b/lib/Interface_ManagerContour_NDimensions/wxContourMainFrame.cxx @@ -320,20 +320,25 @@ void wxContourMainFrame::onCreateContourSpline( ){ createContour( 1 ); } -void wxContourMainFrame::onCreateContourRectangle( ){ + +void wxContourMainFrame::onCreateContourRectangle( ) +{ //JCP 20-10-08 Undo redo implementation saveState(); //JCP 20-10-08 Undo redo implementation createContour( 2 ); } -void wxContourMainFrame::onCreateContourCircle( ){ + +void wxContourMainFrame::onCreateContourCircle( ) +{ //JCP 20-10-08 Undo redo implementation saveState(); //JCP 20-10-08 Undo redo implementation createContour( 3 ); } -void wxContourMainFrame::onCreateContourLine( ){ +void wxContourMainFrame::onCreateContourLine( ) +{ //JCP 20-10-08 Undo redo implementation saveState(); //JCP 20-10-08 Undo redo implementation @@ -341,7 +346,8 @@ void wxContourMainFrame::onCreateContourLine( ){ } // RaC 09-09 -------------------------------------- -void wxContourMainFrame::onCreateContourPoints( ){ +void wxContourMainFrame::onCreateContourPoints( ) +{ //JCP 20-10-08 Undo redo implementation saveState(); //JCP 20-10-08 Undo redo implementation @@ -350,7 +356,8 @@ void wxContourMainFrame::onCreateContourPoints( ){ // RaC 09-09 -------------------------------------- // RaC 10-09 -------------------------------------- -void wxContourMainFrame::onCreateContourPolygon( ){ +void wxContourMainFrame::onCreateContourPolygon( ) +{ //JCP 20-10-08 Undo redo implementation saveState(); //JCP 20-10-08 Undo redo implementation @@ -385,15 +392,14 @@ void wxContourMainFrame :: onCreateContourBullEye(wxPanel* panel ) _theViewPanel->getSceneManager()->configureViewControlTo( theName, manModelContour,spc , 4) ; } } + void wxContourMainFrame :: createContour( int typeContour ) { //Creating the manualContourModel and including in the model manualBaseModel * manModelContour = kernelManager->factoryManualContourModel(typeContour); - std::vector instantVector; _instantPanel->getInstant( instantVector ); std::string theName = kernelManager->createOutline(manModelContour, instantVector); - /*std::vector instantVector; _instantPanel->getInstant( instantVector ); std::string theName; @@ -407,9 +413,9 @@ void wxContourMainFrame :: createContour( int typeContour ) //Adding the manualViewContour to interface objects structure //_sceneManager->setControlActiveStateOfALL( false );//This call is being done here because if the ROI is created underneath the previously created ROIS will still be active. _theViewPanel->getSceneManager()->configureViewControlTo( theName, manModelContour,spc , typeContour) ; - } - + } // if addedModel } + manualBaseModel * wxContourMainFrame::factoryManualContourModel(wxPanel* panel){ manualContourModelBullEye *manModelContourBullEye = new manualContourModelBullEye(); @@ -3315,7 +3321,6 @@ void wxContourMainFrame::SetFileLocation(std::string newFileLocation) void wxContourMainFrame::FlipSelectedContours(int flipDirection) { - printf("EED wxContourMainFrame::FlipSelectedContours flipDirection=%d \n", flipDirection ); FlipLstOfContours( (std::vector)_theViewPanel->getSceneManager()->getSelectedObjects() , flipDirection @@ -3325,7 +3330,6 @@ void wxContourMainFrame::FlipSelectedContours(int flipDirection) void wxContourMainFrame::FlipActualSliceContours(int flipDirection) { - printf("EED wxContourMainFrame::FlipActualSliceContours flipDirection=%d \n", flipDirection ); FlipLstOfContours( (std::vector)_theViewPanel->getSceneManager()->GetlstContoursNameActualSlice() , flipDirection @@ -3334,7 +3338,6 @@ void wxContourMainFrame::FlipActualSliceContours(int flipDirection) void wxContourMainFrame::FlipAllContours(int flipDirection) { - printf("EED wxContourMainFrame::FlipAllContours flipDirection=%d \n", flipDirection ); FlipLstOfContours( kernelManager->GetLstNameThings() , flipDirection diff --git a/lib/Interface_ManagerContour_NDimensions/wxContourMainFrame.h b/lib/Interface_ManagerContour_NDimensions/wxContourMainFrame.h index 546484a..7af20a3 100644 --- a/lib/Interface_ManagerContour_NDimensions/wxContourMainFrame.h +++ b/lib/Interface_ManagerContour_NDimensions/wxContourMainFrame.h @@ -208,19 +208,13 @@ class wxContourMainFrame : public wxPanel { void setConceptValue( std::string name, int value ); ConceptDataWrap* getLastConceptData(); bool getIfConceptCheckedAt( std::string name, int pos ); - void changeInstant(); - int getNamesWrappingSize(); - std::string getNameWrapping(int i); - void updateInstantOutlines(); void updateInstantImageData(); void updateInstantAxes(); - void onChangeDeep(int val); - /////////////////////////// void onCopy(); void onPaste(); @@ -234,11 +228,8 @@ class wxContourMainFrame : public wxPanel { void onImport(); void onTest(); void openContours( FILE *pFile, FILE *pFileData, bool staticContour ); - void RefreshInterface(); - vtkImageData* getImageData(); - void onSegmentationOneSlice(int isovalue,int sampling,int method); void onSegmentationOneSliceITK(wxString distance, wxString sigma, wxString alfa, wxString beta, wxString propagation, wxString iterations, wxString inflation); void SegmentationOneSlice( int x, int y, int z, int isovalue, int sampling, int method ); @@ -264,7 +255,6 @@ class wxContourMainFrame : public wxPanel { void FlipAllContours(int flipDirection); void FlipLstOfContours(std::vector lstNameThings, int flipDirection); - //==================================================================================================== void showAxis(bool show); @@ -286,20 +276,19 @@ class wxContourMainFrame : public wxPanel { // // @param typeContourGroup - int The operation id (AND,OR,XOR,ALL=3) // - void onInformationContourLabels(int typeContourGroup,int selection,int minimumZ,int maximumZ,int grayRangeMin, int grayRangeMax); - void onSaveResults(std::string directory,std::string namefile, std::string filename, - int typeContourGroup, int selection, int minZ, int maxZ, bool XYZValues, bool contourImage, bool statistics); - void SaveValuesXYZ(std::string directory,std::string namefile, int typeContourGroup); - void onChangeInstantInstantPanel(std::string name,int value, int minshow, int maxshow); - void onSnakePressed(); - void saveFileWithContoursAutomatique(); - void ShowResultImages(int typeContourGroup, int selection, int minZ, int maxZ ); + void onInformationContourLabels(int typeContourGroup,int selection,int minimumZ,int maximumZ,int grayRangeMin, int grayRangeMax); + void onSaveResults(std::string directory,std::string namefile, std::string filename, + int typeContourGroup, int selection, int minZ, int maxZ, bool XYZValues, bool contourImage, bool statistics); + void SaveValuesXYZ(std::string directory,std::string namefile, int typeContourGroup); + void onChangeInstantInstantPanel(std::string name,int value, int minshow, int maxshow); + void onSnakePressed(); + void saveFileWithContoursAutomatique(); + void ShowResultImages(int typeContourGroup, int selection, int minZ, int maxZ ); wxPanel *getMaskImageViewPanel(wxWindow *parent); - void SetContourGroup(int contourGroup); + void SetContourGroup(int contourGroup); wxPanel *getThresholdImageViewPanel(wxWindow *parent); wxPanel *getColorLayerImageViewPanel(wxWindow *parent); - //CMRU 17-08-09----------------------------------------------------------------------------------------------- /** diff --git a/lib/Interface_ManagerContour_NDimensions/wxContourViewPanel.cxx b/lib/Interface_ManagerContour_NDimensions/wxContourViewPanel.cxx index b1d0567..4211b7f 100644 --- a/lib/Interface_ManagerContour_NDimensions/wxContourViewPanel.cxx +++ b/lib/Interface_ManagerContour_NDimensions/wxContourViewPanel.cxx @@ -66,7 +66,6 @@ DEFINE_EVENT_TYPE( wxINSTANT_CHANGE ) createVerticalBar(1,200); createViewPanel(); _eventHandler = NULL; - wxFlexGridSizer * panelSizer = new wxFlexGridSizer(1,4, gapV, gapH); //EED 2017-09-16 Migration wxWidgets 2.8 to 3.0 #if wxMAJOR_VERSION <= 2 @@ -80,7 +79,6 @@ DEFINE_EVENT_TYPE( wxINSTANT_CHANGE ) panelSizer->AddSpacer(gapV); panelSizer->Add(theViewPanel, 1, wxEXPAND); panelSizer->AddSpacer(gapV); - outSizer = new wxFlexGridSizer(3, 1, gapH, gapV); //EED 2017-09-16 Migration wxWidgets 2.8 to 3.0 #if wxMAJOR_VERSION <= 2 @@ -93,10 +91,8 @@ DEFINE_EVENT_TYPE( wxINSTANT_CHANGE ) outSizer->Add( _horizontalBar, 0, wxBOTTOM|wxEXPAND|wxLEFT|wxRIGHT|wxTOP); outSizer->Add( panelSizer, 1, wxEXPAND); outSizer->AddSpacer(gapH); - _horizontalBar->setDeviceBlitStart( _verticalBar->GetWidth() + 2*gapH, gapV); _horizontalBar->setDeviceEndMargin( 2*gapH+10 ); - //Connecting the events to the horizontal bar Connect(_horizontalBar->GetId(),wxEVT_TSBAR,(wxObjectEventFunction) (wxCommandEventFunction) &wxContourViewPanel::onBarrange_Horizontal ); Connect(_horizontalBar->GetId(),wxEVT_TSBAR_ACTUAL,(wxObjectEventFunction) (wxCommandEventFunction) &wxContourViewPanel::onActualChange_Bar_Horizontal ); @@ -140,10 +136,11 @@ DEFINE_EVENT_TYPE( wxINSTANT_CHANGE ) Connect( wxID_ANY, wxEVT_START_CREATE_ROI, (wxObjectEventFunction) (wxCommandEventFunction) &wxContourViewPanel::onCreateROI ); Connect( wxID_ANY, wxEVT_STOP_CREATE_ROI, (wxObjectEventFunction) (wxCommandEventFunction) &wxContourViewPanel::onStopCreateROI ); Connect( wxID_ANY, wxEVT_CHANGED_DEEP, (wxObjectEventFunction) (wxCommandEventFunction) &wxContourViewPanel::onChangedDeep ); - Connect( wxID_ANY, wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &wxContourViewPanel :: onActionButtonPressed ); + Connect( wxID_ANY, wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &wxContourViewPanel :: onActionButtonPressed ); } - wxVtkBaseView_SceneManager* wxContourViewPanel::getSceneManager(){ + wxVtkBaseView_SceneManager* wxContourViewPanel::getSceneManager() + { return _sceneManager; } diff --git a/lib/Interface_ManagerContour_NDimensions/wxContourViewPanel.h b/lib/Interface_ManagerContour_NDimensions/wxContourViewPanel.h index ecc5c97..60d66f2 100644 --- a/lib/Interface_ManagerContour_NDimensions/wxContourViewPanel.h +++ b/lib/Interface_ManagerContour_NDimensions/wxContourViewPanel.h @@ -75,34 +75,24 @@ ViewPanel.h */ // Class definition //------------------------------------------------------------------------------------------------------------ -class wxContourViewPanel : public wxPanel {// public wxScrolledWindow { - +class wxContourViewPanel : public wxPanel +{ public: - //------------------------------------------------------------------------------------------------------------ // Constructors & Destructors //------------------------------------------------------------------------------------------------------------ - wxContourViewPanel( vtkImageData * theShowingImage, wxWindow *parent, const wxPoint& pos=wxDefaultPosition, const wxSize& size = wxDefaultSize,long style= wxDEFAULT_FRAME_STYLE | wxSUNKEN_BORDER, int vertStart=1, int vertEnd=1, int horzStart=1, int horzEnd=1 ); - ~wxContourViewPanel(); - //------------------------------------------------------------------------------------------------------------ // Creational and initialization methods //------------------------------------------------------------------------------------------------------------ - void setWxEventHandler( wxEvtHandler * theEventHandler ); - void createHorizontalBar(int horzStart, int horzEnd); - void createVerticalBar(int vertStart, int vertEnd); - void createViewPanel(); - //------------------------------------------------------------------------------------------------------------ // Methods for capturing events from the horizontal bar //------------------------------------------------------------------------------------------------------------ - /** * Handles the event wxEVT_TSBAR from the horizontal bar */ diff --git a/lib/Interface_ManagerContour_NDimensions/wxVtkBaseView_SceneManager.cxx b/lib/Interface_ManagerContour_NDimensions/wxVtkBaseView_SceneManager.cxx index 1d8f1e5..70fd629 100644 --- a/lib/Interface_ManagerContour_NDimensions/wxVtkBaseView_SceneManager.cxx +++ b/lib/Interface_ManagerContour_NDimensions/wxVtkBaseView_SceneManager.cxx @@ -145,8 +145,9 @@ DEFINE_EVENT_TYPE( wxEVT_CHANGED_DEEP ) { return _wxVtk_BaseView; } + //------------------------------------------------------------------------------------------------------------ - void wxVtkBaseView_SceneManager :: configureViewControlTo( std::string theKeyName, manualBaseModel * manModelContour, double * spc,int typeContour) + void wxVtkBaseView_SceneManager::configureViewControlTo( std::string theKeyName, manualBaseModel * manModelContour, double * spc,int typeContour) { //setControlActiveStateOfALL( false ); _creatingROI = true; @@ -158,11 +159,8 @@ DEFINE_EVENT_TYPE( wxEVT_CHANGED_DEEP ) _lastInteraction->getControler()->SetActive( false ); this->_vtkInteractorStyleBaseView->SetRefresh_waiting(); } - - manualContourBaseControler *manContourControl; manualViewBaseContour *manViewerContour; - // Creating the view manualViewContour and the manualContourControler // NOTE: The model is created in the KernelManagerContour class, factoryManualContourModel method if (typeContour==1) @@ -270,11 +268,12 @@ DEFINE_EVENT_TYPE( wxEVT_CHANGED_DEEP ) _contours_ViewControl->insert(std::pair ( theKeyName, newContourWrap )); return newContourWrap; } + //------------------------------------------------------------------------------------------------------------ void wxVtkBaseView_SceneManager :: desconfigureViewControlOf( std::string theKeyName ) - { - + { } + //------------------------------------------------------------------------------------------------------------ void wxVtkBaseView_SceneManager :: removeWrap( std::string theKeyName ) { @@ -287,6 +286,7 @@ DEFINE_EVENT_TYPE( wxEVT_CHANGED_DEEP ) this->_vtkInteractorStyleBaseView->SetRefresh_waiting(); this->_vtkInteractorStyleBaseView->EvaluateToRefresh(); } + //------------------------------------------------------------------------------------------------------------ ContourWrap_ViewControl * wxVtkBaseView_SceneManager :: getContourWrap_ViewControlOf ( std::string theName ) { @@ -295,6 +295,7 @@ DEFINE_EVENT_TYPE( wxEVT_CHANGED_DEEP ) return iter->second; //return iter->first; } + //------------------------------------------------------------------------------------------------------------ ContourWrap_ViewControl * wxVtkBaseView_SceneManager :: getContourWrap_ViewControlOf ( std::string theName, std::map * theMap ) { @@ -302,46 +303,55 @@ DEFINE_EVENT_TYPE( wxEVT_CHANGED_DEEP ) iter = theMap->find( theName ); return iter->second; } + //------------------------------------------------------------------------------------------------------------ manualContourBaseControler * wxVtkBaseView_SceneManager :: getControlerOf( std::string theName ) { return getContourWrap_ViewControlOf ( theName )->getControler(); } + //------------------------------------------------------------------------------------------------------------ manualViewBaseContour * wxVtkBaseView_SceneManager :: getViewerOf( std::string theName ) { return getContourWrap_ViewControlOf ( theName )->getViewer(); } + //------------------------------------------------------------------------------------------------------------ void wxVtkBaseView_SceneManager :: set_creatingMULT_ROI( bool condition ) { _creatingMULT_ROI = condition; } + //------------------------------------------------------------------------------------------------------------ void wxVtkBaseView_SceneManager :: set_editingROI( bool condition ) { _editingROI = condition; } + //------------------------------------------------------------------------------------------------------------ void wxVtkBaseView_SceneManager :: set_toIncludeAtInteractionGroup( bool condition ) { _toIncludeAtInteractionGroup = condition; } + //------------------------------------------------------------------------------------------------------------ void wxVtkBaseView_SceneManager :: set_waiting( bool condition ) { _waiting = condition; } + //------------------------------------------------------------------------------------------------------------ bool wxVtkBaseView_SceneManager :: get_creatingMULT_ROI( ) { return _creatingMULT_ROI; } + //------------------------------------------------------------------------------------------------------------ bool wxVtkBaseView_SceneManager :: get_editingROI( ) { return _editingROI; } + //------------------------------------------------------------------------------------------------------------ bool wxVtkBaseView_SceneManager :: get_toIncludeAtInteractionGroup( ) { diff --git a/lib/kernel_ManagerContour_NDimensions/KernelManagerContour.cxx b/lib/kernel_ManagerContour_NDimensions/KernelManagerContour.cxx index 633d438..3edce32 100644 --- a/lib/kernel_ManagerContour_NDimensions/KernelManagerContour.cxx +++ b/lib/kernel_ManagerContour_NDimensions/KernelManagerContour.cxx @@ -30,23 +30,18 @@ #include "KernelManagerContour.h" -KernelManagerContour::KernelManagerContour(){ - - +KernelManagerContour::KernelManagerContour() +{ /**THIS ALL SHOULD BE IN AN OTHER LIB CALLED PERSISTANCE ** **/ - inredo = 0; - inundo = 0; - + inredo = 0; + inundo = 0; time_t seconds; - seconds = time (NULL); - int time = seconds; - - - stundoredo = "data/temp"+intToString(time); - _currentIndex = 0; - + seconds = time (NULL); + int time = seconds; + stundoredo = "data/temp"+intToString(time); + _currentIndex = 0; _contourPropagation = NULL; #if(WIN32) mkdir(stundoredo.c_str()); @@ -57,26 +52,20 @@ KernelManagerContour::KernelManagerContour(){ /** ** FINISH PERSISTANCE **/ - } + KernelManagerContour::KernelManagerContour(std::vector images,std::string datadir,std::string tmpdir) { - - /**THIS ALL SHOULD BE IN AN OTHER LIB CALLED PERSISTANCE ** **/ - inredo = 0; - inundo = 0; - + inredo = 0; + inundo = 0; time_t seconds; - seconds = time (NULL); - int time = seconds; - - + seconds = time (NULL); + int time = seconds; stundoredo = tmpdir+"/temp"+intToString(time); _currentIndex = 0; - _contourPropagation = NULL; #if(WIN32) mkdir(tmpdir.c_str()); @@ -91,7 +80,6 @@ KernelManagerContour::KernelManagerContour(std::vector images,std **/ setVectImages(images); initializeEnvironment(datadir); - } KernelManagerContour::~KernelManagerContour() @@ -108,12 +96,10 @@ void KernelManagerContour::setVectImages(std::vector vectimg) { double spc[3]; std::vector vectspc; - - for(int i = 0; i < (int)(vectimg.size()); i++){ + for(int i = 0; i < (int)(vectimg.size()); i++) + { vtkImageData* img = vectimg[i]; vtkImageChangeInformation* change = vtkImageChangeInformation::New(); - - //EED 2017-01-01 Migration VTK7 #if VTK_MAJOR_VERSION <= 5 change->SetInformationInput(img); @@ -121,27 +107,21 @@ void KernelManagerContour::setVectImages(std::vector vectimg) #else change->SetInputData(img); #endif - img->GetSpacing(spc); change->SetOutputSpacing(1,1,1); - //EED 18 fev 2014 change->SetOutputOrigin (0, 0, 0); - change->Update(); vectspc.clear(); - vectspc.push_back(spc[0]); vectspc.push_back(spc[1]); vectspc.push_back(spc[2]); vectimagesSpacing.push_back(vectspc); vectimg[i] = change->GetOutput(); - } - + } // for i vectimages = vectimg; } - void KernelManagerContour::GetSpacing(double *vecspc, int iImage) { vecspc[0]=vectimagesSpacing[iImage][0]; @@ -149,8 +129,8 @@ void KernelManagerContour::GetSpacing(double *vecspc, int iImage) vecspc[2]=vectimagesSpacing[iImage][2]; } - -void KernelManagerContour::initializeEnvironment(std::string datadir){ +void KernelManagerContour::initializeEnvironment(std::string datadir) +{ _datadir = datadir; std::string conceptsFN = datadir+"holaConceptsFile.cf"; std::string imageSourcesFN = datadir+"holaImagesInstantsFile.of"; @@ -162,102 +142,121 @@ void KernelManagerContour::initializeEnvironment(std::string datadir){ std::map* axesMap = new std::map(); std::map* outlinesMap = new std::map(); - for(int i = 0; i < (int)(vectimages.size()); i++){ + for(int i = 0; i < (int)(vectimages.size()); i++) + { vtkImageData* selectedimage = vectimages[i]; - ImageSourceThing * thing = new ImageSourceThing(selectedimage); + ImageSourceThing * thing = new ImageSourceThing(selectedimage); std::string imgstring = "Source Image "+intToString(i+1); sourcesMap->insert(std::pair( imgstring, thing)); - } - + } // for OutlineModelBuilder * _builder = new OutlineModelBuilder( conceptsFN ,datadir); _builder->buildImageSource_Envornment( imageSourcesFN, sourcesMap ); _builder->buildImageSection_Envornment( imageSectionsFN, sectionsMap ); _builder->buildAxe_Envornment(axeThingsFN, axesMap ); _builder->buildCountour_Envornment( imageSectionsFN, outlinesMap ); - //Creating the objects to manage modelManager = new OutlineModelManager( _builder->getImSourceEnv(), _builder->getImSectionEnv(), _builder->getAxesEnv(), _builder->getContourEnv() ); - imageSource = modelManager->getImageSourceThingByKeyName( "Source Image 1" ); - } -vtkImageData* KernelManagerContour::getSourceImage(){ + +vtkImageData* KernelManagerContour::getSourceImage() +{ return imageSource->getSourceImage(); } -OutlineModelManager* KernelManagerContour::getOutlineModelManager(){ + +OutlineModelManager* KernelManagerContour::getOutlineModelManager() +{ return modelManager; } -std::string KernelManagerContour::createOutline(manualBaseModel * manModelContour,std::vector instantVector){ +std::string KernelManagerContour::createOutline(manualBaseModel * manModelContour,std::vector instantVector) +{ return modelManager->createOutline( manModelContour, instantVector ); } -std::string KernelManagerContour::intToString(int num){ +std::string KernelManagerContour::intToString(int num) +{ std::string result; - if(num == 0){ + if(num == 0) + { result = "0"; }else{ int k=num; - while (k > 0){ + while (k > 0) + { char temp = k % 10 + 48; k = k / 10; result = temp + result; - } - } + } // while + } // if num return result; } -std::vector KernelManagerContour::GetLstNameThingsStatic(){ +std::vector KernelManagerContour::GetLstNameThingsStatic() +{ return modelManager->GetLstNameThingsStatic(); } -void KernelManagerContour::SaveThingName(FILE* pFile, FILE *pFileData, std::string name ){ +void KernelManagerContour::SaveThingName(FILE* pFile, FILE *pFileData, std::string name ) +{ modelManager->SaveThingName(pFile, pFileData, name); } -std::vector KernelManagerContour::GetLstNameThings(){ + +std::vector KernelManagerContour::GetLstNameThings() +{ return modelManager->GetLstNameThings(); } + //int KernelManagerContour::IsPartOfStaticList(std::string keyName ){ // return modelManager->IsPartOfStaticList(keyName); //} -bool KernelManagerContour::IsPartOfStaticList(std::string theKeyName){ +bool KernelManagerContour::IsPartOfStaticList(std::string theKeyName) +{ return modelManager->IsPartOfStaticList(theKeyName) == -1; } -void KernelManagerContour::deleteCModel(std::string theKeyName){ +void KernelManagerContour::deleteCModel(std::string theKeyName) +{ manualBaseModel* cModel = modelManager->getOutlineByKeyName(theKeyName)->getModel(); modelManager->removeOutline( theKeyName ); - delete cModel; } -void KernelManagerContour::removeAllOutlines(){ +void KernelManagerContour::removeAllOutlines() +{ modelManager->removeAllOutlines(); } -std::vector KernelManagerContour::getActualInstantOutlines(){ +std::vector KernelManagerContour::getActualInstantOutlines() +{ return modelManager->getActualInstantOutlines(); } -int KernelManagerContour::getNamesWrappingSize(){ +int KernelManagerContour::getNamesWrappingSize() +{ return getActualInstantOutlines().size(); } -std::string KernelManagerContour::getNameWrapping(int i){ +std::string KernelManagerContour::getNameWrapping(int i) +{ return getActualInstantOutlines()[i]->getKeyName(); } -void KernelManagerContour::setInstant(Instant * theInstant){ +void KernelManagerContour::setInstant(Instant * theInstant) +{ modelManager->setInstant(theInstant); //_actualInstant = theInstant; } -Instant * KernelManagerContour::getCurrentInstant(){ +Instant * KernelManagerContour::getCurrentInstant() +{ return modelManager->getInstant(); } -void KernelManagerContour::setInstant(std::vector vectInstant){ + +void KernelManagerContour::setInstant(std::vector vectInstant) +{ Instant* act = new Instant ( &vectInstant ); modelManager->setInstant(act); } @@ -272,36 +271,37 @@ manualBaseModel* KernelManagerContour::getOutlineByKeyName(std::string cloneName return modelManager->getOutlineByKeyName (cloneName )->getModel(); } -bool KernelManagerContour::onRedo(std::string& filename){ - if(inredo > 0){ +bool KernelManagerContour::onRedo(std::string& filename) +{ + if(inredo > 0) + { inredo--; inundo++; std::string str = intToString(inundo); filename = stundoredo + str + ".roi"; //loadState(temp); return true; - } + } // inredo return false; } -bool KernelManagerContour::onUndo(std::string& filename){ - if(inundo>0){ +bool KernelManagerContour::onUndo(std::string& filename) +{ + if(inundo>0) + { inredo++; inundo--; - //char str[9000]; //itoa(inundo, str, 10); std::string str = intToString(inundo); - - filename = stundoredo + str + ".roi"; - return true;//loadState(temp); } return false; } -std::string KernelManagerContour::saveState(){ +std::string KernelManagerContour::saveState() +{ inredo=0; std::string str = intToString(inundo); std::string temp = stundoredo + str + ".roi"; @@ -309,20 +309,20 @@ std::string KernelManagerContour::saveState(){ return temp; } -bool KernelManagerContour::onUndoSaveFile(std::string& filename){ - if(inundo>0){ - if(inredo==0){ - +bool KernelManagerContour::onUndoSaveFile(std::string& filename) +{ + if(inundo>0) + { + if(inredo==0) + { //char str[9000]; //itoa(inundo, str, 10); std::string str = intToString(inundo); - filename = stundoredo + str + ".roi"; return true; //saveFileWithContours(temp); - - } - } + } // if inundo ==0 + } // if inundo > 0 return false; } @@ -346,23 +346,20 @@ std::string KernelManagerContour::onSpreadAdd( std::vector *vecX, std::v { _contourPropagation = new ContourPropagation(); } - - if (vecX->size()!=0){ - + if (vecX->size()!=0) + { int i,size=vecZ->size(); int actualSlice = instants[1]; for ( i=0 ; iappendContour(vecX , vecY , vecZ); return intToString(actualSlice); } return ""; } - void KernelManagerContour::getMaxMinZ(double *minZ,double *maxZ) { if (_contourPropagation!=NULL) @@ -371,7 +368,6 @@ void KernelManagerContour::getMaxMinZ(double *minZ,double *maxZ) } } - void KernelManagerContour::CalculeSplinePropagation() { _contourPropagation->setInterpolationNumber(100); @@ -382,13 +378,10 @@ manualBaseModel* KernelManagerContour::GetPoints(int z,int type, std::vectorifSliceKeyContourExist(z)==false){ - + if (_contourPropagation->ifSliceKeyContourExist(z)==false) + { manModelContour = factoryManualContourModel( typeofcontour ); - int idTmp = _contourPropagation->FindIdWithZ(z); - if (type==0) // Initial Points { _contourPropagation->GetInitialControlPoints( idTmp , vecCtrlPointX,vecCtrlPointY,vecCtrlPointZ); @@ -409,67 +402,57 @@ manualBaseModel* KernelManagerContour::GetPoints(int z,int type, std::vectorAddPoint( (*vecCtrlPointX)[j] , (*vecCtrlPointY)[j] , -900 ); //-------------------------------------------------------------------- } // for j - tempVector[1]=z; theName = modelManager->createOutline( manModelContour, tempVector ); addedModel = theName.compare("") != 0; - if(!addedModel){ + if(!addedModel) + { manModelContour = NULL; } - }// ifSliceKeyContourExist return manModelContour; } -manualBaseModel * KernelManagerContour::factoryManualContourModel(int typeContour) +manualBaseModel *KernelManagerContour::factoryManualContourModel(int typeContour) { manualBaseModel *manModelContour=NULL; - // Creating the model // NOTE: The view and the controler are created in the wxVtkBaseView_SceneManager class, configureViewControlTo method - // spline if (typeContour==0) { manModelContour = new manualContourModel(); } - // spline if (typeContour==1) { manModelContour = new manualContourModel(); } - // rectangle if (typeContour==2) { manModelContour = new manualContourModelRoi(); } - // circle if (typeContour==3) { manModelContour = new manualContourModelCircle(); } - // line if (typeContour==6) { manModelContour = new manualContourModelLine(); } - // points if (typeContour==7) { manModelContour = new manualBaseModel(); } - // polygon if (typeContour==10) { manModelContour = new manualContourModelPolygon(); } - return manModelContour; } -- 2.45.1