VTK  9.3.0
vtkImageBlend.h
Go to the documentation of this file.
1 // SPDX-FileCopyrightText: Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
2 // SPDX-License-Identifier: BSD-3-Clause
76 #ifndef vtkImageBlend_h
77 #define vtkImageBlend_h
78 
79 #include "vtkImagingCoreModule.h" // For export macro
81 
82 VTK_ABI_NAMESPACE_BEGIN
84 
85 #define VTK_IMAGE_BLEND_MODE_NORMAL 0
86 #define VTK_IMAGE_BLEND_MODE_COMPOUND 1
87 
88 class VTKIMAGINGCORE_EXPORT vtkImageBlend : public vtkThreadedImageAlgorithm
89 {
90 public:
91  static vtkImageBlend* New();
93  void PrintSelf(ostream& os, vtkIndent indent) override;
94 
101  virtual void ReplaceNthInputConnection(int idx, vtkAlgorithmOutput* input);
102 
104 
109  void SetInputData(int num, vtkDataObject* input);
110  void SetInputData(vtkDataObject* input) { this->SetInputData(0, input); }
112 
114 
120  vtkDataObject* GetInput() { return this->GetInput(0); }
122 
129 
131 
135  void SetOpacity(int idx, double opacity);
136  double GetOpacity(int idx);
138 
144 
146 
152 
154 
157  vtkSetClampMacro(BlendMode, int, VTK_IMAGE_BLEND_MODE_NORMAL, VTK_IMAGE_BLEND_MODE_COMPOUND);
158  vtkGetMacro(BlendMode, int);
159  void SetBlendModeToNormal() { this->SetBlendMode(VTK_IMAGE_BLEND_MODE_NORMAL); }
161  const char* GetBlendModeAsString();
163 
165 
169  vtkSetMacro(CompoundThreshold, double);
170  vtkGetMacro(CompoundThreshold, double);
172 
174 
179  vtkSetMacro(CompoundAlpha, vtkTypeBool);
180  vtkGetMacro(CompoundAlpha, vtkTypeBool);
181  vtkBooleanMacro(CompoundAlpha, vtkTypeBool);
183 
184 protected:
186  ~vtkImageBlend() override;
187 
189 
190  void InternalComputeInputUpdateExtent(int inExt[6], int outExt[6], int inWExtent[6]);
191 
193  vtkInformationVector* outputVector, vtkImageData*** inData, vtkImageData** outData, int ext[6],
194  int id) override;
195 
196  // see vtkAlgorithm for docs.
198 
199  // see vtkAlgorithm for docs.
200  int RequestData(vtkInformation* request, vtkInformationVector** inputVector,
201  vtkInformationVector* outputVector) override;
202 
203  double* Opacity;
209 
210 private:
211  vtkImageBlend(const vtkImageBlend&) = delete;
212  void operator=(const vtkImageBlend&) = delete;
213 };
214 
219 {
220  switch (this->BlendMode)
221  {
223  return "Normal";
225  return "Compound";
226  default:
227  return "Unknown Blend Mode";
228  }
229 }
230 
231 VTK_ABI_NAMESPACE_END
232 #endif
Proxy object to connect input/output ports.
int GetNumberOfInputConnections(int port)
Get the number of inputs currently connected to a port.
general representation of visualization data
Definition: vtkDataObject.h:64
blend images together using alpha or opacity
Definition: vtkImageBlend.h:89
void SetStencilData(vtkImageStencilData *stencil)
Set a stencil to apply when blending the data.
void SetBlendModeToNormal()
Set the blend mode.
vtkTypeBool CompoundAlpha
void SetOpacity(int idx, double opacity)
Set the opacity of an input image: the alpha values of the image are multiplied by the opacity.
vtkImageStencilData * GetStencil()
Set a stencil to apply when blending the data.
static vtkImageBlend * New()
virtual void ReplaceNthInputConnection(int idx, vtkAlgorithmOutput *input)
Replace one of the input connections with a new input.
void SetBlendModeToCompound()
Set the blend mode.
void SetInputData(int num, vtkDataObject *input)
Assign a data object as input.
int RequestUpdateExtent(vtkInformation *, vtkInformationVector **, vtkInformationVector *) override
Subclasses can reimplement this method to translate the update extent requests from each output port ...
int RequestData(vtkInformation *request, vtkInformationVector **inputVector, vtkInformationVector *outputVector) override
This is called by the superclass.
void InternalComputeInputUpdateExtent(int inExt[6], int outExt[6], int inWExtent[6])
void SetInputData(vtkDataObject *input)
Assign a data object as input.
int FillInputPortInformation(int, vtkInformation *) override
These method should be reimplemented by subclasses that have more than a single input or single outpu...
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
void ThreadedRequestData(vtkInformation *request, vtkInformationVector **inputVector, vtkInformationVector *outputVector, vtkImageData ***inData, vtkImageData **outData, int ext[6], int id) override
If the subclass does not define an Execute method, then the task will be broken up,...
~vtkImageBlend() override
vtkDataObject * GetInput()
Get one input to this filter.
double CompoundThreshold
vtkDataObject * GetInput(int num)
Get one input to this filter.
int GetNumberOfInputs()
Get the number of inputs to this filter.
double * Opacity
const char * GetBlendModeAsString()
Get the blending mode as a descriptive string.
double GetOpacity(int idx)
Set the opacity of an input image: the alpha values of the image are multiplied by the opacity.
void SetStencilConnection(vtkAlgorithmOutput *algOutput)
Set a stencil to apply when blending the data.
topologically and geometrically regular array of data
Definition: vtkImageData.h:52
efficient description of an image stencil
a simple class to control print indentation
Definition: vtkIndent.h:38
Store zero or more vtkInformation instances.
Store vtkAlgorithm input/output information.
Generic filter that has one input.
int vtkTypeBool
Definition: vtkABI.h:64
#define VTK_IMAGE_BLEND_MODE_NORMAL
Definition: vtkImageBlend.h:85
#define VTK_IMAGE_BLEND_MODE_COMPOUND
Definition: vtkImageBlend.h:86