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 =========================================================================*/
74 #ifndef vtkImageBlend_h
75 #define vtkImageBlend_h
76 
77 
78 #include "vtkImagingCoreModule.h" // For export macro
80 
82 
83 #define VTK_IMAGE_BLEND_MODE_NORMAL 0
84 #define VTK_IMAGE_BLEND_MODE_COMPOUND 1
85 
86 class VTKIMAGINGCORE_EXPORT vtkImageBlend : public vtkThreadedImageAlgorithm
87 {
88 public:
89  static vtkImageBlend *New();
91  void PrintSelf(ostream& os, vtkIndent indent) VTK_OVERRIDE;
92 
99  virtual void ReplaceNthInputConnection(int idx, vtkAlgorithmOutput* input);
100 
102 
107  void SetInputData(int num, vtkDataObject *input);
108  void SetInputData(vtkDataObject *input) { this->SetInputData(0, input); };
110 
112 
117  vtkDataObject *GetInput(int num);
118  vtkDataObject *GetInput() { return this->GetInput(0); };
120 
126  int GetNumberOfInputs() { return this->GetNumberOfInputConnections(0); };
127 
129 
133  void SetOpacity(int idx, double opacity);
134  double GetOpacity(int idx);
136 
141  void SetStencilConnection(vtkAlgorithmOutput *algOutput);
142 
144 
147  void SetStencilData(vtkImageStencilData *stencil);
148  vtkImageStencilData *GetStencil();
150 
152 
155  vtkSetClampMacro(BlendMode,int,
158  vtkGetMacro(BlendMode,int);
160  {this->SetBlendMode(VTK_IMAGE_BLEND_MODE_NORMAL);};
162  {this->SetBlendMode(VTK_IMAGE_BLEND_MODE_COMPOUND);};
163  const char *GetBlendModeAsString(void);
165 
167 
171  vtkSetMacro(CompoundThreshold,double);
172  vtkGetMacro(CompoundThreshold,double);
174 
175 protected:
176  vtkImageBlend();
177  ~vtkImageBlend() VTK_OVERRIDE;
178 
181  vtkInformationVector *) VTK_OVERRIDE;
182 
183  void InternalComputeInputUpdateExtent(int inExt[6], int outExt[6],
184  int inWExtent[6]);
185 
186  void ThreadedRequestData (vtkInformation* request,
187  vtkInformationVector** inputVector,
188  vtkInformationVector* outputVector,
189  vtkImageData ***inData, vtkImageData **outData,
190  int ext[6], int id) VTK_OVERRIDE;
191 
192  // see vtkAlgorithm for docs.
193  int FillInputPortInformation(int, vtkInformation*) VTK_OVERRIDE;
194 
195  // see vtkAlgorithm for docs.
196  int RequestData(vtkInformation* request,
197  vtkInformationVector** inputVector,
198  vtkInformationVector* outputVector) VTK_OVERRIDE;
199 
200  double *Opacity;
205 
206 private:
207  vtkImageBlend(const vtkImageBlend&) VTK_DELETE_FUNCTION;
208  void operator=(const vtkImageBlend&) VTK_DELETE_FUNCTION;
209 };
210 
212 
216 {
217  switch (this->BlendMode)
218  {
220  return "Normal";
222  return "Compound";
223  default:
224  return "Unknown Blend Mode";
225  }
226 }
228 
229 
230 #endif
231 
232 
233 
234 
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:84
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:83
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.
Generic filter that has one input.
a simple class to control print indentation
Definition: vtkIndent.h:33
efficient description of an image stencil
topologically and geometrically regular array of data
Definition: vtkImageData.h:39
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.
vtkSetMacro(IgnoreDriverBugs, bool)
When set known driver bugs are ignored during driver feature detection.
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:86
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:58