From 78a76d83140ed2adf38b8906f5d9fbfde1186c9a Mon Sep 17 00:00:00 2001 From: Eduardo DAVILA Date: Sun, 18 Sep 2016 21:48:20 +0200 Subject: [PATCH] #3017 creaMaracasVisu Feature New Normal - ColorLayer Box, Transparency option configuration. --- bbtk/src/bbcreaMaracasVisuColorLayerImageView.cxx | 3 ++- bbtk/src/bbcreaMaracasVisuColorLayerImageView.h | 2 ++ .../widgets/ThresholdImageView/ColorLayerImageView.cxx | 2 -- .../ThresholdImageView/ColorLayerImageViewPanel.cxx | 6 +++--- .../widgets/ThresholdImageView/ColorLayerImageViewPanel.h | 2 +- .../widgets/ThresholdImageView/LayerImageBase.cxx | 2 +- .../wxWindows/widgets/ThresholdImageView/LayerImageBase.h | 8 -------- .../interface/wxWindows/widgets/vtkInteractorScrollZ.cxx | 2 +- 8 files changed, 10 insertions(+), 17 deletions(-) diff --git a/bbtk/src/bbcreaMaracasVisuColorLayerImageView.cxx b/bbtk/src/bbcreaMaracasVisuColorLayerImageView.cxx index 81391bf..9b1d438 100644 --- a/bbtk/src/bbcreaMaracasVisuColorLayerImageView.cxx +++ b/bbtk/src/bbcreaMaracasVisuColorLayerImageView.cxx @@ -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); diff --git a/bbtk/src/bbcreaMaracasVisuColorLayerImageView.h b/bbtk/src/bbcreaMaracasVisuColorLayerImageView.h index 6527f70..7abb52f 100644 --- a/bbtk/src/bbcreaMaracasVisuColorLayerImageView.h +++ b/bbtk/src/bbcreaMaracasVisuColorLayerImageView.h @@ -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*,""); diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/ThresholdImageView/ColorLayerImageView.cxx b/lib/maracasVisuLib/src/interface/wxWindows/widgets/ThresholdImageView/ColorLayerImageView.cxx index 6dd7ca5..dadf2ca 100644 --- a/lib/maracasVisuLib/src/interface/wxWindows/widgets/ThresholdImageView/ColorLayerImageView.cxx +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/ThresholdImageView/ColorLayerImageView.cxx @@ -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 { diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/ThresholdImageView/ColorLayerImageViewPanel.cxx b/lib/maracasVisuLib/src/interface/wxWindows/widgets/ThresholdImageView/ColorLayerImageViewPanel.cxx index ff0f053..586ea0d 100644 --- a/lib/maracasVisuLib/src/interface/wxWindows/widgets/ThresholdImageView/ColorLayerImageViewPanel.cxx +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/ThresholdImageView/ColorLayerImageViewPanel.cxx @@ -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 ); diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/ThresholdImageView/ColorLayerImageViewPanel.h b/lib/maracasVisuLib/src/interface/wxWindows/widgets/ThresholdImageView/ColorLayerImageViewPanel.h index 4982e11..00b7f4c 100644 --- a/lib/maracasVisuLib/src/interface/wxWindows/widgets/ThresholdImageView/ColorLayerImageViewPanel.h +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/ThresholdImageView/ColorLayerImageViewPanel.h @@ -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(); diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/ThresholdImageView/LayerImageBase.cxx b/lib/maracasVisuLib/src/interface/wxWindows/widgets/ThresholdImageView/LayerImageBase.cxx index 6f37624..f625d57 100644 --- a/lib/maracasVisuLib/src/interface/wxWindows/widgets/ThresholdImageView/LayerImageBase.cxx +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/ThresholdImageView/LayerImageBase.cxx @@ -450,7 +450,7 @@ void LayerImageBase::onThreshold() _scalarbarActor->SetDisplayPosition(0,0); } - _thresholdActor->SetOpacity( 0 ); + _thresholdActor->SetOpacity( 1 ); _thresholdActor->InterpolateOn( ); if (directionViewer==0) diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/ThresholdImageView/LayerImageBase.h b/lib/maracasVisuLib/src/interface/wxWindows/widgets/ThresholdImageView/LayerImageBase.h index 5e8dcac..3d27d31 100644 --- a/lib/maracasVisuLib/src/interface/wxWindows/widgets/ThresholdImageView/LayerImageBase.h +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/ThresholdImageView/LayerImageBase.h @@ -95,7 +95,6 @@ class LayerImageBase void SetColorBarPosition(std::vector &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 _rangeForColorBar; std::vector _colorBarPosition; - }; diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/vtkInteractorScrollZ.cxx b/lib/maracasVisuLib/src/interface/wxWindows/widgets/vtkInteractorScrollZ.cxx index 49248fb..f01b79b 100644 --- a/lib/maracasVisuLib/src/interface/wxWindows/widgets/vtkInteractorScrollZ.cxx +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/vtkInteractorScrollZ.cxx @@ -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); */ -- 2.47.1