]> Creatis software - creaMaracasVisu.git/commitdiff
#3017 creaMaracasVisu Feature New Normal - ColorLayer Box, Transparency option...
authorEduardo DAVILA <eduardo.davila@creatis.insa-lyon.fr>
Sun, 18 Sep 2016 19:48:20 +0000 (21:48 +0200)
committerEduardo DAVILA <eduardo.davila@creatis.insa-lyon.fr>
Sun, 18 Sep 2016 19:48:20 +0000 (21:48 +0200)
bbtk/src/bbcreaMaracasVisuColorLayerImageView.cxx
bbtk/src/bbcreaMaracasVisuColorLayerImageView.h
lib/maracasVisuLib/src/interface/wxWindows/widgets/ThresholdImageView/ColorLayerImageView.cxx
lib/maracasVisuLib/src/interface/wxWindows/widgets/ThresholdImageView/ColorLayerImageViewPanel.cxx
lib/maracasVisuLib/src/interface/wxWindows/widgets/ThresholdImageView/ColorLayerImageViewPanel.h
lib/maracasVisuLib/src/interface/wxWindows/widgets/ThresholdImageView/LayerImageBase.cxx
lib/maracasVisuLib/src/interface/wxWindows/widgets/ThresholdImageView/LayerImageBase.h
lib/maracasVisuLib/src/interface/wxWindows/widgets/vtkInteractorScrollZ.cxx

index 81391bf0baadec91bfca4ac8771a0ec40e7601fe..9b1d4386a2c4bcbfb94d66cc629f412d25d88aea 100644 (file)
@@ -95,7 +95,7 @@ void ColorLayerImageView::Process()
 //=====
 void ColorLayerImageView::CreateWidget(wxWindow* parent)
 {
-  ColorLayerImageViewPanel *clivp = new ColorLayerImageViewPanel(parent, 0, 100, bbGetInputTypeControlsInterface() );
+  ColorLayerImageViewPanel *clivp = new ColorLayerImageViewPanel(parent, 0, 100, bbGetInputOpacity() ,bbGetInputTypeControlsInterface() );
   bbSetOutputWidget( clivp );
 }
 //=====
@@ -106,6 +106,7 @@ void ColorLayerImageView::bbUserSetDefaultValues()
     firsttime=true;
     bbSetInputIn(NULL);
     bbSetInputActive(true);
+    bbSetInputOpacity(100);
     bbSetInputPlainOrGradientColor(false);
     bbSetInputTypeControlsInterface(1);
     bbSetInputWxVtkBaseView(NULL);
index 6527f70705a22cd831021ded3846a48786ded32c..7abb52f075c90123308407dd79087ace627f6bb2 100644 (file)
@@ -47,6 +47,7 @@ class bbcreaMaracasVisu_EXPORT ColorLayerImageView
 //=====
   BBTK_DECLARE_INPUT(In,vtkImageData*);
   BBTK_DECLARE_INPUT(Active,bool);
+  BBTK_DECLARE_INPUT(Opacity,int);
   BBTK_DECLARE_INPUT(TypeControlsInterface,int);
   BBTK_DECLARE_INPUT(WxVtkBaseView,wxVtkBaseView *);
   BBTK_DECLARE_INPUT(WxVtkBaseView1,wxVtkBaseView *);
@@ -78,6 +79,7 @@ BBTK_BEGIN_DESCRIBE_BLACK_BOX(ColorLayerImageView,bbtk::WxBlackBox);
   BBTK_CATEGORY("__CategoryBlackBox__");
   BBTK_INPUT(ColorLayerImageView,In,"Input Image",vtkImageData*,"");
   BBTK_INPUT(ColorLayerImageView,Active,"Active True/False (default True)",bool,"");
+  BBTK_INPUT(ColorLayerImageView,Opacity,"(default 100) 0..100",int,"");
   BBTK_INPUT(ColorLayerImageView,TypeControlsInterface,"1 (default) All controls, 2 just transparency",int,"");
   BBTK_INPUT(ColorLayerImageView,WxVtkBaseView," 0 creaMaracasVisuViewer viewer XY,YZ ou XZ",wxVtkBaseView*,"");
   BBTK_INPUT(ColorLayerImageView,WxVtkBaseView1," 1 creaMaracasVisuViewer viewer XY,YZ ou XZ",wxVtkBaseView*,"");
index 6dd7ca540679618fa59f0210c130410d64153239..dadf2caecba1fdbf9b4506a0f9e70e51c465e7a0 100644 (file)
@@ -318,8 +318,6 @@ void ColorLayerImageView::ConfigLookupTable()  // virtual
        {
                SetDefaultBaseColorAndGreyLevelBoundary();
        } else {  // If at least one color has been set, set the grey level boundaries to build an equipartition of the image grey levels, keeping the base colors defined.
-               printf("EED ColorLayerImageView::ConfigLookupTable() %d  %d\n",  GetBaseColorNb() , _grey_level_boundary.size()  );
-
 
                if (_color_type==true)  // Plain
                {
index ff0f0531493e72e61115a0f300fa40ccce1cb7d0..586ea0db2a72b67589c1392400c44a0fb0d4eab9 100644 (file)
@@ -122,7 +122,7 @@ printf("EED wxDlgTransformByDimensionBySpacingByPixel::GetTransformType BBB %d\n
 /**
  ** Begin of the threshold panel
  **/
-ColorLayerImageViewPanel::ColorLayerImageViewPanel(wxWindow* parent, int min, int max, int type)
+ColorLayerImageViewPanel::ColorLayerImageViewPanel(wxWindow* parent, int min, int max,int opacity, int type)
 //: wxPanel(parent, -1, wxDefaultPosition, wxSize(600,100), wxBORDER_SUNKEN)
 
 : wxPanel(parent, -1, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL)
@@ -163,7 +163,7 @@ ColorLayerImageViewPanel::ColorLayerImageViewPanel(wxWindow* parent, int min, in
                _sl_SliceImageZ->Enable(false);
                _interpolationCheckBox = new wxCheckBox(this, -1, _T("Interpole") );
                _interpolationCheckBox->SetValue(true);
-               _opacity = new wxSlider(this, wxID_ANY, 1, 0, 100, wxDefaultPosition, wxDefaultSize, wxSL_HORIZONTAL|wxSL_LABELS, wxDefaultValidator);
+               _opacity = new wxSlider(this, wxID_ANY, opacity, 0, 100, wxDefaultPosition, wxDefaultSize, wxSL_HORIZONTAL|wxSL_LABELS, wxDefaultValidator);
 
        //      _histogram                                      = new Histogram(  this , -1, wxPoint(0,0), wxSize(400,400), /*wxNO_BORDER*/ wxBORDER_DEFAULT ); 
        //      _histogramMinMaxLevel   = new HistogramMinMaxLevel( (HistogramBase*)_histogram );
@@ -218,7 +218,7 @@ ColorLayerImageViewPanel::ColorLayerImageViewPanel(wxWindow* parent, int min, in
                sizer                                                   = new wxFlexGridSizer(2);
                _interpolationCheckBox = new wxCheckBox(this, -1, _T("Interpolate") );
                _interpolationCheckBox->SetValue(true);
-               _opacity = new wxSlider(this, wxID_ANY, 1, 0, 100, wxDefaultPosition, wxSize(2,40), wxSL_HORIZONTAL|wxSL_LABELS, wxDefaultValidator);
+               _opacity = new wxSlider(this, wxID_ANY, opacity, 0, 100, wxDefaultPosition, wxSize(2,40), wxSL_HORIZONTAL|wxSL_LABELS, wxDefaultValidator);
 
                Connect( _interpolationCheckBox->GetId(), wxEVT_COMMAND_CHECKBOX_CLICKED, (wxObjectEventFunction) &ColorLayerImageViewPanel::onThresholdInterpolation );
                Connect( _opacity->GetId(), wxEVT_SCROLL_THUMBTRACK, (wxObjectEventFunction) &ColorLayerImageViewPanel::onChangeOpacity );
index 4982e11e9559ddf91e6ae57e135e39b97fd466e4..00b7f4c50f33fad286e5021471ef8f8174b3c691 100644 (file)
@@ -72,7 +72,7 @@ class ColorLayerImageViewPanel
                : public wxPanel
                {
                public:
-                       ColorLayerImageViewPanel(wxWindow * parent, int min, int max, int type);
+                       ColorLayerImageViewPanel(wxWindow * parent, int min, int max,int opacity, int type);
                        ~ColorLayerImageViewPanel();
                        void onThresholdStop();
                        ColorLayerImageViewManager* GetColorLayerImageViewManager();
index 6f3762475dc2af6b361714d32f42af060db51341..f625d57174f484f40986fe6e4afc9f8692e238f4 100644 (file)
@@ -450,7 +450,7 @@ void LayerImageBase::onThreshold()
                                        _scalarbarActor->SetDisplayPosition(0,0);
                                }
 
-                               _thresholdActor->SetOpacity( 0 );
+                               _thresholdActor->SetOpacity( 1 );
                                _thresholdActor->InterpolateOn(  );
                                
                                if (directionViewer==0)
index 5e8dcac9a9df2912ba3979206d1e1d1c3c2e3f6b..3d27d31b71145cda4a3316a17861719214340247 100644 (file)
@@ -95,7 +95,6 @@ class LayerImageBase
                void                    SetColorBarPosition(std::vector<int> &colorbarposition);
                void                    SetwxVtkBaseView(wxVtkBaseView *baseview);
 
-
                void onThreshold();
                void onThresholdChange();
                void onThresholdInterpolation(bool interpolate);
@@ -121,7 +120,6 @@ class LayerImageBase
                void GetSpcOriginalLayer(double *spc);
                void GetSpcBase(double *spc);
 
-
   private:
                int                                                     _X;
                int                                                     _Y;
@@ -133,8 +131,6 @@ class LayerImageBase
                int                                             _dimBase[3];
                double                                          _spcBase[3];
 
-               
-
                vtkImageData                            *_image;
                vtkImageChangeInformation       *_imageChangeInformation;
                vtkImageReslice                         *_imageReslicer;
@@ -142,19 +138,15 @@ class LayerImageBase
                vtkImageMapToColors                     *_thresholdMapper;
                vtkImageActor                           *_thresholdActor;
                wxVtkBaseView                           *_baseView;
-
                vtkScalarBarActor                       *_scalarbarActor;
-
                virtual void                            ConfigLookupTable() = 0;                
                void                                            CleanXYZ(double &x, double &y, double &z);
 
-
   protected:
                vtkLookupTable                          *GetThresholdTable();
                double                                          _range[2];
                std::vector<double>             _rangeForColorBar;
                std::vector<int>                        _colorBarPosition;
-
  };
 
 
index 49248fb467dfd54362293f59933412d7fbaede94..f01b79bb99e6bcae48a2ace8ad3d93332528e7d0 100644 (file)
@@ -69,7 +69,7 @@ bool vtkInteractorScrollZ::OnMouseMove ()
        if (_stateFordware==true){
            //int fx = _vtkInteractorStyleBaseView->GetInteractor()->GetEventPosition()[0];  // JPRx
         int fy      = _vtkInteractorStyleBaseView->GetInteractor()->GetEventPosition()[1];
-               double delta   = (_fordwareY - fy)/3.0;
+               double delta   = (_fordwareY - fy)/(3.0*3);
                /*JCP 14/05/2009
                _vtkInteractorStyleBaseView->GetWxVtk2DBaseView()->SetActualSlice( _sliceZ + delta);
                */