From: Eduardo DAVILA Date: Mon, 26 Apr 2021 07:01:52 +0000 (+0200) Subject: #3461 Feuture Export Opacity ColorLayerImageView X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=commitdiff_plain;h=06e2668b68de62c31f2f5f13ac79656cd2078acd;p=creaMaracasVisu.git #3461 Feuture Export Opacity ColorLayerImageView --- diff --git a/bbtk/src/bbcreaMaracasVisuColorLayerImageView.cxx b/bbtk/src/bbcreaMaracasVisuColorLayerImageView.cxx index 6681598..afd1af0 100644 --- a/bbtk/src/bbcreaMaracasVisuColorLayerImageView.cxx +++ b/bbtk/src/bbcreaMaracasVisuColorLayerImageView.cxx @@ -34,6 +34,42 @@ namespace bbcreaMaracasVisu { + +class ColorLayerImageView; + +class ColorLayerImageViewPanel_widgetBox : public ColorLayerImageViewPanel +{ + public: + ColorLayerImageViewPanel_widgetBox( wxWindow * parent, int min, int max,int opacity, int type ); + void SetBox(ColorLayerImageView* box); + void ChangeOpacity(); + private: + ColorLayerImageView *mBox; +}; + +ColorLayerImageViewPanel_widgetBox::ColorLayerImageViewPanel_widgetBox( wxWindow * parent, int min, int max,int opacity, int type ) + : ColorLayerImageViewPanel( parent, min, max, opacity, type ) +{ + mBox=NULL; +} + +void ColorLayerImageViewPanel_widgetBox::ChangeOpacity() +{ + ColorLayerImageViewPanel::ChangeOpacity(); + if (mBox!=NULL) + { + mBox->bbSetOutputOutOpacity( GetOpacity() ); + mBox->bbSignalOutputModification(); + } // if mBox +} + +void ColorLayerImageViewPanel_widgetBox::SetBox(ColorLayerImageView* box) +{ + mBox=box; +} + + + BBTK_ADD_BLACK_BOX_TO_PACKAGE(creaMaracasVisu,ColorLayerImageView) BBTK_BLACK_BOX_IMPLEMENTATION(ColorLayerImageView,bbtk::WxBlackBox); //===== @@ -41,7 +77,7 @@ BBTK_BLACK_BOX_IMPLEMENTATION(ColorLayerImageView,bbtk::WxBlackBox); //===== void ColorLayerImageView::Process() { - ColorLayerImageViewPanel *clivp = (ColorLayerImageViewPanel*)bbGetOutputWidget(); + ColorLayerImageViewPanel_widgetBox *clivp = (ColorLayerImageViewPanel_widgetBox*)bbGetOutputWidget(); if (firsttime==true) { // firsttime=false; @@ -65,19 +101,22 @@ void ColorLayerImageView::Process() clivp->SetImage( bbGetInputIn() ); bbSetOutputNewImage( clivp->GetColorLayerImageViewManager()->GetImageChangeInformation(0) ); bbSetOutputLookupTable( clivp->GetColorLayerImageViewManager()->GetLookupTable(0) ); - if (firsttime==true) - { + bbSetOutputOutOpacity( clivp->GetOpacity() ); + + if (firsttime==true) + { firsttime=false; clivp->ChangeOpacity(); - } + clivp->SetBox(this); + } } //===== // Don't edit this file. This file is generated from xml description.. //===== void ColorLayerImageView::CreateWidget(wxWindow* parent) { - ColorLayerImageViewPanel *clivp = new ColorLayerImageViewPanel(parent, 0, 100, bbGetInputOpacity() ,bbGetInputTypeControlsInterface() ); - bbSetOutputWidget( clivp ); + ColorLayerImageViewPanel_widgetBox *clivp = new ColorLayerImageViewPanel_widgetBox(parent, 0, 100, bbGetInputOpacity() ,bbGetInputTypeControlsInterface() ); + bbSetOutputWidget( (ColorLayerImageViewPanel*)clivp ); } //===== // Don't edit this file. This file is generated from xml description.. diff --git a/bbtk/src/bbcreaMaracasVisuColorLayerImageView.h b/bbtk/src/bbcreaMaracasVisuColorLayerImageView.h index 73656fc..7e2dda0 100644 --- a/bbtk/src/bbcreaMaracasVisuColorLayerImageView.h +++ b/bbtk/src/bbcreaMaracasVisuColorLayerImageView.h @@ -65,6 +65,7 @@ class bbcreaMaracasVisu_EXPORT ColorLayerImageView BBTK_DECLARE_INPUT(ColorBarPosition,std::vector); BBTK_DECLARE_OUTPUT(NewImage,vtkImageData*); BBTK_DECLARE_OUTPUT(LookupTable,vtkScalarsToColors*); + BBTK_DECLARE_OUTPUT(OutOpacity,int); BBTK_PROCESS(Process); void Process(); BBTK_CREATE_WIDGET(CreateWidget); @@ -104,6 +105,7 @@ BBTK_BEGIN_DESCRIBE_BLACK_BOX(ColorLayerImageView,bbtk::WxBlackBox); BBTK_OUTPUT(ColorLayerImageView,NewImage,"Image with correct Spacing",vtkImageData*,""); BBTK_OUTPUT(ColorLayerImageView,LookupTable,"LookupTable",vtkScalarsToColors*,""); + BBTK_OUTPUT(ColorLayerImageView,OutOpacity,"Opacity",int,""); BBTK_END_DESCRIBE_BLACK_BOX(ColorLayerImageView); //===== diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/ThresholdImageView/ColorLayerImageViewPanel.cxx b/lib/maracasVisuLib/src/interface/wxWindows/widgets/ThresholdImageView/ColorLayerImageViewPanel.cxx index 0aaef03..01f4c4d 100644 --- a/lib/maracasVisuLib/src/interface/wxWindows/widgets/ThresholdImageView/ColorLayerImageViewPanel.cxx +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/ThresholdImageView/ColorLayerImageViewPanel.cxx @@ -456,6 +456,12 @@ void ColorLayerImageViewPanel::onSliceImage(wxScrollEvent& event) RefreshView(); } +//---------------------------------------------------------------------------- +int ColorLayerImageViewPanel::GetOpacity() +{ + return _opacity->GetValue(); +} + //---------------------------------------------------------------------------- void ColorLayerImageViewPanel::ChangeOpacity() { diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/ThresholdImageView/ColorLayerImageViewPanel.h b/lib/maracasVisuLib/src/interface/wxWindows/widgets/ThresholdImageView/ColorLayerImageViewPanel.h index 50cfb7e..9109345 100644 --- a/lib/maracasVisuLib/src/interface/wxWindows/widgets/ThresholdImageView/ColorLayerImageViewPanel.h +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/ThresholdImageView/ColorLayerImageViewPanel.h @@ -75,7 +75,8 @@ class ColorLayerImageViewPanel ColorLayerImageViewPanel(wxWindow * parent, int min, int max,int opacity, int type); ~ColorLayerImageViewPanel(); void onThresholdStop(); - void ChangeOpacity(); + int GetOpacity(); + virtual void ChangeOpacity(); ColorLayerImageViewManager* GetColorLayerImageViewManager(); //EED01 ColorLayerImageView* GetColorLayerImageView(); //EED01 void SetColorLayerImageView(ColorLayerImageView* colorLayerImageView);