VTK
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 =========================================================================*/
77 #ifndef vtkImageBlend_h
78 #define vtkImageBlend_h
79 
80 
81 #include "vtkImagingCoreModule.h" // For export macro
83 
85 
86 #define VTK_IMAGE_BLEND_MODE_NORMAL 0
87 #define VTK_IMAGE_BLEND_MODE_COMPOUND 1
88 
89 class VTKIMAGINGCORE_EXPORT vtkImageBlend : public vtkThreadedImageAlgorithm
90 {
91 public:
92  static vtkImageBlend *New();
94  void PrintSelf(ostream& os, vtkIndent indent) VTK_OVERRIDE;
95 
102  virtual void ReplaceNthInputConnection(int idx, vtkAlgorithmOutput* input);
103 
105 
110  void SetInputData(int num, vtkDataObject *input);
111  void SetInputData(vtkDataObject *input) { this->SetInputData(0, input); };
113 
115 
121  vtkDataObject *GetInput() { return this->GetInput(0); };
123 
129  int GetNumberOfInputs() { return this->GetNumberOfInputConnections(0); };
130 
132 
136  void SetOpacity(int idx, double opacity);
137  double GetOpacity(int idx);
139 
145 
147 
153 
155 
158  vtkSetClampMacro(BlendMode,int,
161  vtkGetMacro(BlendMode,int);
163  {this->SetBlendMode(VTK_IMAGE_BLEND_MODE_NORMAL);};
165  {this->SetBlendMode(VTK_IMAGE_BLEND_MODE_COMPOUND);};
166  const char *GetBlendModeAsString(void);
168 
170 
174  vtkSetMacro(CompoundThreshold,double);
175  vtkGetMacro(CompoundThreshold,double);
177 
178 protected:
181 
184  vtkInformationVector *) VTK_OVERRIDE;
185 
186  void InternalComputeInputUpdateExtent(int inExt[6], int outExt[6],
187  int inWExtent[6]);
188 
190  vtkInformationVector** inputVector,
191  vtkInformationVector* outputVector,
192  vtkImageData ***inData, vtkImageData **outData,
193  int ext[6], int id) VTK_OVERRIDE;
194 
195  // see vtkAlgorithm for docs.
196  virtual int FillInputPortInformation(int, vtkInformation*) VTK_OVERRIDE;
197 
198  // see vtkAlgorithm for docs.
199  virtual int RequestData(vtkInformation* request,
200  vtkInformationVector** inputVector,
201  vtkInformationVector* outputVector) VTK_OVERRIDE;
202 
203  double *Opacity;
208 
209 private:
210  vtkImageBlend(const vtkImageBlend&) VTK_DELETE_FUNCTION;
211  void operator=(const vtkImageBlend&) VTK_DELETE_FUNCTION;
212 };
213 
215 
219 {
220  switch (this->BlendMode)
221  {
223  return "Normal";
225  return "Compound";
226  default:
227  return "Unknown Blend Mode";
228  }
229 }
231 
232 
233 #endif
234 
235 
236 
237 
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:65
blend images together using alpha or opacity
Definition: vtkImageBlend.h:90
void SetStencilData(vtkImageStencilData *stencil)
Set a stencil to apply when blending the data.
void SetBlendModeToNormal()
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()
static vtkImageBlend * New()
virtual void ReplaceNthInputConnection(int idx, vtkAlgorithmOutput *input)
Replace one of the input connections with a new input.
void SetBlendModeToCompound()
void SetInputData(int num, vtkDataObject *input)
Assign a data object as input.
const char * GetBlendModeAsString(void)
Get the blending mode as a descriptive string.
void InternalComputeInputUpdateExtent(int inExt[6], int outExt[6], int inWExtent[6])
void SetInputData(vtkDataObject *input)
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,...
virtual int RequestUpdateExtent(vtkInformation *, vtkInformationVector **, vtkInformationVector *) override
Subclasses can reimplement this method to translate the update extent requests from each output port ...
vtkDataObject * GetInput()
double CompoundThreshold
virtual int RequestData(vtkInformation *request, vtkInformationVector **inputVector, vtkInformationVector *outputVector) override
This is called by the superclass.
vtkDataObject * GetInput(int num)
Get one input to this filter.
int GetNumberOfInputs()
Get the number of inputs to this filter.
double * Opacity
double GetOpacity(int idx)
void SetStencilConnection(vtkAlgorithmOutput *algOutput)
Set a stencil to apply when blending the data.
virtual int FillInputPortInformation(int, vtkInformation *) override
Fill the input port information objects for this algorithm.
topologically and geometrically regular array of data
Definition: vtkImageData.h:46
efficient description of an image stencil
a simple class to control print indentation
Definition: vtkIndent.h:40
Store zero or more vtkInformation instances.
Store vtkAlgorithm input/output information.
Generic filter that has one input.
#define VTK_IMAGE_BLEND_MODE_NORMAL
Definition: vtkImageBlend.h:86
#define VTK_IMAGE_BLEND_MODE_COMPOUND
Definition: vtkImageBlend.h:87
vtkSetMacro(IgnoreDriverBugs, bool)
Updates the extensions string.