]> Creatis software - creaContours.git/commitdiff
#3327 creaContours Feature New Normal - Jump Slice
authorEduardo DAVILA <davila@ei-ed-606.creatis.insa-lyon.fr>
Fri, 13 Dec 2019 15:18:08 +0000 (16:18 +0100)
committerEduardo DAVILA <davila@ei-ed-606.creatis.insa-lyon.fr>
Fri, 13 Dec 2019 15:18:08 +0000 (16:18 +0100)
lib/Interface_Icons_NDimensions/interfMainPanel.cxx
lib/Interface_Icons_NDimensions/interfMainPanel.h
lib/Interface_Icons_NDimensions/interfToolsPanels.cxx
lib/Interface_Icons_NDimensions/interfToolsPanels.h
lib/Interface_ManagerContour_NDimensions/wxContourMainFrame.cxx
lib/Interface_ManagerContour_NDimensions/wxContourMainFrame.h
lib/Interface_ManagerContour_NDimensions/wxContourViewPanel.cxx
lib/Interface_ManagerContour_NDimensions/wxInstantChooserPanel.h
lib/Interface_ManagerContour_NDimensions/wxVtkBaseView_SceneManager.h

index bb87ee6803714f04120e848199ac0be3b9d05f49..51196954b6e3b6c8abf9c1fbfe0e1cbfd30c7bbb 100644 (file)
@@ -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);
index d6a40a97c5f2846f293c01a1971da8e6228c83c4..8ac450a520c5732e5027a1ad7f854f4e27cb0120 100644 (file)
@@ -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();
index ea290acd2a6812d31c141fbbb5a1acd943c4c76f..caad0115465dcfb2010f17b6e4dfc1dfc985b7d7 100644 (file)
@@ -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
index 5ea04f21420b90034e7b88f912b0f28008e5d077..0d125bd123304bae7c22846712eabb17444f9ca6 100644 (file)
@@ -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
index 0e7bff41f9cd3939a1ef3ab49906833ce1c6ac99..33db75f8652b799e2e366ebc8186d9058709bb5e 100644 (file)
@@ -2415,6 +2415,22 @@ void wxContourMainFrame::onBeforeAfterContour(bool before,bool after)
        RefreshInterface();
 }
 
+void wxContourMainFrame::onJumpSlice(int step, int shift)
+{
+       std::vector<int> 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) && (pos<maxZ)) 
+       {
+               tempVector[1]=pos;
+               _instantPanel->setInstant( tempVector );
+               RefreshInterface();
+       } // if pos     
+}
+
 void wxContourMainFrame::onShowTextContour(bool show)
 {
        _theViewPanel->onShowTextContour(show);
index b83691aacfd59b9c61653a522378d86668c8fd60..b633d14adece6b565f7344e903d5cc319efdd3f7 100644 (file)
@@ -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);
 
 //------------------------------------------------------------------------------------------------------------
index 059d7cecd1edce39c9fecbaa7da8c5cfab3d6125..85952db7722110586daf1ed22d76099a95e6f558 100644 (file)
@@ -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<std::string> wxContourViewPanel::getSelectedObjects()
index 1f930e7d8884d3297a4e7711fd0a911d040f9c29..4deb5c15b867570544a276b78a6d9aa7044ac4cf 100644 (file)
@@ -119,37 +119,21 @@ class wxInstantChooserPanel : public wxPanel {
        //------------------------------------------------------------------------------------------------------------
        
        void setInstant(std::vector<int> choiceInstant);
-       
        void setInstant(std::map<std::string,int>* _actualInstant );
-
        void getInstant(std::vector<int> & choiceInstant);
-
        void getInstantData(std::map<std::string,int> & choiceInstantData);
-
        std::map<std::string,int>* 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<std::string> conceptNameVect,std::vector<int> 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<wxConceptControl *> * _concepts;
-
-       wxConceptControl * _lastConceptUpdated;
-
-       wxSlider * _resolutionSlider;
-
-       wxFlexGridSizer * _outSizer;
-
-       bool _orientation;
-
-       bool _resolutionOverALL;
-       
-       std::map<std::string,int>* _actualInstant;
-
-       std::vector<int> _verticalMaxSelected;
-       
-       wxEvtHandler * _eventHandler;
-
-       std::string _configuration;
+       std::vector<wxConceptControl *> *_concepts;
+       wxConceptControl                                *_lastConceptUpdated;
+       wxSlider                                                *_resolutionSlider;
+       wxFlexGridSizer                                 *_outSizer;
+       bool                                                    _orientation;
+       bool                                                    _resolutionOverALL;
+       std::map<std::string,int>               *_actualInstant;
+       std::vector<int>                                _verticalMaxSelected;
+       wxEvtHandler                                    *_eventHandler;
+       std::string                                     _configuration;
     
-
        //DECLARE_CLASS(wxInstantChooserPanel)
        // any class wishing to process wxWindows events must use this macro
        //DECLARE_EVENT_TABLE()
-
 };
-
 #endif 
index 219962f5b46efadd640e7c08a87f6fe608875576..c1591b911d49dfbe94529f4385bccbd2dd78fad9 100644 (file)
@@ -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: