VTK  9.2.6
vtkImageBlend.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkImageBlend.h
5 
6  Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
7  All rights reserved.
8  See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
9 
10  This software is distributed WITHOUT ANY WARRANTY; without even
11  the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
12  PURPOSE. See the above copyright notice for more information.
13 
14 =========================================================================*/
79 #ifndef vtkImageBlend_h
80 #define vtkImageBlend_h
81 
82 #include "vtkImagingCoreModule.h" // For export macro
84 
86 
87 #define VTK_IMAGE_BLEND_MODE_NORMAL 0
88 #define VTK_IMAGE_BLEND_MODE_COMPOUND 1
89 
90 class VTKIMAGINGCORE_EXPORT vtkImageBlend : public vtkThreadedImageAlgorithm
91 {
92 public:
93  static vtkImageBlend* New();
95  void PrintSelf(ostream& os, vtkIndent indent) override;
96 
103  virtual void ReplaceNthInputConnection(int idx, vtkAlgorithmOutput* input);
104 
106 
111  void SetInputData(int num, vtkDataObject* input);
112  void SetInputData(vtkDataObject* input) { this->SetInputData(0, input); }
114 
116 
121  vtkDataObject* GetInput(int num);
122  vtkDataObject* GetInput() { return this->GetInput(0); }
124 
131 
133 
137  void SetOpacity(int idx, double opacity);
138  double GetOpacity(int idx);
140 
145  void SetStencilConnection(vtkAlgorithmOutput* algOutput);
146 
148 
151  void SetStencilData(vtkImageStencilData* stencil);
152  vtkImageStencilData* GetStencil();
154 
156 
159  vtkSetClampMacro(BlendMode, int, VTK_IMAGE_BLEND_MODE_NORMAL, VTK_IMAGE_BLEND_MODE_COMPOUND);
160  vtkGetMacro(BlendMode, int);
161  void SetBlendModeToNormal() { this->SetBlendMode(VTK_IMAGE_BLEND_MODE_NORMAL); }
163  const char* GetBlendModeAsString(void);
165 
167 
171  vtkSetMacro(CompoundThreshold, double);
172  vtkGetMacro(CompoundThreshold, double);
174 
176 
181  vtkSetMacro(CompoundAlpha, vtkTypeBool);
182  vtkGetMacro(CompoundAlpha, vtkTypeBool);
183  vtkBooleanMacro(CompoundAlpha, vtkTypeBool);
185 
186 protected:
187  vtkImageBlend();
188  ~vtkImageBlend() override;
189 
191 
192  void InternalComputeInputUpdateExtent(int inExt[6], int outExt[6], int inWExtent[6]);
193 
194  void ThreadedRequestData(vtkInformation* request, vtkInformationVector** inputVector,
195  vtkInformationVector* outputVector, vtkImageData*** inData, vtkImageData** outData, int ext[6],
196  int id) override;
197 
198  // see vtkAlgorithm for docs.
199  int FillInputPortInformation(int, vtkInformation*) override;
200 
201  // see vtkAlgorithm for docs.
202  int RequestData(vtkInformation* request, vtkInformationVector** inputVector,
203  vtkInformationVector* outputVector) override;
204 
205  double* Opacity;
211 
212 private:
213  vtkImageBlend(const vtkImageBlend&) = delete;
214  void operator=(const vtkImageBlend&) = delete;
215 };
216 
221 {
222  switch (this->BlendMode)
223  {
225  return "Normal";
227  return "Compound";
228  default:
229  return "Unknown Blend Mode";
230  }
231 }
232 
233 #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:88
const char * GetBlendModeAsString(void)
Get the blending mode as a descriptive string.
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:87
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:69
Generic filter that has one input.
a simple class to control print indentation
Definition: vtkIndent.h:39
efficient description of an image stencil
topologically and geometrically regular array of data
Definition: vtkImageData.h:53
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:90
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:65