From 6afda9ffe8fc5ee4fd7d6fa2ae006a0c78b5b1d8 Mon Sep 17 00:00:00 2001 From: Eduardo DAVILA Date: Fri, 13 Dec 2019 16:18:08 +0100 Subject: [PATCH] #3327 creaContours Feature New Normal - Jump Slice --- .../interfMainPanel.cxx | 5 ++ .../interfMainPanel.h | 1 + .../interfToolsPanels.cxx | 48 ++++++++++++++---- .../interfToolsPanels.h | 4 ++ .../wxContourMainFrame.cxx | 16 ++++++ .../wxContourMainFrame.h | 2 +- .../wxContourViewPanel.cxx | 3 -- .../wxInstantChooserPanel.h | 50 ++++--------------- .../wxVtkBaseView_SceneManager.h | 2 - 9 files changed, 75 insertions(+), 56 deletions(-) diff --git a/lib/Interface_Icons_NDimensions/interfMainPanel.cxx b/lib/Interface_Icons_NDimensions/interfMainPanel.cxx index bb87ee6..5119695 100644 --- a/lib/Interface_Icons_NDimensions/interfMainPanel.cxx +++ b/lib/Interface_Icons_NDimensions/interfMainPanel.cxx @@ -600,6 +600,11 @@ void interfMainPanel::onBeforAfterContour(bool before, bool after) wxContourMainFrame::getInstance()->onBeforeAfterContour(before,after); } +void interfMainPanel::onJumpSlice(int step, int shift) +{ + wxContourMainFrame::getInstance()->onJumpSlice(step,shift); +} + void interfMainPanel::onShowTextContour(bool show) { wxContourMainFrame::getInstance()->onShowTextContour(show); diff --git a/lib/Interface_Icons_NDimensions/interfMainPanel.h b/lib/Interface_Icons_NDimensions/interfMainPanel.h index d6a40a9..8ac450a 100644 --- a/lib/Interface_Icons_NDimensions/interfMainPanel.h +++ b/lib/Interface_Icons_NDimensions/interfMainPanel.h @@ -171,6 +171,7 @@ public: void onInterpolation(bool interpolate); void onShowTextContour(bool show); void onBeforAfterContour(bool before, bool after); + void onJumpSlice(int step,int shift); void onSpreadPressed(); void onConfigurationPressed(); void resetAppend(); diff --git a/lib/Interface_Icons_NDimensions/interfToolsPanels.cxx b/lib/Interface_Icons_NDimensions/interfToolsPanels.cxx index ea290ac..caad011 100644 --- a/lib/Interface_Icons_NDimensions/interfToolsPanels.cxx +++ b/lib/Interface_Icons_NDimensions/interfToolsPanels.cxx @@ -51,19 +51,24 @@ interfConfigurationPanel::interfConfigurationPanel(wxWindow * parent) _brithtnessWindowLevel = new wxSlider(this, -1, windowlevel , min, max, wxDefaultPosition, wxDefaultSize, wxSL_HORIZONTAL|wxSL_LABELS, wxDefaultValidator); _brithtnessColorLevel = new wxSlider(this, -1, colorwindow , min, max, wxDefaultPosition, wxDefaultSize, wxSL_HORIZONTAL|wxSL_LABELS, wxDefaultValidator); - _interpolationCheckBox = new wxCheckBox(this, -1, _T("Image Interpolation") ); + _interpolationCheckBox = new wxCheckBox(this, -1, _T("Interpolation") ); _interpolationCheckBox->SetValue(true); - _showTextContourCheckBox = new wxCheckBox(this, -1, _T("Labels Contours") ); + _showTextContourCheckBox = new wxCheckBox(this, -1, _T("Labels") ); _showTextContourCheckBox->SetValue(true); - _beforContourCheckBox = new wxCheckBox(this, -1, _T("Befor Contour") ); _beforContourCheckBox->SetValue(false); _afterContourCheckBox = new wxCheckBox(this, -1, _T("After Contour") ); _afterContourCheckBox->SetValue(false); + wxButton *jumpBackwareSlice = new wxButton(this,-1,_T("/\\"),wxDefaultPosition, wxDefaultSize); + wxButton *jumpFordwareSlice = new wxButton(this,-1,_T("\\/"),wxDefaultPosition, wxDefaultSize); + _jumpSpinCtrl = new wxSpinCtrl(this,-1,wxString("10") ); + _jumpSpinCtrl->SetRange(1,100); + _shiftSpinCtrl = new wxSpinCtrl(this,-1,wxString("0") ); + _shiftSpinCtrl->SetRange(0,99); Connect( _withOfContourLine->GetId(), wxEVT_SCROLL_CHANGED, (wxObjectEventFunction) &interfConfigurationPanel::onWidthOfContour); Connect( _withOfContourLine->GetId(), wxEVT_SCROLL_THUMBTRACK, (wxObjectEventFunction) &interfConfigurationPanel::onWidthOfContour); @@ -76,27 +81,40 @@ interfConfigurationPanel::interfConfigurationPanel(wxWindow * parent) Connect( _showTextContourCheckBox->GetId(), wxEVT_COMMAND_CHECKBOX_CLICKED, (wxObjectEventFunction) &interfConfigurationPanel::OnShowTextContour); Connect( _beforContourCheckBox->GetId(), wxEVT_COMMAND_CHECKBOX_CLICKED, (wxObjectEventFunction) &interfConfigurationPanel::OnBeforAfterContour); Connect( _afterContourCheckBox->GetId(), wxEVT_COMMAND_CHECKBOX_CLICKED, (wxObjectEventFunction) &interfConfigurationPanel::OnBeforAfterContour); + Connect( jumpBackwareSlice->GetId(), wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &interfConfigurationPanel::OnBackwareSlice ); + Connect( jumpFordwareSlice->GetId(), wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &interfConfigurationPanel::OnFordwareSlice ); + wxFlexGridSizer * sizerA = new wxFlexGridSizer(1); sizerA -> Add( new wxStaticText(this,-1, _T("Contour width")) , 1, wxGROW ); sizerA -> Add( _withOfContourLine , 1, wxGROW ); sizerA -> Add( new wxStaticText(this,-1, _T(" ")) , 1, wxGROW ); sizerA -> Add( new wxStaticText(this,-1, _T("Window level")) , 1, wxGROW ); - sizerA -> Add( _brithtnessWindowLevel , 1, wxGROW ); + sizerA -> Add( _brithtnessWindowLevel , 1, wxGROW ); sizerA -> Add( new wxStaticText(this,-1, _T("Color level")) , 1, wxGROW ); - sizerA -> Add( _brithtnessColorLevel, 1, wxGROW ); + sizerA -> Add( _brithtnessColorLevel , 1, wxGROW ); sizerA -> Add( new wxStaticText(this,-1, _T(" ")) , 1, wxGROW ); + wxFlexGridSizer * sizerB1 = new wxFlexGridSizer(2); + sizerB1-> Add( jumpBackwareSlice , 1, wxGROW ); + sizerB1 -> Add( jumpFordwareSlice , 1, wxGROW ); + wxFlexGridSizer * sizerB = new wxFlexGridSizer(1); - sizerB -> Add( _interpolationCheckBox , 1, wxGROW ); + sizerB -> Add( _interpolationCheckBox , 1, wxGROW ); + sizerB -> Add( new wxStaticText(this ,-1, _T(" ")) , 1, wxGROW ); + sizerB -> Add( _showTextContourCheckBox , 1, wxGROW ); sizerB -> Add( new wxStaticText(this,-1, _T(" ")) , 1, wxGROW ); - sizerB -> Add( _showTextContourCheckBox , 1, wxGROW ); + sizerB -> Add( _beforContourCheckBox , 1, wxGROW ); + sizerB -> Add( _afterContourCheckBox , 1, wxGROW ); sizerB -> Add( new wxStaticText(this,-1, _T(" ")) , 1, wxGROW ); - sizerB -> Add( _beforContourCheckBox , 1, wxGROW ); - sizerB -> Add( _afterContourCheckBox , 1, wxGROW ); + sizerB -> Add( sizerB1 , 1, wxGROW ); + sizerB -> Add( _jumpSpinCtrl , 1, wxGROW ); + sizerB -> Add( _shiftSpinCtrl , 1, wxGROW ); + - wxFlexGridSizer * sizer = new wxFlexGridSizer(2); + wxFlexGridSizer * sizer = new wxFlexGridSizer(3); sizer -> Add( sizerA , 1, wxGROW ); + sizer -> Add( new wxStaticText(this,-1, _T(" ")) , 1, wxGROW ); sizer -> Add( sizerB , 1, wxGROW ); this->SetSizer( sizer ); @@ -140,6 +158,16 @@ void interfConfigurationPanel::OnShowTextContour(wxCommandEvent& event) interfMainPanel::getInstance()->onShowTextContour(_showTextContourCheckBox->GetValue() ); } +void interfConfigurationPanel::OnBackwareSlice(wxCommandEvent& event) +{ + interfMainPanel::getInstance()->onJumpSlice( -_jumpSpinCtrl->GetValue(), _shiftSpinCtrl->GetValue() ); +} + +void interfConfigurationPanel::OnFordwareSlice(wxCommandEvent& event) +{ + interfMainPanel::getInstance()->onJumpSlice( _jumpSpinCtrl->GetValue(), _shiftSpinCtrl->GetValue() ); +} + /** ** Begin of the spread panel diff --git a/lib/Interface_Icons_NDimensions/interfToolsPanels.h b/lib/Interface_Icons_NDimensions/interfToolsPanels.h index 5ea04f2..0d125bd 100644 --- a/lib/Interface_Icons_NDimensions/interfToolsPanels.h +++ b/lib/Interface_Icons_NDimensions/interfToolsPanels.h @@ -43,6 +43,8 @@ private: void OnInterpolation(wxCommandEvent& event); void OnShowTextContour(wxCommandEvent& event); void OnBeforAfterContour(wxCommandEvent& event); + void OnBackwareSlice(wxCommandEvent& event); + void OnFordwareSlice(wxCommandEvent& event); wxSlider* _withOfContourLine; wxSlider* _brithtnessWindowLevel; wxSlider* _brithtnessColorLevel; @@ -50,6 +52,8 @@ private: wxCheckBox* _showTextContourCheckBox; wxCheckBox* _beforContourCheckBox; wxCheckBox* _afterContourCheckBox; + wxSpinCtrl* _jumpSpinCtrl; + wxSpinCtrl* _shiftSpinCtrl; }; class interfSpreadPanel diff --git a/lib/Interface_ManagerContour_NDimensions/wxContourMainFrame.cxx b/lib/Interface_ManagerContour_NDimensions/wxContourMainFrame.cxx index 0e7bff4..33db75f 100644 --- a/lib/Interface_ManagerContour_NDimensions/wxContourMainFrame.cxx +++ b/lib/Interface_ManagerContour_NDimensions/wxContourMainFrame.cxx @@ -2415,6 +2415,22 @@ void wxContourMainFrame::onBeforeAfterContour(bool before,bool after) RefreshInterface(); } +void wxContourMainFrame::onJumpSlice(int step, int shift) +{ + std::vector tempVector; + _instantPanel->getInstant( tempVector ); + int ss = abs(step); + int pos = tempVector[1]; + int maxZ = interfMainPanel::getInstance()->GetImageDataSizeZ(); + pos=(pos/ss)*ss+step+shift; + if ((pos>=0) && (possetInstant( tempVector ); + RefreshInterface(); + } // if pos +} + void wxContourMainFrame::onShowTextContour(bool show) { _theViewPanel->onShowTextContour(show); diff --git a/lib/Interface_ManagerContour_NDimensions/wxContourMainFrame.h b/lib/Interface_ManagerContour_NDimensions/wxContourMainFrame.h index b83691a..b633d14 100644 --- a/lib/Interface_ManagerContour_NDimensions/wxContourMainFrame.h +++ b/lib/Interface_ManagerContour_NDimensions/wxContourMainFrame.h @@ -266,6 +266,7 @@ class wxContourMainFrame : public wxPanel { void onInterpolation(bool interpolate); void onShowTextContour(bool show); void onBeforeAfterContour(bool before, bool after); + void onJumpSlice(int step,int shift); void onChangeInstant(std::string name,int actual); void resetAppend(); void onSpreadAdd(); @@ -340,7 +341,6 @@ class wxContourMainFrame : public wxPanel { //------------------------------------------------------------------------------------------------------------ void SetScalarRange(int grayRangeMin, int grayRangeMax); - std::string GetStringTypeImage( vtkImageData* image); //------------------------------------------------------------------------------------------------------------ diff --git a/lib/Interface_ManagerContour_NDimensions/wxContourViewPanel.cxx b/lib/Interface_ManagerContour_NDimensions/wxContourViewPanel.cxx index 059d7ce..85952db 100644 --- a/lib/Interface_ManagerContour_NDimensions/wxContourViewPanel.cxx +++ b/lib/Interface_ManagerContour_NDimensions/wxContourViewPanel.cxx @@ -745,7 +745,6 @@ DEFINE_EVENT_TYPE( wxINSTANT_CHANGE ) } // for i } // if _before Contour -printf("EED wxContourViewPanel::addNameWrapperToScene A\n"); if (_showAfterContour==true) { size=0; @@ -769,8 +768,6 @@ printf("EED wxContourViewPanel::addNameWrapperToScene A\n"); _sceneManager->addToScene(lstNameAfter[i], true, true, false, false, false ); } // for i } // if _after Contour -printf("EED wxContourViewPanel::addNameWrapperToScene B\n"); - } std::vector wxContourViewPanel::getSelectedObjects() diff --git a/lib/Interface_ManagerContour_NDimensions/wxInstantChooserPanel.h b/lib/Interface_ManagerContour_NDimensions/wxInstantChooserPanel.h index 1f930e7..4deb5c1 100644 --- a/lib/Interface_ManagerContour_NDimensions/wxInstantChooserPanel.h +++ b/lib/Interface_ManagerContour_NDimensions/wxInstantChooserPanel.h @@ -119,37 +119,21 @@ class wxInstantChooserPanel : public wxPanel { //------------------------------------------------------------------------------------------------------------ void setInstant(std::vector choiceInstant); - void setInstant(std::map* _actualInstant ); - void getInstant(std::vector & choiceInstant); - void getInstantData(std::map & choiceInstantData); - std::map* getInstantData(); - void setResolutionRangeWithLasUpdate(); - void refreshConceptLabels(); - void setConfiguration(std::string aConfiguration); - std::string getConfiguration(); - void setResolutionOverAll( bool condition ); - bool getIfResolutionOverAll(); - void setConceptValue( std::string theConceptName, int theValue ); - int getConceptValue( std::string theConceptName ); - ConceptDataWrap * getConceptDataOf( std::string theConceptName ); - bool getIfConceptCheckedAt( std::string theConceptName, int atChecksPosition ); - void onChangeInstant( wxCommandEvent& event ); - void addConcepts(std::vector conceptNameVect,std::vector conceptSizeVect); private: @@ -157,40 +141,26 @@ class wxInstantChooserPanel : public wxPanel { // Private methods //------------------------------------------------------------------------------------------------------------ void initializeResolutionSlider(); - void changeResolutionAtConceptControl( wxConceptControl * theConceptToUpdate ); - void setVerticalMaxSelectedNums( std::string groupMaxVertNums ); //------------------------------------------------------------------------------------------------------------ // Attributtes //------------------------------------------------------------------------------------------------------------ - std::vector * _concepts; - - wxConceptControl * _lastConceptUpdated; - - wxSlider * _resolutionSlider; - - wxFlexGridSizer * _outSizer; - - bool _orientation; - - bool _resolutionOverALL; - - std::map* _actualInstant; - - std::vector _verticalMaxSelected; - - wxEvtHandler * _eventHandler; - - std::string _configuration; + std::vector *_concepts; + wxConceptControl *_lastConceptUpdated; + wxSlider *_resolutionSlider; + wxFlexGridSizer *_outSizer; + bool _orientation; + bool _resolutionOverALL; + std::map *_actualInstant; + std::vector _verticalMaxSelected; + wxEvtHandler *_eventHandler; + std::string _configuration; - //DECLARE_CLASS(wxInstantChooserPanel) // any class wishing to process wxWindows events must use this macro //DECLARE_EVENT_TABLE() - }; - #endif diff --git a/lib/Interface_ManagerContour_NDimensions/wxVtkBaseView_SceneManager.h b/lib/Interface_ManagerContour_NDimensions/wxVtkBaseView_SceneManager.h index 219962f..c1591b9 100644 --- a/lib/Interface_ManagerContour_NDimensions/wxVtkBaseView_SceneManager.h +++ b/lib/Interface_ManagerContour_NDimensions/wxVtkBaseView_SceneManager.h @@ -105,7 +105,6 @@ class wxVtkBaseView_SceneManager : public InteractorStyleMaracas { // Methods for capturing events //------------------------------------------------------------------------------------------------------------ - //------------------------------------------------------------------------------------------------------------ // Methods for sending events //------------------------------------------------------------------------------------------------------------ @@ -218,7 +217,6 @@ class wxVtkBaseView_SceneManager : public InteractorStyleMaracas { bool isCtrlPressed(); bool isShiftPressed(); char getLastKeyCode(); - void SetLabelNumberOfContours( std::string label ); private: -- 2.45.1