]> Creatis software - creaMaracasVisu.git/commitdiff
#3461 Feuture Export Opacity ColorLayerImageView
authorEduardo DAVILA <eduardo.davila@creatis.insa-lyon.fr>
Mon, 26 Apr 2021 07:01:52 +0000 (09:01 +0200)
committerEduardo DAVILA <eduardo.davila@creatis.insa-lyon.fr>
Mon, 26 Apr 2021 07:01:52 +0000 (09:01 +0200)
bbtk/src/bbcreaMaracasVisuColorLayerImageView.cxx
bbtk/src/bbcreaMaracasVisuColorLayerImageView.h
lib/maracasVisuLib/src/interface/wxWindows/widgets/ThresholdImageView/ColorLayerImageViewPanel.cxx
lib/maracasVisuLib/src/interface/wxWindows/widgets/ThresholdImageView/ColorLayerImageViewPanel.h

index 6681598bd21ee82392692900946dfc08a3b0ea7b..afd1af0454e082f55d7e2f1539f47c99348b4f92 100644 (file)
 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..
index 73656fc52dcf1ab2597536e0e181e5f169d6e1c3..7e2dda039b5a74c8a57cb93539159fb0a6008598 100644 (file)
@@ -65,6 +65,7 @@ class bbcreaMaracasVisu_EXPORT ColorLayerImageView
   BBTK_DECLARE_INPUT(ColorBarPosition,std::vector<int>);
   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);
 //=====
index 0aaef03610b4d2c7e4777865c855269f2b1e679c..01f4c4d6394d36c86dc34e33f61ebd949b3a5a99 100644 (file)
@@ -456,6 +456,12 @@ void ColorLayerImageViewPanel::onSliceImage(wxScrollEvent& event)
        RefreshView();
 }
 
+//----------------------------------------------------------------------------
+int ColorLayerImageViewPanel::GetOpacity()
+{
+       return _opacity->GetValue();
+}
+
 //----------------------------------------------------------------------------
 void ColorLayerImageViewPanel::ChangeOpacity()
 {
index 50cfb7ec1622d466e220f4d0041776a8267f92be..91093454c035165e5ffa192aee205e9ee35e1704 100644 (file)
@@ -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);