BBTK_BLACK_BOX_IMPLEMENTATION(ImageActor,bbtk::AtomicBlackBox);
void ImageActor::Process()
{
- //JCP 04/04/09
- vtkImageData *img = bbGetInputIn();
- vtkLinearTransform* transform = bbGetInputTransform();
-
- if(img != NULL)
- {
- if (bbGetInputLookupTable()==NULL)
- {
-//EED 2017-01-01 Migration VTK7
+
+ if (bbGetInputActive()==true)
+ {
+ //JCP 04/04/09
+ vtkImageData *img = bbGetInputIn();
+ vtkLinearTransform* transform = bbGetInputTransform();
+
+ if(img != NULL)
+ {
+ if (bbGetInputLookupTable()==NULL)
+ {
+ //EED 2017-01-01 Migration VTK7
#if VTK_MAJOR_VERSION <= 5
- imageactor->SetInput( img );
+ imageactor->SetInput( img );
#else
- imageactor->SetInputData( img );
+ imageactor->SetInputData( img );
#endif
- } else {
- vtkImageMapToColors *color = vtkImageMapToColors::New();
- color->SetLookupTable( bbGetInputLookupTable() );
- color->PassAlphaToOutputOn();
-
-//EED 2017-01-01 Migration VTK7
+ } else {
+ vtkImageMapToColors *color = vtkImageMapToColors::New();
+ color->SetLookupTable( bbGetInputLookupTable() );
+ color->PassAlphaToOutputOn();
+
+ //EED 2017-01-01 Migration VTK7
#if VTK_MAJOR_VERSION <= 5
- color->SetInput( img );
- color->Update();
- imageactor->GetMapper()->SetInput( color->GetOutput() );
+ color->SetInput( img );
+ color->Update();
+ imageactor->GetMapper()->SetInput( color->GetOutput() );
#else
- color->SetInputData( img );
- color->Update();
- imageactor->GetMapper()->SetInputData( color->GetOutput() );
+ color->SetInputData( img );
+ color->Update();
+ imageactor->GetMapper()->SetInputData( color->GetOutput() );
#endif
-
- if ( bbGetInputInterpolationMode()==0) { imageactor->GetProperty()->SetInterpolationTypeToNearest(); }
- if ( bbGetInputInterpolationMode()==1) { imageactor->GetProperty()->SetInterpolationTypeToLinear(); }
- if ( bbGetInputInterpolationMode()==2) { imageactor->GetProperty()->SetInterpolationTypeToCubic(); }
- imageactor->SetForceOpaque(true);
- }
-
- if (transform!=NULL)
- {
- imageactor->SetUserTransform( transform );
- } // transform
- bbSetOutputOut(imageactor);
- } // img
-
- // Interface Update
- if ((firsttime==true) && (bbGetInputRenderer()!=NULL ))
- {
- firsttime=false;
- bbGetInputRenderer()->AddActor( imageactor );
- }
- imageactor->GetProperty()->SetOpacity( bbGetInputOpacity() );
- bbSetOutputOut(imageactor);
+
+ if ( bbGetInputInterpolationMode()==0) { imageactor->GetProperty()->SetInterpolationTypeToNearest(); }
+ if ( bbGetInputInterpolationMode()==1) { imageactor->GetProperty()->SetInterpolationTypeToLinear(); }
+ if ( bbGetInputInterpolationMode()==2) { imageactor->GetProperty()->SetInterpolationTypeToCubic(); }
+ imageactor->SetForceOpaque(true);
+ }
+
+ if (transform!=NULL)
+ {
+ imageactor->SetUserTransform( transform );
+ } // transform
+ bbSetOutputOut(imageactor);
+ } // img
+
+ // Interface Update
+ if ((firsttime==true) && (bbGetInputRenderer()!=NULL ))
+ {
+ firsttime=false;
+ bbGetInputRenderer()->AddActor( imageactor );
+ }
+ imageactor->GetProperty()->SetOpacity( bbGetInputOpacity() );
+ bbSetOutputOut(imageactor);
+ }else{
+ if ((firsttime==false) && (bbGetInputRenderer()!=NULL ))
+ {
+ firsttime = true;
+ bbGetInputRenderer()->RemoveActor( imageactor );
+ }
+ }
}
void ImageActor::bbUserSetDefaultValues()
{
firsttime = true;
imageactor = NULL;
+ bbSetInputActive(true);
bbSetInputIn(NULL);
bbSetInputOpacity(1);
bbSetInputTransform(NULL);
public bbtk::AtomicBlackBox
{
BBTK_BLACK_BOX_INTERFACE(ImageActor,bbtk::AtomicBlackBox);
+ BBTK_DECLARE_INPUT(Active, bool);
BBTK_DECLARE_INPUT(In,vtkImageData*);
BBTK_DECLARE_INPUT(Transform,vtkLinearTransform*);
BBTK_DECLARE_INPUT(Renderer,vtkRenderer*);
BBTK_PROCESS(Process);
void Process();
bool firsttime;
- vtkImageActor *imageactor;
- vtkImageShiftScale *imageshiftscale;
+ vtkImageActor *imageactor;
+ vtkImageShiftScale *imageshiftscale;
};
BBTK_BEGIN_DESCRIBE_BLACK_BOX(ImageActor,bbtk::AtomicBlackBox);
BBTK_AUTHOR("InfoDev CREATIS");
BBTK_DESCRIPTION("put image in a 3D univers");
BBTK_CATEGORY("");
- BBTK_INPUT(ImageActor,In,"Image input",vtkImageData*,"");
+ BBTK_INPUT(ImageActor,Active,"Active",bool,"");
+ BBTK_INPUT(ImageActor,In,"Image input",vtkImageData*,"");
BBTK_INPUT(ImageActor,Transform,"Transform",vtkLinearTransform*,"");
BBTK_INPUT(ImageActor,Renderer,"Renderer",vtkRenderer*,"");
BBTK_INPUT(ImageActor,Opacity,"Opacity [0-1]",double,"");