From: donadio Date: Tue, 3 Mar 2009 09:56:23 +0000 (+0000) Subject: *** empty log message *** X-Git-Tag: EED.02Oct2009~65 X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=commitdiff_plain;h=4d5574beaa0d2f56951b00a9fcca5dd945506e13;p=creaContours.git *** empty log message *** --- diff --git a/data/Icons/Line.png b/data/Icons/Line.png new file mode 100644 index 0000000..5e052b3 Binary files /dev/null and b/data/Icons/Line.png differ diff --git a/data/Icons/Mirror.png b/data/Icons/Mirror.png new file mode 100644 index 0000000..b8c892e Binary files /dev/null and b/data/Icons/Mirror.png differ diff --git a/lib/Interface_Icons_NDimensions/interfMainPanel.cxx b/lib/Interface_Icons_NDimensions/interfMainPanel.cxx index 1ad6cb4..d5a9e52 100644 --- a/lib/Interface_Icons_NDimensions/interfMainPanel.cxx +++ b/lib/Interface_Icons_NDimensions/interfMainPanel.cxx @@ -29,6 +29,7 @@ interfMainPanel::interfMainPanel(wxWindow * parent, int sizex, int sizey, wxEvtH spreadPanel = NULL; infoWin=NULL; informationPanel=NULL; + mirrorPanel=NULL; splitterwindow = new wxSplitterWindow(this,-1, wxDefaultPosition, wxSize(sizex, sizey), wxSP_3DSASH, wxString(_T(""))); @@ -396,6 +397,10 @@ void interfMainPanel::onCreateContourCircle( ){ wxContourMainFrame::getInstance()->showAxis(false); wxContourMainFrame::getInstance()->onCreateContourCircle(); } +void interfMainPanel::onCreateContourLine( ){ + wxContourMainFrame::getInstance()->showAxis(false); + wxContourMainFrame::getInstance()->onCreateContourLine(); +} void interfMainPanel::onCreateContoursBullEye(wxPanel* panBull){ wxContourMainFrame::getInstance()->showAxis(false); wxContourMainFrame::getInstance()->onCreateContourBullEye(panBull); @@ -439,7 +444,8 @@ vtkImageData* interfMainPanel::getImageData(){ return wxContourMainFrame::getInstance()->getImageData(); } -void interfMainPanel::onSegmentationOneSlice(int isovalue,int sampling,int method){ +void interfMainPanel::onSegmentationOneSlice(int isovalue,int sampling,int method) +{ wxContourMainFrame::getInstance()->onSegmentationOneSlice(isovalue, sampling, method); } @@ -455,6 +461,11 @@ void interfMainPanel::onSegmentationAllSlice(int minZ,int maxZ,int isovalue,int wxContourMainFrame::getInstance()->onSegmentationAllSlice(minZ, maxZ,isovalue,sampling,method); } +void interfMainPanel::onMirror() +{ + wxContourMainFrame::getInstance()->onMirror(); +} + void interfMainPanel::setLabelSegmentationPanelVTK(wxString tmpString){ ((interfSegmentationPanelVTK*)segmentationPanel)->setLabel(tmpString); } @@ -673,3 +684,23 @@ wxString interfMainPanel::getCellValue(int j,int i){ void interfMainPanel::onSnakePressed(){ wxContourMainFrame::getInstance()->onSnakePressed(); } + +void interfMainPanel::onMirrorPressed(){ + if(mirrorPanel==NULL){ + + mirrorPanel = new wxPanel(interfMainPanel::getInstance()->getInfoPanel(), -1, wxDefaultPosition, wxDefaultSize, wxBORDER_STATIC, wxString(_T(""))); + wxFlexGridSizer* flexsizer = new wxFlexGridSizer(1); + mirrorPanel->SetSizer(flexsizer, true); + mirrorPanel->SetAutoLayout( true ); + panelMirror = new interfMirrorPanel(mirrorPanel); + + wxStaticText* stattext = new wxStaticText(mirrorPanel, -1, wxString(_T(" Mirroring Tool ")), wxDefaultPosition, + wxDefaultSize, wxALIGN_CENTRE|wxBORDER_SIMPLE|wxFULL_REPAINT_ON_RESIZE, wxString(_T(""))); + + flexsizer->Add(stattext,wxALIGN_CENTER | wxALIGN_CENTRE); + flexsizer->Add(panelMirror, wxEXPAND); + mirrorPanel->Layout(); + } + showPanel(mirrorPanel); + //hideAxis(); +} diff --git a/lib/Interface_Icons_NDimensions/interfMainPanel.h b/lib/Interface_Icons_NDimensions/interfMainPanel.h index 0ded704..cb17e22 100644 --- a/lib/Interface_Icons_NDimensions/interfMainPanel.h +++ b/lib/Interface_Icons_NDimensions/interfMainPanel.h @@ -82,6 +82,7 @@ public: void onCreateContourSpline( ); void onCreateContourRectangle( ); void onCreateContourCircle( ); + void onCreateContourLine( ); void onCreateContoursBullEye(wxPanel* panBull); ///////////////////////////////// void onDeleteContour(); @@ -109,6 +110,8 @@ public: void onSegmentationAllSlice(int minZ,int maxZ,int isovalue,int sampling,int method); + void onMirror(); + void setLabelSegmentationPanelVTK(wxString tmpString); void onSegmentationPressed(); @@ -166,6 +169,9 @@ public: wxString getCellValue(int j,int i); void onSnakePressed(); + + void onMirrorPressed(); + private: @@ -204,6 +210,8 @@ private: wxPanel* configPanel; wxPanel* spreadPanel; interfSpreadPanel* panelSpread; + wxPanel* mirrorPanel; + interfMirrorPanel* panelMirror; wxWindow* infoWin; wxPanel* informationPanel; diff --git a/lib/Interface_Icons_NDimensions/interfNewContourMenu.cxx b/lib/Interface_Icons_NDimensions/interfNewContourMenu.cxx index db374f0..4b56e7b 100644 --- a/lib/Interface_Icons_NDimensions/interfNewContourMenu.cxx +++ b/lib/Interface_Icons_NDimensions/interfNewContourMenu.cxx @@ -39,6 +39,11 @@ void interfNewContourMenu::initButtons(wxEvtHandler* evtHandler) { 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); + this->addButtons(path, nom); this->setVectorFunction(funct); @@ -77,4 +82,7 @@ void interfNewContourMenu::onCreateContourRectangle( wxCommandEvent& event ){ void interfNewContourMenu::onCreateContourCircle( wxCommandEvent& event ){ interfMainPanel::getInstance()->onCreateContourCircle(); } +void interfNewContourMenu::onCreateContourLine( wxCommandEvent& event ){ + interfMainPanel::getInstance()->onCreateContourLine(); +} diff --git a/lib/Interface_Icons_NDimensions/interfNewContourMenu.h b/lib/Interface_Icons_NDimensions/interfNewContourMenu.h index bf2ec97..8f942ec 100644 --- a/lib/Interface_Icons_NDimensions/interfNewContourMenu.h +++ b/lib/Interface_Icons_NDimensions/interfNewContourMenu.h @@ -41,6 +41,10 @@ private: ** This method is in charge of capturing the event when the button is clicked **/ void onCreateContourCircle( wxCommandEvent& event ); + /** + ** This method is in charge of capturing the event when the button is clicked + **/ + void onCreateContourLine( wxCommandEvent& event ); }; #endif diff --git a/lib/Interface_Icons_NDimensions/interfToolsMenu.cxx b/lib/Interface_Icons_NDimensions/interfToolsMenu.cxx index 48c4d9f..5467db7 100644 --- a/lib/Interface_Icons_NDimensions/interfToolsMenu.cxx +++ b/lib/Interface_Icons_NDimensions/interfToolsMenu.cxx @@ -43,6 +43,10 @@ void interfToolsMenu::initButtons(wxEvtHandler* evtHandler) { nom.push_back("Show help page with information about the tools"); funct.push_back((wxObjectEventFunction) &interfToolsMenu:: onHelpPressed); + path.push_back(datadir + "/Mirror.png"); + nom.push_back("Create an Axis and select a contour to mirror it accordingly"); + funct.push_back((wxObjectEventFunction) &interfToolsMenu:: onMirrorPressed); + this->addButtons(path, nom); this->setVectorFunction(funct); @@ -89,6 +93,14 @@ void interfToolsMenu::onConfigurationPressed(wxCommandEvent& event){ } void interfToolsMenu::onHelpPressed(wxCommandEvent& event){ + wxLaunchDefaultBrowser(_T("http://www.creatis.insa-lyon.fr/creatools/node/25"), 0); + +} + +void interfToolsMenu::onMirrorPressed(wxCommandEvent& event){ + + interfMainPanel::getInstance()->onMirrorPressed(); + } diff --git a/lib/Interface_Icons_NDimensions/interfToolsMenu.h b/lib/Interface_Icons_NDimensions/interfToolsMenu.h index 86a51ba..6bf63a9 100644 --- a/lib/Interface_Icons_NDimensions/interfToolsMenu.h +++ b/lib/Interface_Icons_NDimensions/interfToolsMenu.h @@ -32,6 +32,8 @@ public: void onHelpPressed(wxCommandEvent& event); + void onMirrorPressed(wxCommandEvent& event); + private: //wxContourEventHandler* contourevent; diff --git a/lib/Interface_Icons_NDimensions/interfToolsPanels.cxx b/lib/Interface_Icons_NDimensions/interfToolsPanels.cxx index 32d1173..5aa8b3f 100644 --- a/lib/Interface_Icons_NDimensions/interfToolsPanels.cxx +++ b/lib/Interface_Icons_NDimensions/interfToolsPanels.cxx @@ -392,4 +392,37 @@ void interfInformationPanel::setColLabel(int tmpIntB,wxString tmpTitleString){ wxString interfInformationPanel::getCellValue(int j,int i){ return _grid->GetCellValue( j , i ); -} \ No newline at end of file +} + + + +/** +** Begin of the mirror panel +**/ + +interfMirrorPanel::interfMirrorPanel(wxWindow* parent) +: wxPanel(parent, -1, wxDefaultPosition, wxDefaultSize, wxBORDER_SUNKEN) +{ + wxButton *mirrorGoBtn = new wxButton(this,-1,_T("Go"), wxDefaultPosition, wxSize(200,35) ); + _thickness = new wxSlider(this, -1, 0 , 0, 10, wxDefaultPosition, wxSize(200,35), wxSL_HORIZONTAL|wxSL_LABELS, wxDefaultValidator); + + Connect( mirrorGoBtn->GetId(), wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &interfMirrorPanel::onMirrorGo ); + + wxFlexGridSizer * sizer = new wxFlexGridSizer(1); + 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(){ +} + +void interfMirrorPanel::onMirrorGo(wxCommandEvent& event) +{ + //wxString thick=_thickness->GetValue(); + interfMainPanel::getInstance()->onMirror(); +} diff --git a/lib/Interface_Icons_NDimensions/interfToolsPanels.h b/lib/Interface_Icons_NDimensions/interfToolsPanels.h index be7de00..8d8b128 100644 --- a/lib/Interface_Icons_NDimensions/interfToolsPanels.h +++ b/lib/Interface_Icons_NDimensions/interfToolsPanels.h @@ -83,6 +83,20 @@ private: +}; + +class interfMirrorPanel + : public wxPanel +{ +public: + interfMirrorPanel(wxWindow * parent); + ~interfMirrorPanel(); + +private: + + wxSlider* _thickness; + + void onMirrorGo(wxCommandEvent& event); }; #endif diff --git a/lib/Interface_ManagerContour_NDimensions/wxContourMainFrame.cxx b/lib/Interface_ManagerContour_NDimensions/wxContourMainFrame.cxx index bbee55d..42ba17c 100644 --- a/lib/Interface_ManagerContour_NDimensions/wxContourMainFrame.cxx +++ b/lib/Interface_ManagerContour_NDimensions/wxContourMainFrame.cxx @@ -314,6 +314,14 @@ void wxContourMainFrame::onCreateContourCircle( ){ //JCP 20-10-08 Undo redo implementation createContour( 3 ); } + +void wxContourMainFrame::onCreateContourLine( ){ + //JCP 20-10-08 Undo redo implementation + saveState(); + //JCP 20-10-08 Undo redo implementation + createContour( 6 ); +} + //------------------------------------------------------------------------------------------------------------ void wxContourMainFrame :: onCreateContourBullEye(wxPanel* panel ) @@ -637,6 +645,7 @@ void wxContourMainFrame::onCopy(){ _performingOperation->setStartOperationInstantVector( tempVector ); _performingOperation->setKeyNamesOperationElems( currentSelection ); } + void wxContourMainFrame::onPaste(){ @@ -864,6 +873,7 @@ void wxContourMainFrame::onSegmentationOneSlice(int isovalue,int sampling,int me RefreshInterface(); } + void wxContourMainFrame::SegmentationOneSlice( int x, int y, int z, int isovalue, int sampling, int method ) { int typeofcontour = 1; @@ -1067,6 +1077,37 @@ void wxContourMainFrame::onSegmentationAllSlice(int minZ,int maxZ,int isovalue,i RefreshInterface(); } +void wxContourMainFrame::onMirror() +{ + //AD:02-09 + std::vector currentSelection = _theViewPanel->getSelectedObjects(); + + std::vector tempVector; + _instantPanel->getInstant( tempVector ); + _performingOperation->reset(); + _performingOperation->setStartCommand( COPY ); + _performingOperation->setStartOperationInstantVector( tempVector ); + _performingOperation->setKeyNamesOperationElems( currentSelection ); + + //AD:02-09 + char theStartCommand = _performingOperation->getStartCommand(); + if ( theStartCommand == COPY ) + { + //JCP 20-10-08 Undo redo implementation + saveState(); + //JCP 20-10-08 Undo redo implementation + std::vector tempVector; + _instantPanel->getInstant( tempVector ); + _performingOperation->setEndOperationInstantVector ( tempVector ); + std::vector elems = _performingOperation->getKeyNamesOperationElems(); + int i,size = elems.size(); + for( i=0; i0 ); + } + } +} + void wxContourMainFrame::showAxis(bool show){ _theViewPanel->SetVisibleAxis(show); _theViewPanel->Refresh(); diff --git a/lib/Interface_ManagerContour_NDimensions/wxContourMainFrame.h b/lib/Interface_ManagerContour_NDimensions/wxContourMainFrame.h index fb5477a..9a38a68 100644 --- a/lib/Interface_ManagerContour_NDimensions/wxContourMainFrame.h +++ b/lib/Interface_ManagerContour_NDimensions/wxContourMainFrame.h @@ -169,6 +169,7 @@ class wxContourMainFrame : public wxPanel { void onCreateContourSpline( ); void onCreateContourRectangle( ); void onCreateContourCircle( ); + void onCreateContourLine( ); void onCreateContourBullEye(wxPanel* pan); ///////////////////////////////// void onDeleteContour(); @@ -214,12 +215,16 @@ class wxContourMainFrame : public wxPanel { void SegmentationOneSlice( int x, int y, int z, int isovalue, int sampling, int method ); + void Mirror( int x, int y, int z, int isovalue, int sampling, int method ); + int GetImageDataSizeZ(); void GetImageDataRange(double *range); void onSegmentationAllSlice(int minZ,int maxZ,int isovalue,int sampling,int method); + void onMirror(); + void showAxis(bool show); void onRigidPressed(); diff --git a/lib/Interface_ManagerContour_NDimensions/wxVtkBaseView_SceneManager.cxx b/lib/Interface_ManagerContour_NDimensions/wxVtkBaseView_SceneManager.cxx index 3d65b28..635dcd3 100644 --- a/lib/Interface_ManagerContour_NDimensions/wxVtkBaseView_SceneManager.cxx +++ b/lib/Interface_ManagerContour_NDimensions/wxVtkBaseView_SceneManager.cxx @@ -165,6 +165,12 @@ DEFINE_EVENT_TYPE( wxEVT_CHANGED_DEEP ) manViewerContour = new manualViewBullEye(); } + if (typeContour==6) + { + manContourControl = new manualLineControler(); + manViewerContour = new manualViewLine(); + } + //EED Borrame //FILE *ff = fopen("c:/temp/wxVtkBaseView_SceneManagerStadistics.txt","a+"); diff --git a/lib/kernel_ManagerContour_NDimensions/KernelManagerContour.cxx b/lib/kernel_ManagerContour_NDimensions/KernelManagerContour.cxx index 873f710..2070e44 100644 --- a/lib/kernel_ManagerContour_NDimensions/KernelManagerContour.cxx +++ b/lib/kernel_ManagerContour_NDimensions/KernelManagerContour.cxx @@ -383,6 +383,12 @@ manualContourModel * KernelManagerContour::factoryManualContourModel(int typeCon manModelContour = new manualContourModelCircle(); } + // line + if (typeContour==6) + { + manModelContour = new manualContourModelLine(); + } + return manModelContour; }