VTK  9.3.1
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 
110  vtkDataObject* GetInput(int num);
111  vtkDataObject* GetInput() { return this->GetInput(0); }
113 
120 
122 
126  void SetOpacity(int idx, double opacity);
127  double GetOpacity(int idx);
129 
134  void SetStencilConnection(vtkAlgorithmOutput* algOutput);
135 
137 
140  void SetStencilData(vtkImageStencilData* stencil);
141  vtkImageStencilData* GetStencil();
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:
176  vtkImageBlend();
177  ~vtkImageBlend() override;
178 
180 
181  void InternalComputeInputUpdateExtent(int inExt[6], int outExt[6], int inWExtent[6]);
182 
183  void ThreadedRequestData(vtkInformation* request, vtkInformationVector** inputVector,
184  vtkInformationVector* outputVector, vtkImageData*** inData, vtkImageData** outData, int ext[6],
185  int id) override;
186 
187  // see vtkAlgorithm for docs.
188  int FillInputPortInformation(int, vtkInformation*) override;
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
int GetNumberOfInputConnections(int port)
Get the number of inputs currently connected to a port.
double CompoundThreshold
void SetInputData(vtkDataObject *input)
Assign a data object as input.
#define VTK_IMAGE_BLEND_MODE_COMPOUND
Definition: vtkImageBlend.h:77
Store vtkAlgorithm input/output information.
void SetBlendModeToCompound()
Set the blend mode.
int RequestData(vtkInformation *request, vtkInformationVector **inputVector, vtkInformationVector *outputVector) override
This is called by the superclass.
vtkDataObject * GetInput()
Get a data object for one of the input port connections.
#define VTK_IMAGE_BLEND_MODE_NORMAL
Definition: vtkImageBlend.h:76
void SetInputData(vtkDataObject *)
Assign a data object as input.
virtual int RequestUpdateExtent(vtkInformation *, vtkInformationVector **, vtkInformationVector *)
Subclasses can reimplement this method to translate the update extent requests from each output port ...
Proxy object to connect input/output ports.
int vtkTypeBool
Definition: vtkABI.h:64
Generic filter that has one input.
a simple class to control print indentation
Definition: vtkIndent.h:28
efficient description of an image stencil
const char * GetBlendModeAsString()
Get the blending mode as a descriptive string.
topologically and geometrically regular array of data
Definition: vtkImageData.h:42
vtkTypeBool CompoundAlpha
virtual void ThreadedRequestData(vtkInformation *request, vtkInformationVector **inputVector, vtkInformationVector *outputVector, vtkImageData ***inData, vtkImageData **outData, int extent[6], int threadId)
If the subclass does not define an Execute method, then the task will be broken up, multiple threads will be spawned, and each thread will call this method.
double * Opacity
vtkDataObject * GetInput()
Get one input to this filter.
void SetBlendModeToNormal()
Set the blend mode.
blend images together using alpha or opacity
Definition: vtkImageBlend.h:79
int GetNumberOfInputs()
Get the number of inputs to this filter.
int FillInputPortInformation(int port, vtkInformation *info) override
These method should be reimplemented by subclasses that have more than a single input or single outpu...
Store zero or more vtkInformation instances.
static vtkAlgorithm * New()
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
general representation of visualization data
Definition: vtkDataObject.h:54