VTK  9.1.0
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 =========================================================================*/
155 #ifndef vtkImageBlend_h
156 #define vtkImageBlend_h
157 
158 #include "vtkImagingCoreModule.h" // For export macro
160 
161 class vtkImageStencilData;
162 
163 #define VTK_IMAGE_BLEND_MODE_NORMAL 0
164 #define VTK_IMAGE_BLEND_MODE_COMPOUND 1
165 
166 class VTKIMAGINGCORE_EXPORT vtkImageBlend : public vtkThreadedImageAlgorithm
167 {
168 public:
169  static vtkImageBlend* New();
171  void PrintSelf(ostream& os, vtkIndent indent) override;
172 
179  virtual void ReplaceNthInputConnection(int idx, vtkAlgorithmOutput* input);
180 
182 
187  void SetInputData(int num, vtkDataObject* input);
188  void SetInputData(vtkDataObject* input) { this->SetInputData(0, input); }
190 
192 
198  vtkDataObject* GetInput() { return this->GetInput(0); }
200 
207 
209 
213  void SetOpacity(int idx, double opacity);
214  double GetOpacity(int idx);
216 
222 
224 
230 
232 
235  vtkSetClampMacro(BlendMode, int, VTK_IMAGE_BLEND_MODE_NORMAL, VTK_IMAGE_BLEND_MODE_COMPOUND);
236  vtkGetMacro(BlendMode, int);
237  void SetBlendModeToNormal() { this->SetBlendMode(VTK_IMAGE_BLEND_MODE_NORMAL); }
239  const char* GetBlendModeAsString(void);
241 
243 
247  vtkSetMacro(CompoundThreshold, double);
248  vtkGetMacro(CompoundThreshold, double);
250 
252 
257  vtkSetMacro(CompoundAlpha, vtkTypeBool);
258  vtkGetMacro(CompoundAlpha, vtkTypeBool);
259  vtkBooleanMacro(CompoundAlpha, vtkTypeBool);
261 
262 protected:
264  ~vtkImageBlend() override;
265 
267 
268  void InternalComputeInputUpdateExtent(int inExt[6], int outExt[6], int inWExtent[6]);
269 
271  vtkInformationVector* outputVector, vtkImageData*** inData, vtkImageData** outData, int ext[6],
272  int id) override;
273 
274  // see vtkAlgorithm for docs.
276 
277  // see vtkAlgorithm for docs.
278  int RequestData(vtkInformation* request, vtkInformationVector** inputVector,
279  vtkInformationVector* outputVector) override;
280 
281  double* Opacity;
287 
288 private:
289  vtkImageBlend(const vtkImageBlend&) = delete;
290  void operator=(const vtkImageBlend&) = delete;
291 };
292 
297 {
298  switch (this->BlendMode)
299  {
301  return "Normal";
303  return "Compound";
304  default:
305  return "Unknown Blend Mode";
306  }
307 }
308 
309 #endif
vtkImageBlend::DataWasPassed
int DataWasPassed
Definition: vtkImageBlend.h:285
vtkImageBlend::BlendMode
int BlendMode
Definition: vtkImageBlend.h:283
vtkImageBlend::SetOpacity
void SetOpacity(int idx, double opacity)
Set the opacity of an input image: the alpha values of the image are multiplied by the opacity.
vtkImageBlend::ReplaceNthInputConnection
virtual void ReplaceNthInputConnection(int idx, vtkAlgorithmOutput *input)
Replace one of the input connections with a new input.
vtkImageBlend::SetInputData
void SetInputData(vtkDataObject *input)
Assign a data object as input.
Definition: vtkImageBlend.h:188
vtkImageBlend::SetBlendModeToCompound
void SetBlendModeToCompound()
Set the blend mode.
Definition: vtkImageBlend.h:238
vtkInformationVector
Store zero or more vtkInformation instances.
Definition: vtkInformationVector.h:145
vtkImageBlend::GetBlendModeAsString
const char * GetBlendModeAsString(void)
Get the blending mode as a descriptive string.
Definition: vtkImageBlend.h:296
VTK_IMAGE_BLEND_MODE_NORMAL
#define VTK_IMAGE_BLEND_MODE_NORMAL
Definition: vtkImageBlend.h:163
vtkImageBlend::~vtkImageBlend
~vtkImageBlend() override
VTK_IMAGE_BLEND_MODE_COMPOUND
#define VTK_IMAGE_BLEND_MODE_COMPOUND
Definition: vtkImageBlend.h:164
vtkThreadedImageAlgorithm
Generic filter that has one input.
Definition: vtkThreadedImageAlgorithm.h:39
vtkImageBlend::SetStencilData
void SetStencilData(vtkImageStencilData *stencil)
Set a stencil to apply when blending the data.
vtkImageBlend
blend images together using alpha or opacity
Definition: vtkImageBlend.h:167
vtkImageBlend::vtkImageBlend
vtkImageBlend()
vtkImageBlend::SetStencilConnection
void SetStencilConnection(vtkAlgorithmOutput *algOutput)
Set a stencil to apply when blending the data.
vtkImageBlend::OpacityArrayLength
int OpacityArrayLength
Definition: vtkImageBlend.h:282
vtkThreadedImageAlgorithm.h
vtkImageBlend::SetBlendModeToNormal
void SetBlendModeToNormal()
Set the blend mode.
Definition: vtkImageBlend.h:237
vtkImageBlend::RequestData
int RequestData(vtkInformation *request, vtkInformationVector **inputVector, vtkInformationVector *outputVector) override
This is called by the superclass.
vtkImageBlend::Opacity
double * Opacity
Definition: vtkImageBlend.h:281
vtkImageBlend::GetInput
vtkDataObject * GetInput(int num)
Get one input to this filter.
vtkImageBlend::ThreadedRequestData
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::New
static vtkImageBlend * New()
vtkImageBlend::FillInputPortInformation
int FillInputPortInformation(int, vtkInformation *) override
These method should be reimplemented by subclasses that have more than a single input or single outpu...
vtkImageBlend::RequestUpdateExtent
int RequestUpdateExtent(vtkInformation *, vtkInformationVector **, vtkInformationVector *) override
Subclasses can reimplement this method to translate the update extent requests from each output port ...
vtkImageData
topologically and geometrically regular array of data
Definition: vtkImageData.h:157
vtkIndent
a simple class to control print indentation
Definition: vtkIndent.h:113
vtkImageBlend::SetInputData
void SetInputData(int num, vtkDataObject *input)
Assign a data object as input.
vtkInformation
Store vtkAlgorithm input/output information.
Definition: vtkInformation.h:183
vtkImageBlend::GetStencil
vtkImageStencilData * GetStencil()
Set a stencil to apply when blending the data.
vtkImageBlend::GetInput
vtkDataObject * GetInput()
Get one input to this filter.
Definition: vtkImageBlend.h:198
vtkImageBlend::GetOpacity
double GetOpacity(int idx)
Set the opacity of an input image: the alpha values of the image are multiplied by the opacity.
vtkAlgorithmOutput
Proxy object to connect input/output ports.
Definition: vtkAlgorithmOutput.h:66
vtkImageStencilData
efficient description of an image stencil
Definition: vtkImageStencilData.h:53
vtkImageBlend::GetNumberOfInputs
int GetNumberOfInputs()
Get the number of inputs to this filter.
Definition: vtkImageBlend.h:206
vtkImageBlend::PrintSelf
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
vtkAlgorithm::GetNumberOfInputConnections
int GetNumberOfInputConnections(int port)
Get the number of inputs currently connected to a port.
vtkDataObject
general representation of visualization data
Definition: vtkDataObject.h:169
vtkImageBlend::CompoundThreshold
double CompoundThreshold
Definition: vtkImageBlend.h:284
vtkTypeBool
int vtkTypeBool
Definition: vtkABI.h:69
vtkImageBlend::InternalComputeInputUpdateExtent
void InternalComputeInputUpdateExtent(int inExt[6], int outExt[6], int inWExtent[6])
vtkImageBlend::CompoundAlpha
vtkTypeBool CompoundAlpha
Definition: vtkImageBlend.h:286