VTK  9.7.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
68 #ifndef vtkImageBlend_h
69 #define vtkImageBlend_h
70 
71 #include "vtkImagingCoreModule.h" // For export macro
73 
74 VTK_ABI_NAMESPACE_BEGIN
76 
77 #define VTK_IMAGE_BLEND_MODE_NORMAL 0
78 #define VTK_IMAGE_BLEND_MODE_COMPOUND 1
79 
80 class VTKIMAGINGCORE_EXPORT vtkImageBlend : public vtkThreadedImageAlgorithm
81 {
82 public:
83  static vtkImageBlend* New();
85  void PrintSelf(ostream& os, vtkIndent indent) override;
86 
93  virtual void ReplaceNthInputConnection(int idx, vtkAlgorithmOutput* input);
94 
96 
101  void SetInputData(int num, vtkDataObject* input);
102  void SetInputData(vtkDataObject* input) { this->SetInputData(0, input); }
104 
106 
111  vtkDataObject* GetInput(int num);
112  vtkDataObject* GetInput() { return this->GetInput(0); }
114 
121 
123 
127  void SetOpacity(int idx, double opacity);
128  double GetOpacity(int idx);
130 
135  void SetStencilConnection(vtkAlgorithmOutput* algOutput);
136 
138 
141  void SetStencilData(vtkImageStencilData* stencil);
142  vtkImageStencilData* GetStencil();
144 
146 
149  vtkSetClampMacro(BlendMode, int, VTK_IMAGE_BLEND_MODE_NORMAL, VTK_IMAGE_BLEND_MODE_COMPOUND);
150  vtkGetMacro(BlendMode, int);
151  void SetBlendModeToNormal() { this->SetBlendMode(VTK_IMAGE_BLEND_MODE_NORMAL); }
153  const char* GetBlendModeAsString();
155 
157 
170  vtkSetMacro(BlendAlpha, vtkTypeBool);
171  vtkGetMacro(BlendAlpha, vtkTypeBool);
172  vtkBooleanMacro(BlendAlpha, vtkTypeBool);
174 
176 
181  vtkSetMacro(CompoundThreshold, double);
182  vtkGetMacro(CompoundThreshold, double);
184 
186 
192  vtkSetMacro(CompoundAlpha, vtkTypeBool);
193  vtkGetMacro(CompoundAlpha, vtkTypeBool);
194  vtkBooleanMacro(CompoundAlpha, vtkTypeBool);
196 
197 protected:
198  vtkImageBlend();
199  ~vtkImageBlend() override;
200 
202 
203  void InternalComputeInputUpdateExtent(
204  int inExt[6], VTK_FUTURE_CONST int outExt[6], VTK_FUTURE_CONST int inWExtent[6]);
205 
206  void ThreadedRequestData(vtkInformation* request, vtkInformationVector** inputVector,
207  vtkInformationVector* outputVector, vtkImageData*** inData, vtkImageData** outData,
208  VTK_FUTURE_CONST int ext[6], int id) override;
209 
210  // see vtkAlgorithm for docs.
211  int FillInputPortInformation(int, vtkInformation*) override;
212 
213  // see vtkAlgorithm for docs.
214  int RequestData(vtkInformation* request, vtkInformationVector** inputVector,
215  vtkInformationVector* outputVector) override;
216 
217  double* Opacity;
224 
225 private:
226  vtkImageBlend(const vtkImageBlend&) = delete;
227  void operator=(const vtkImageBlend&) = delete;
228 };
229 
234 {
235  switch (this->BlendMode)
236  {
238  return "Normal";
240  return "Compound";
241  default:
242  return "Unknown Blend Mode";
243  }
244 }
245 
246 VTK_ABI_NAMESPACE_END
247 #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:78
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:77
vtkTypeBool DataWasPassed
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
vtkTypeBool BlendAlpha
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:45
vtkTypeBool CompoundAlpha
virtual void ThreadedRequestData(vtkInformation *request, vtkInformationVector **inputVector, vtkInformationVector *outputVector, vtkImageData ***inData, vtkImageData **outData, VTK_FUTURE_CONST 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:80
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:55