From 866b5d203f30800ea0c9c7ab22901776c695ffd0 Mon Sep 17 00:00:00 2001 From: Eduardo DAVILA Date: Fri, 19 Apr 2013 17:12:45 +0200 Subject: [PATCH] Feature #1991 Update doxygen documentation Feature #1992 Flip contours --- .../interfIOMenu.cxx | 13 +- .../interfMainPanel.cxx | 46 ++++- .../interfMainPanel.h | 7 +- .../interfSegmentationPanels.cxx | 10 +- .../interfSegmentationPanels.h | 3 + .../interfToolsMenu.cxx | 10 ++ .../interfToolsMenu.h | 2 + .../interfToolsPanels.cxx | 52 ++++++ .../interfToolsPanels.h | 17 ++ .../wxContourMainFrame.cxx | 159 +++++++++++++++++- .../wxContourMainFrame.h | 10 +- lib/doxygen/CMakeLists.txt | 1 + lib/doxygen/DoxyMainPage.txt.in | 13 +- 13 files changed, 319 insertions(+), 24 deletions(-) diff --git a/lib/Interface_Icons_NDimensions/interfIOMenu.cxx b/lib/Interface_Icons_NDimensions/interfIOMenu.cxx index bd1cc5c..027ab57 100644 --- a/lib/Interface_Icons_NDimensions/interfIOMenu.cxx +++ b/lib/Interface_Icons_NDimensions/interfIOMenu.cxx @@ -67,18 +67,23 @@ void interfIOMenu::initButtons(wxEvtHandler* evtHandler) { this->connectEvents(evtHandler); } -void interfIOMenu::onLoad(wxCommandEvent& event){ +void interfIOMenu::onLoad(wxCommandEvent& event) +{ interfMainPanel::getInstance()->onLoad(); } -void interfIOMenu::onSave(wxCommandEvent& event){ +void interfIOMenu::onSave(wxCommandEvent& event) +{ interfMainPanel::getInstance()->onSave(); } -void interfIOMenu::onImport(wxCommandEvent& event){ +void interfIOMenu::onImport(wxCommandEvent& event) +{ interfMainPanel::getInstance()->onImport(); } -void interfIOMenu::onTest(wxCommandEvent& event){ +void interfIOMenu::onTest(wxCommandEvent& event) +{ + printf("EED interfIOMenu::onTest\n"); interfMainPanel::getInstance()->onTest(); } diff --git a/lib/Interface_Icons_NDimensions/interfMainPanel.cxx b/lib/Interface_Icons_NDimensions/interfMainPanel.cxx index a1d38ca..7d77c93 100644 --- a/lib/Interface_Icons_NDimensions/interfMainPanel.cxx +++ b/lib/Interface_Icons_NDimensions/interfMainPanel.cxx @@ -55,6 +55,7 @@ interfMainPanel::interfMainPanel(wxWindow * parent, int sizex, int sizey, wxEvtH colorImageLayerPanel = NULL; currentWindow = NULL; testPanel = NULL; + flipPanel = NULL; //CMRU 17-08-09 ------------------------------------------------------------------ infoPanelCalibration = NULL; @@ -472,11 +473,14 @@ void interfMainPanel::onSave() wxContourMainFrame::getInstance()->onSave(); } -void interfMainPanel::onImport(){ +void interfMainPanel::onImport() +{ wxContourMainFrame::getInstance()->onImport(); } -void interfMainPanel::onTest(){ +void interfMainPanel::onTest() +{ + printf("EED interfMainPanel::onTest \n"); if(testPanel==NULL) { testPanel = new wxPanel(interfMainPanel::getInstance()->getInfoPanel(), -1, wxDefaultPosition, @@ -485,17 +489,15 @@ void interfMainPanel::onTest(){ testPanel->SetSizer(flexsizer, true); testPanel->SetAutoLayout( true ); panelTest = new interfTestPanel(testPanel); - - wxStaticText* stattext = new wxStaticText(mirrorPanel, -1, + wxStaticText* stattext = new wxStaticText(testPanel, -1, wxString(_T(" Test Panel ")), wxDefaultPosition, wxDefaultSize, wxALIGN_CENTRE|wxBORDER_SIMPLE|wxFULL_REPAINT_ON_RESIZE, wxString(_T(""))); - flexsizer->Add(stattext,wxALIGN_CENTER | wxALIGN_CENTRE); flexsizer->Add(panelTest, wxEXPAND); testPanel->Layout(); - showPanel(testPanel); } + showPanel(testPanel); } void interfMainPanel::RefreshInterface() @@ -964,6 +966,38 @@ 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 () { diff --git a/lib/Interface_Icons_NDimensions/interfMainPanel.h b/lib/Interface_Icons_NDimensions/interfMainPanel.h index d19c1b0..4513de2 100644 --- a/lib/Interface_Icons_NDimensions/interfMainPanel.h +++ b/lib/Interface_Icons_NDimensions/interfMainPanel.h @@ -195,7 +195,10 @@ public: virtual bool Show(bool show); void ShowResultImages(int typeContourGroup, int selection, int minZ, int maxZ); void SetContourGroup(int contourGroup); + void onFlipContours(); + void FlipContours(int typeContourFlip, int flipDirection); + //CMRU 29-08-09----------------------------------------------------------------------------------------------- /** @@ -203,7 +206,6 @@ public: */ void onPrintLabel(); - /** * Calculates the pixel value in milimeters according to the current contour if the selected contour is a Line Contour * @param size Size in milimeters of the selected contour @@ -291,6 +293,9 @@ private: wxPanel *testPanel; interfTestPanel *panelTest; + wxPanel *flipPanel; + interfFlipPanel *panelFlip; + wxPanel *mirrorPanel; interfMirrorPanel *panelMirror; diff --git a/lib/Interface_Icons_NDimensions/interfSegmentationPanels.cxx b/lib/Interface_Icons_NDimensions/interfSegmentationPanels.cxx index 995344b..e7bb971 100644 --- a/lib/Interface_Icons_NDimensions/interfSegmentationPanels.cxx +++ b/lib/Interface_Icons_NDimensions/interfSegmentationPanels.cxx @@ -290,15 +290,11 @@ void interfMirrorPanel::onChangeWidth(wxScrollEvent& event) } - - - - - BEGIN_EVENT_TABLE(interfMirrorPanel, wxPanel) EVT_SCROLL(interfMirrorPanel :: onChangeWidth) END_EVENT_TABLE() + ////////////////////////////////////////////////////////////// interfTestPanel::interfTestPanel(wxWindow* parent) @@ -331,3 +327,7 @@ void interfTestPanel::onButton2Pressed(wxCommandEvent& event) { std::cout << "Button 2 has been pressed" << std::endl; } + + + + diff --git a/lib/Interface_Icons_NDimensions/interfSegmentationPanels.h b/lib/Interface_Icons_NDimensions/interfSegmentationPanels.h index eba01a8..3f45505 100644 --- a/lib/Interface_Icons_NDimensions/interfSegmentationPanels.h +++ b/lib/Interface_Icons_NDimensions/interfSegmentationPanels.h @@ -125,6 +125,9 @@ private: DECLARE_EVENT_TABLE() }; + + + class interfTestPanel : public wxPanel { diff --git a/lib/Interface_Icons_NDimensions/interfToolsMenu.cxx b/lib/Interface_Icons_NDimensions/interfToolsMenu.cxx index d7bb7ab..7f97b64 100644 --- a/lib/Interface_Icons_NDimensions/interfToolsMenu.cxx +++ b/lib/Interface_Icons_NDimensions/interfToolsMenu.cxx @@ -69,6 +69,11 @@ void interfToolsMenu::initButtons(wxEvtHandler* evtHandler) { //------------------------------------------------------------------------------- + path.push_back(datadir + "/FlipContours.png"); + nom.push_back("Flop contours"); + funct.push_back((wxObjectEventFunction) &interfToolsMenu:: onFlipPressed); + + this->addButtons(path, nom); this->setVectorFunction(funct); @@ -109,3 +114,8 @@ void interfToolsMenu::onPrintLabel(wxCommandEvent& event) interfMainPanel::getInstance()->onPrintLabel(); } +void interfToolsMenu::onFlipPressed(wxCommandEvent& event) +{ + printf("EED interfToolsMenu::onFlipLabel \n"); + interfMainPanel::getInstance()->onFlipContours(); +} diff --git a/lib/Interface_Icons_NDimensions/interfToolsMenu.h b/lib/Interface_Icons_NDimensions/interfToolsMenu.h index 5f60f9f..9849ba8 100644 --- a/lib/Interface_Icons_NDimensions/interfToolsMenu.h +++ b/lib/Interface_Icons_NDimensions/interfToolsMenu.h @@ -51,6 +51,8 @@ public: void onSpreadPressed(wxCommandEvent& event); void onMirrorPressed(wxCommandEvent& event); void onPrintLabel(wxCommandEvent& event); + void onFlipPressed(wxCommandEvent& event); + private: diff --git a/lib/Interface_Icons_NDimensions/interfToolsPanels.cxx b/lib/Interface_Icons_NDimensions/interfToolsPanels.cxx index fc28256..baa8cd8 100644 --- a/lib/Interface_Icons_NDimensions/interfToolsPanels.cxx +++ b/lib/Interface_Icons_NDimensions/interfToolsPanels.cxx @@ -551,3 +551,55 @@ void interfCalibrationPanel::onCalibrate(wxCommandEvent& event) } //------------------------------------------------------------------------------------------------------------ + + +////////////////////////////////////////////////////////////// + +interfFlipPanel::interfFlipPanel(wxWindow* parent) +: wxPanel(parent, -1, wxDefaultPosition, wxDefaultSize, wxBORDER_SUNKEN) +{ + wxButton *buttonFlipX = new wxButton(this,wxID_ANY,_T("Flip Horizontally"), wxDefaultPosition, wxSize(200,35) ); + wxButton *buttonFlipY = new wxButton(this,wxID_ANY,_T("Flip Vertically"), wxDefaultPosition, wxSize(200,35) ); + + wxString lstOptions[3]; + lstOptions[0]=_T("Flip selected contours"); + lstOptions[1]=_T("Flip all contours of actual slice"); + lstOptions[2]=_T("Flip all contours"); + _wichContoursRadioBox = new wxRadioBox(this, -1, _T("Transform"), wxDefaultPosition, wxDefaultSize, 3 , lstOptions, 1, wxRA_SPECIFY_COLS); + _wichContoursRadioBox->SetSelection(2); + + + Connect( buttonFlipX->GetId(), wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &interfFlipPanel::onFlipXPressed ); + Connect( buttonFlipY->GetId(), wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &interfFlipPanel::onFlipYPressed ); + + wxFlexGridSizer * sizer = new wxFlexGridSizer(1); + sizer -> Add( _wichContoursRadioBox, 1, wxGROW ); + sizer -> Add( buttonFlipX, 1, wxGROW ); + sizer -> Add( buttonFlipY, 1, wxGROW ); + + this->SetSizer( sizer ); + this->SetAutoLayout( true ); + this->Layout(); +} + + + + +interfFlipPanel::~interfFlipPanel(){ +} + +void interfFlipPanel::onFlipXPressed(wxCommandEvent& event) +{ + std::cout << "interfToolsPanels.cxx interfFlipPanel::onFlipXPressed FlipX (btn)" << std::endl; + int typeContoursFlip = _wichContoursRadioBox->GetSelection(); + interfMainPanel::getInstance()->FlipContours( typeContoursFlip , 0 ); // type, direction +} + +void interfFlipPanel::onFlipYPressed(wxCommandEvent& event) +{ + std::cout << "interfToolsPanels.cxx interfFlipPanel::onFlipYPressed FlipY (btn)" << std::endl; + int typeContoursFlip = _wichContoursRadioBox->GetSelection(); + interfMainPanel::getInstance()->FlipContours( typeContoursFlip , 1 ); // type, direction +} + + diff --git a/lib/Interface_Icons_NDimensions/interfToolsPanels.h b/lib/Interface_Icons_NDimensions/interfToolsPanels.h index 5f87c5d..23d2011 100644 --- a/lib/Interface_Icons_NDimensions/interfToolsPanels.h +++ b/lib/Interface_Icons_NDimensions/interfToolsPanels.h @@ -113,11 +113,26 @@ private: void onContourGroup(wxCommandEvent& event); void FillGridWithContoursInformation(); void onRangeSliceInformation(wxCommandEvent& event); +}; + +class interfFlipPanel + : public wxPanel +{ +public: + interfFlipPanel(wxWindow * parent); + ~interfFlipPanel(); + wxRadioBox *_wichContoursRadioBox; +private: + void onFlipXPressed(wxCommandEvent& event); + + void onFlipYPressed(wxCommandEvent& event); }; + + //CMRU 29-08-09----------------------------------------------------------------------------------------------- /** * This class represents the calibration panel in the interface icons @@ -152,7 +167,9 @@ private: */ wxRadioBox * _unitsRadiobox; }; + //------------------------------------------------------------------------------------------------------------ + #endif diff --git a/lib/Interface_ManagerContour_NDimensions/wxContourMainFrame.cxx b/lib/Interface_ManagerContour_NDimensions/wxContourMainFrame.cxx index ef396dc..2bf2f0a 100644 --- a/lib/Interface_ManagerContour_NDimensions/wxContourMainFrame.cxx +++ b/lib/Interface_ManagerContour_NDimensions/wxContourMainFrame.cxx @@ -981,6 +981,46 @@ void wxContourMainFrame::onLoad() } +void wxContourMainFrame::SetZForAllContours(int pz) +{ + printf("EED wxContourMainFrame::SetZForAllContours\n"); + + //-- Normal Contours + + std::vector< std::string > lstNameThings; + int i,sizeLstNameThings; + int ii,sizeLstPoints; + + lstNameThings = kernelManager->GetLstNameThings(); + sizeLstNameThings = lstNameThings.size(); + for (i=0 ; igetOutlineByKeyName(lstNameThings[i]); + sizeLstPoints = manualModel->GetSizeLstPoints(); + for (ii=0 ; iiGetManualPoint(ii)->SetPointZ(-900); + }// for ii list of points + }// for i list of Things + + //-- Static Contours + + lstNameThings = kernelManager->GetLstNameThingsStatic(); + sizeLstNameThings = lstNameThings.size(); + for (i=0 ; igetOutlineByKeyName(lstNameThings[i]); + sizeLstPoints = manualModel->GetSizeLstPoints(); + for (ii=0 ; iiGetManualPoint(ii)->SetPointZ(-900); + }// for ii list of points + }// for i list of static things +} + + + void wxContourMainFrame::onLoadContours(std::string fileNameContourROI, bool interactiveInterface) { char tmp[255]; @@ -1014,6 +1054,10 @@ void wxContourMainFrame::onLoadContours(std::string fileNameContourROI, bool int fscanf(pFile,"%s",tmp); // 1.0.3 || 1.0.2 || 1.0.1 || 1.0.0 std::string version(tmp); + +printf("EED wxContourMainFrame::onLoadContours version%s \n", version.c_str() ); + + //AD:02-06-09 _tmpReadFileTypeOfTransformation=-1; if (version=="1.0.3") @@ -1021,15 +1065,16 @@ void wxContourMainFrame::onLoadContours(std::string fileNameContourROI, bool int readDimSpc(pFile,interactiveInterface); // DimSpc interactive ON openContours(pFile,pFileData,false); openContours(pFile,pFileData,true); //Load StaticContours - } + } if (version=="1.0.2") { //EED001 - readDimSpc(pFile,interactiveInterface); // DimSpc interactive ON + readDimSpc(pFile,interactiveInterface); // DimSpc interactive ON openContours(pFile,pFileData,false); - readDimSpc(pFile,false); // DimSpc interactive OFF - openContours(pFile,pFileData,true); //Load StaticContours + readDimSpc(pFile,false); // DimSpc interactive OFF + openContours(pFile,pFileData,true); // Load StaticContours + SetZForAllContours(-900); } //AD:02-06-09 @@ -1054,7 +1099,6 @@ void wxContourMainFrame::onLoadContours(std::string fileNameContourROI, bool int } _theViewPanel->getSceneManager()->removeSceneContours(); changeInstant(); - } @@ -1229,7 +1273,7 @@ void wxContourMainFrame::readDimSpc(FILE *pFile, bool interactiveOption) //Compare Spacing and Dims in X and Y (Necessary in Z?) - Just for Version 2 if (imageDim[0]!=_tmpReadFileImageDim[0] || imageDim[1]!=_tmpReadFileImageDim[1] || imageSpac[0]!=_tmpReadFileImageSpac[0] || imageSpac[1]!=_tmpReadFileImageSpac[1]) { - wxDialog* dial = new wxDialog (this,-1,_T("Tools"),wxDefaultPosition, wxSize(260,160)); + wxDialog* dial = new wxDialog (this,-1,_T("Tools"),wxDefaultPosition, wxSize(460,360)); wxSizer* buttonsSizer = dial->CreateSeparatedButtonSizer(wxOK|wxCANCEL); wxBoxSizer *dialSizer = new wxBoxSizer(wxVERTICAL); @@ -3260,3 +3304,106 @@ void wxContourMainFrame::SetFileLocation(std::string newFileLocation) std::cout<<"GETFILELOCATION:"<<_fileLocation<)_theViewPanel->getSceneManager()->getSelectedObjects() , + flipDirection + ); + +} + +void wxContourMainFrame::FlipActualSliceContours(int flipDirection) +{ + printf("EED wxContourMainFrame::FlipActualSliceContours flipDirection=%d \n", flipDirection ); + FlipLstOfContours( + (std::vector)_theViewPanel->getSceneManager()->GetlstContoursNameActualSlice() , + flipDirection + ); +} + +void wxContourMainFrame::FlipAllContours(int flipDirection) +{ + printf("EED wxContourMainFrame::FlipAllContours flipDirection=%d \n", flipDirection ); + FlipLstOfContours( + kernelManager->GetLstNameThings() , + flipDirection + ); +} + +void wxContourMainFrame::FlipLstOfContours(std::vector lstNameThings, int flipDirection) +{ + int ext[6]; + getImageData()->GetExtent(ext); + int sizeX = ext[1]-ext[0]; + int sizeY = ext[3]-ext[2]; + + + int i,sizeLstNameThings; + int ii,sizeLstPoints; + + sizeLstNameThings = lstNameThings.size(); + for (i=0 ; igetOutlineByKeyName(lstNameThings[i]); + if (flipDirection==0) + { + manualModel->Transform_Ax_Plus_B(-1,sizeX,1,0 ); + } else { + manualModel->Transform_Ax_Plus_B(1,0,-1,sizeY ); + } + }// for i list of Things + + //-- Static Contours + + lstNameThings = kernelManager->GetLstNameThingsStatic(); + sizeLstNameThings = lstNameThings.size(); + for (i=0 ; igetOutlineByKeyName(lstNameThings[i]); + if (flipDirection==0) + { + manualModel->Transform_Ax_Plus_B(-1,sizeX,1,0 ); + } else { + manualModel->Transform_Ax_Plus_B(1,0,-1,sizeY ); + } + }// for i list of static things +} + +void wxContourMainFrame::FlipContours(int typeContourFlip, int flipDirection) +{ + printf("EED wxContourMainFrame::FlipContours( %d , %d ) \n",typeContourFlip, flipDirection ); + + saveState(); + + if (typeContourFlip==0) // + { + FlipSelectedContours(flipDirection); + } + + if (typeContourFlip==1) // + { + FlipActualSliceContours(flipDirection); + } + + if (typeContourFlip==2) // + { + FlipAllContours(flipDirection); + } + RefreshInterface(); +} + + + + + diff --git a/lib/Interface_ManagerContour_NDimensions/wxContourMainFrame.h b/lib/Interface_ManagerContour_NDimensions/wxContourMainFrame.h index 8bf345a..606221d 100644 --- a/lib/Interface_ManagerContour_NDimensions/wxContourMainFrame.h +++ b/lib/Interface_ManagerContour_NDimensions/wxContourMainFrame.h @@ -258,7 +258,14 @@ class wxContourMainFrame : public wxPanel { //AD void onMirror(); - + //EED + void FlipContours(int typeContourFlip, int flipDirection); + void FlipSelectedContours(int flipDirection); + void FlipActualSliceContours(int flipDirection); + void FlipAllContours(int flipDirection); + void FlipLstOfContours(std::vector lstNameThings, int flipDirection); + + //==================================================================================================== void showAxis(bool show); @@ -414,6 +421,7 @@ private: void saveFileWithContours( std::string filename ); void onLoadContours(std::string fileNameContourROI, bool interactiveInterface); + void SetZForAllContours(int pz); int inredo; int inundo; diff --git a/lib/doxygen/CMakeLists.txt b/lib/doxygen/CMakeLists.txt index 4c85dd7..8f3d267 100644 --- a/lib/doxygen/CMakeLists.txt +++ b/lib/doxygen/CMakeLists.txt @@ -84,6 +84,7 @@ MACRO(CREA_BUILD_DOXYGEN_DOC NAME INPUT DOC_RELATIVE_INSTALL_PATH PREDEFINED) #IF ( ${${PROJECT_NAME}_DOC} STREQUAL ON) IF ( ${PROJECT_NAME}_DOC STREQUAL ON) CREA_CPDIR ( ${CMAKE_CURRENT_SOURCE_DIR}/bouml/GeneralArchitecture/GeneralArchitecture_HTML/ ${DOXYGEN_OUTPUT}/${DOXYGEN_HTML_OUTPUT}/GeneralArchitecture_HTML/ ) + CREA_CPDIR ( ${CMAKE_CURRENT_SOURCE_DIR}/bouml/buttons/ ${DOXYGEN_OUTPUT}/${DOXYGEN_HTML_OUTPUT}/How_to_add_buttons_HTML/ ) ADD_CUSTOM_TARGET(doxygen_${NAME} ALL DEPENDS ${DOXYGEN_OUTPUT}/${DOXYGEN_HTML_OUTPUT}/index.html diff --git a/lib/doxygen/DoxyMainPage.txt.in b/lib/doxygen/DoxyMainPage.txt.in index aebfa7b..459e2df 100644 --- a/lib/doxygen/DoxyMainPage.txt.in +++ b/lib/doxygen/DoxyMainPage.txt.in @@ -158,6 +158,17 @@ serve as building blocks for the rest of 
+ +

Tutorials

creaContours +is continously evolving. Its development it's not yet finished and tha +application sees new features being added to it on a regular basis. The +tutorials give a rough idea of how to contribute to the development of +certain aspects of the application.
  • How to add a new button. Quick step-by-step guide on how to add to the application. a new button and its associated functionality.
+ + + + +

Modules Description

@@ -193,4 +204,4 @@ possible.

\endhtmlonly - */ \ No newline at end of file + */ -- 2.45.0