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
67 #ifndef vtkImageBlend_h
68 #define vtkImageBlend_h
69 
70 #include "vtkImagingCoreModule.h" // For export macro
72 
73 VTK_ABI_NAMESPACE_BEGIN
75 
76 #define VTK_IMAGE_BLEND_MODE_NORMAL 0
77 #define VTK_IMAGE_BLEND_MODE_COMPOUND 1
78 
79 class VTKIMAGINGCORE_EXPORT vtkImageBlend : public vtkThreadedImageAlgorithm
80 {
81 public:
82  static vtkImageBlend* New();
84  void PrintSelf(ostream& os, vtkIndent indent) override;
85 
92  virtual void ReplaceNthInputConnection(int idx, vtkAlgorithmOutput* input);
93 
95 
100  void SetInputData(int num, vtkDataObject* input);
101  void SetInputData(vtkDataObject* input) { this->SetInputData(0, input); }
103 
105 
111  vtkDataObject* GetInput() { return this->GetInput(0); }
113 
120 
122 
126  void SetOpacity(int idx, double opacity);
127  double GetOpacity(int idx);
129 
135 
137 
143 
145 
148  vtkSetClampMacro(BlendMode, int, VTK_IMAGE_BLEND_MODE_NORMAL, VTK_IMAGE_BLEND_MODE_COMPOUND);
149  vtkGetMacro(BlendMode, int);
150  void SetBlendModeToNormal() { this->SetBlendMode(VTK_IMAGE_BLEND_MODE_NORMAL); }
152  const char* GetBlendModeAsString();
154 
156 
160  vtkSetMacro(CompoundThreshold, double);
161  vtkGetMacro(CompoundThreshold, double);
163 
165 
170  vtkSetMacro(CompoundAlpha, vtkTypeBool);
171  vtkGetMacro(CompoundAlpha, vtkTypeBool);
172  vtkBooleanMacro(CompoundAlpha, vtkTypeBool);
174 
175 protected:
177  ~vtkImageBlend() override;
178 
180 
181  void InternalComputeInputUpdateExtent(int inExt[6], int outExt[6], int inWExtent[6]);
182 
184  vtkInformationVector* outputVector, vtkImageData*** inData, vtkImageData** outData, int ext[6],
185  int id) override;
186 
187  // see vtkAlgorithm for docs.
189 
190  // see vtkAlgorithm for docs.
191  int RequestData(vtkInformation* request, vtkInformationVector** inputVector,
192  vtkInformationVector* outputVector) override;
193 
194  double* Opacity;
200 
201 private:
202  vtkImageBlend(const vtkImageBlend&) = delete;
203  void operator=(const vtkImageBlend&) = delete;
204 };
205 
210 {
211  switch (this->BlendMode)
212  {
214  return "Normal";
216  return "Compound";
217  default:
218  return "Unknown Blend Mode";
219  }
220 }
221 
222 VTK_ABI_NAMESPACE_END
223 #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:55
blend images together using alpha or opacity
Definition: vtkImageBlend.h:80
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:43
efficient description of an image stencil
a simple class to control print indentation
Definition: vtkIndent.h:29
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:76
#define VTK_IMAGE_BLEND_MODE_COMPOUND
Definition: vtkImageBlend.h:77