]> Creatis software - creaMaracasVisu.git/commitdiff
#3500 Bug ColorLayerImageView
authorEduardo DAVILA <eduardo.davila@creatis.insa-lyon.fr>
Thu, 9 Mar 2023 15:58:30 +0000 (16:58 +0100)
committerEduardo DAVILA <eduardo.davila@creatis.insa-lyon.fr>
Thu, 9 Mar 2023 15:58:30 +0000 (16:58 +0100)
bbtk/src/bbcreaMaracasVisuColorLayerImageView.cxx

index 46cf052ced5a561e627098b08a26a71540f08e23..384629726ce3cc05068454c53e0009b679221e22 100644 (file)
@@ -50,7 +50,7 @@ class ColorLayerImageViewPanel_widgetBox : public ColorLayerImageViewPanel
 ColorLayerImageViewPanel_widgetBox::ColorLayerImageViewPanel_widgetBox( wxWindow * parent, int min, int max,int opacity, int type  )
         : ColorLayerImageViewPanel( parent,  min, max, opacity, type  )
 {
-       mBox=NULL;
+       mBox = NULL;
 }
 
 void ColorLayerImageViewPanel_widgetBox::ChangeOpacity()
@@ -65,7 +65,7 @@ void ColorLayerImageViewPanel_widgetBox::ChangeOpacity()
 
 void ColorLayerImageViewPanel_widgetBox::SetBox(ColorLayerImageView* box)
 {
-       mBox=box;       
+       mBox = box;     
 }
 
 BBTK_ADD_BLACK_BOX_TO_PACKAGE(creaMaracasVisu,ColorLayerImageView)
@@ -78,36 +78,39 @@ void ColorLayerImageView::Process()
     if ( !( (bbGetInputWxVtkBaseView()==NULL) && (bbGetInputWxVtkBaseView1()==NULL) && (bbGetInputWxVtkBaseView2()==NULL))  )
     {
         ColorLayerImageViewPanel_widgetBox *clivp = (ColorLayerImageViewPanel_widgetBox*)bbGetOutputWidget();
-        if (firsttime==true)
-         {
-    //      firsttime=false;
-            clivp->SetActive( bbGetInputActive() );
-         }
-        clivp->GetColorLayerImageViewManager()->SetwxVtkBaseView( 0 , bbGetInputWxVtkBaseView() );
-        clivp->GetColorLayerImageViewManager()->SetwxVtkBaseView( 1 , bbGetInputWxVtkBaseView1() );
-        clivp->GetColorLayerImageViewManager()->SetwxVtkBaseView( 2 , bbGetInputWxVtkBaseView2() );
-        std::vector<double> range = bbGetInputlstRangeForColorBar();
-        clivp->GetColorLayerImageViewManager()->SetRangeForColorBar( range );
-        std::vector<int> colorbarposition = bbGetInputColorBarPosition();
-        clivp->GetColorLayerImageViewManager()->SetColorBarPosition( colorbarposition );
-        std::vector<double> base_color = bbGetInputlstBaseColor();
-        clivp->GetColorLayerImageViewManager()->SetBaseColors( base_color );
-        std::vector<double> grey_level_boundaries = bbGetInputlstGreyLevelBoundaries();
-        clivp->GetColorLayerImageViewManager()->SetGreyLevelBoundaries( grey_level_boundaries );
-        std::vector<double> transparence_level_boundaries = bbGetInputlstTransparenceBoundaries();
-        clivp->GetColorLayerImageViewManager()->SetBaseTransparence( transparence_level_boundaries );
-        clivp->GetColorLayerImageViewManager()->SetPlainOrGradientColor( bbGetInputPlainOrGradientColor() );
-        clivp->SetFittingMode( bbGetInputFittingMode() );
-        clivp->SetImage( bbGetInputIn() );
-        bbSetOutputNewImage( clivp->GetColorLayerImageViewManager()->GetImageChangeInformation(0) );
-        bbSetOutputLookupTable( clivp->GetColorLayerImageViewManager()->GetLookupTable(0) );
-        bbSetOutputOutOpacity( clivp->GetOpacity() );
-        if (firsttime==true)
-        {
-            firsttime=false;
-            clivp->ChangeOpacity();
-            clivp->SetBox(this);
-        }
+               if (clivp!=NULL) {
+               
+                   if (firsttime==true)
+                    {
+               //      firsttime=false;
+                       clivp->SetActive( bbGetInputActive() );
+                    }
+                   clivp->GetColorLayerImageViewManager()->SetwxVtkBaseView( 0 , bbGetInputWxVtkBaseView() );
+                   clivp->GetColorLayerImageViewManager()->SetwxVtkBaseView( 1 , bbGetInputWxVtkBaseView1() );
+                   clivp->GetColorLayerImageViewManager()->SetwxVtkBaseView( 2 , bbGetInputWxVtkBaseView2() );
+                   std::vector<double> range = bbGetInputlstRangeForColorBar();
+                   clivp->GetColorLayerImageViewManager()->SetRangeForColorBar( range );
+                   std::vector<int> colorbarposition = bbGetInputColorBarPosition();
+                   clivp->GetColorLayerImageViewManager()->SetColorBarPosition( colorbarposition );
+                   std::vector<double> base_color = bbGetInputlstBaseColor();
+                   clivp->GetColorLayerImageViewManager()->SetBaseColors( base_color );
+                   std::vector<double> grey_level_boundaries = bbGetInputlstGreyLevelBoundaries();
+                   clivp->GetColorLayerImageViewManager()->SetGreyLevelBoundaries( grey_level_boundaries );
+                   std::vector<double> transparence_level_boundaries = bbGetInputlstTransparenceBoundaries();
+                   clivp->GetColorLayerImageViewManager()->SetBaseTransparence( transparence_level_boundaries );
+                   clivp->GetColorLayerImageViewManager()->SetPlainOrGradientColor( bbGetInputPlainOrGradientColor() );
+                   clivp->SetFittingMode( bbGetInputFittingMode() );
+                   clivp->SetImage( bbGetInputIn() );
+                   bbSetOutputNewImage( clivp->GetColorLayerImageViewManager()->GetImageChangeInformation(0) );
+                   bbSetOutputLookupTable( clivp->GetColorLayerImageViewManager()->GetLookupTable(0) );
+                   bbSetOutputOutOpacity( clivp->GetOpacity() );
+                   if (firsttime==true)
+                   {
+                       firsttime=false;
+                       clivp->ChangeOpacity();
+                       clivp->SetBox(this);
+                   }
+               }   // if clivp              
     } else {
         printf("EED Error!!!  ColorLayerImageView::Process   (%s)  Missing Inputs:  WxVtkBaseView , WxVtkBaseView1 , WxVtkBaseView2 \n", bbGetFullName().c_str() );
     }// if xxVtkBaseView
@@ -139,6 +142,7 @@ void ColorLayerImageView::bbUserSetDefaultValues()
        lstColorBarPosition.push_back(10);
        lstColorBarPosition.push_back(105);
        bbSetInputColorBarPosition(lstColorBarPosition);
+       bbSetOutputWidget(NULL);
 }
 
 //=====