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 =========================================================================*/
158 #ifndef vtkImageBlend_h
159 #define vtkImageBlend_h
160 
161 #include "vtkImagingCoreModule.h" // For export macro
163 
164 class vtkImageStencilData;
165 
166 #define VTK_IMAGE_BLEND_MODE_NORMAL 0
167 #define VTK_IMAGE_BLEND_MODE_COMPOUND 1
168 
169 class VTKIMAGINGCORE_EXPORT vtkImageBlend : public vtkThreadedImageAlgorithm
170 {
171 public:
172  static vtkImageBlend* New();
174  void PrintSelf(ostream& os, vtkIndent indent) override;
175 
182  virtual void ReplaceNthInputConnection(int idx, vtkAlgorithmOutput* input);
183 
185 
190  void SetInputData(int num, vtkDataObject* input);
191  void SetInputData(vtkDataObject* input) { this->SetInputData(0, input); }
193 
195 
201  vtkDataObject* GetInput() { return this->GetInput(0); }
203 
210 
212 
216  void SetOpacity(int idx, double opacity);
217  double GetOpacity(int idx);
219 
225 
227 
233 
235 
238  vtkSetClampMacro(BlendMode, int, VTK_IMAGE_BLEND_MODE_NORMAL, VTK_IMAGE_BLEND_MODE_COMPOUND);
239  vtkGetMacro(BlendMode, int);
240  void SetBlendModeToNormal() { this->SetBlendMode(VTK_IMAGE_BLEND_MODE_NORMAL); }
242  const char* GetBlendModeAsString(void);
244 
246 
250  vtkSetMacro(CompoundThreshold, double);
251  vtkGetMacro(CompoundThreshold, double);
253 
255 
260  vtkSetMacro(CompoundAlpha, vtkTypeBool);
261  vtkGetMacro(CompoundAlpha, vtkTypeBool);
262  vtkBooleanMacro(CompoundAlpha, vtkTypeBool);
264 
265 protected:
267  ~vtkImageBlend() override;
268 
270 
271  void InternalComputeInputUpdateExtent(int inExt[6], int outExt[6], int inWExtent[6]);
272 
274  vtkInformationVector* outputVector, vtkImageData*** inData, vtkImageData** outData, int ext[6],
275  int id) override;
276 
277  // see vtkAlgorithm for docs.
279 
280  // see vtkAlgorithm for docs.
281  int RequestData(vtkInformation* request, vtkInformationVector** inputVector,
282  vtkInformationVector* outputVector) override;
283 
284  double* Opacity;
290 
291 private:
292  vtkImageBlend(const vtkImageBlend&) = delete;
293  void operator=(const vtkImageBlend&) = delete;
294 };
295 
300 {
301  switch (this->BlendMode)
302  {
304  return "Normal";
306  return "Compound";
307  default:
308  return "Unknown Blend Mode";
309  }
310 }
311 
312 #endif
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
blend images together using alpha or opacity
void SetStencilData(vtkImageStencilData *stencil)
Set a stencil to apply when blending the data.
void SetBlendModeToNormal()
Set the blend mode.
vtkTypeBool CompoundAlpha
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()
Set a stencil to apply when blending the data.
static vtkImageBlend * New()
virtual void ReplaceNthInputConnection(int idx, vtkAlgorithmOutput *input)
Replace one of the input connections with a new input.
void SetBlendModeToCompound()
Set the blend mode.
void SetInputData(int num, vtkDataObject *input)
Assign a data object as input.
int RequestUpdateExtent(vtkInformation *, vtkInformationVector **, vtkInformationVector *) override
Subclasses can reimplement this method to translate the update extent requests from each output port ...
const char * GetBlendModeAsString(void)
Get the blending mode as a descriptive string.
int RequestData(vtkInformation *request, vtkInformationVector **inputVector, vtkInformationVector *outputVector) override
This is called by the superclass.
void InternalComputeInputUpdateExtent(int inExt[6], int outExt[6], int inWExtent[6])
void SetInputData(vtkDataObject *input)
Assign a data object as input.
int FillInputPortInformation(int, vtkInformation *) override
These method should be reimplemented by subclasses that have more than a single input or single outpu...
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,...
~vtkImageBlend() override
vtkDataObject * GetInput()
Get one input to this filter.
double CompoundThreshold
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)
Set the opacity of an input image: the alpha values of the image are multiplied by the opacity.
void SetStencilConnection(vtkAlgorithmOutput *algOutput)
Set a stencil to apply when blending the data.
topologically and geometrically regular array of data
Definition: vtkImageData.h:163
efficient description of an image stencil
a simple class to control print indentation
Definition: vtkIndent.h:119
Store zero or more vtkInformation instances.
Store vtkAlgorithm input/output information.
Generic filter that has one input.
int vtkTypeBool
Definition: vtkABI.h:69
#define VTK_IMAGE_BLEND_MODE_NORMAL
#define VTK_IMAGE_BLEND_MODE_COMPOUND