VTK  9.0.1
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 =========================================================================*/
76 #ifndef vtkImageBlend_h
77 #define vtkImageBlend_h
78 
79 #include "vtkImagingCoreModule.h" // For export macro
81 
83 
84 #define VTK_IMAGE_BLEND_MODE_NORMAL 0
85 #define VTK_IMAGE_BLEND_MODE_COMPOUND 1
86 
87 class VTKIMAGINGCORE_EXPORT vtkImageBlend : public vtkThreadedImageAlgorithm
88 {
89 public:
90  static vtkImageBlend* New();
92  void PrintSelf(ostream& os, vtkIndent indent) override;
93 
100  virtual void ReplaceNthInputConnection(int idx, vtkAlgorithmOutput* input);
101 
103 
108  void SetInputData(int num, vtkDataObject* input);
109  void SetInputData(vtkDataObject* input) { this->SetInputData(0, input); }
111 
113 
118  vtkDataObject* GetInput(int num);
119  vtkDataObject* GetInput() { return this->GetInput(0); }
121 
128 
130 
134  void SetOpacity(int idx, double opacity);
135  double GetOpacity(int idx);
137 
142  void SetStencilConnection(vtkAlgorithmOutput* algOutput);
143 
145 
148  void SetStencilData(vtkImageStencilData* stencil);
149  vtkImageStencilData* GetStencil();
151 
153 
156  vtkSetClampMacro(BlendMode, int, VTK_IMAGE_BLEND_MODE_NORMAL, VTK_IMAGE_BLEND_MODE_COMPOUND);
157  vtkGetMacro(BlendMode, int);
158  void SetBlendModeToNormal() { this->SetBlendMode(VTK_IMAGE_BLEND_MODE_NORMAL); }
160  const char* GetBlendModeAsString(void);
162 
164 
168  vtkSetMacro(CompoundThreshold, double);
169  vtkGetMacro(CompoundThreshold, double);
171 
173 
178  vtkSetMacro(CompoundAlpha, vtkTypeBool);
179  vtkGetMacro(CompoundAlpha, vtkTypeBool);
180  vtkBooleanMacro(CompoundAlpha, vtkTypeBool);
182 
183 protected:
184  vtkImageBlend();
185  ~vtkImageBlend() override;
186 
188 
189  void InternalComputeInputUpdateExtent(int inExt[6], int outExt[6], int inWExtent[6]);
190 
191  void ThreadedRequestData(vtkInformation* request, vtkInformationVector** inputVector,
192  vtkInformationVector* outputVector, vtkImageData*** inData, vtkImageData** outData, int ext[6],
193  int id) override;
194 
195  // see vtkAlgorithm for docs.
196  int FillInputPortInformation(int, vtkInformation*) override;
197 
198  // see vtkAlgorithm for docs.
199  int RequestData(vtkInformation* request, vtkInformationVector** inputVector,
200  vtkInformationVector* outputVector) override;
201 
202  double* Opacity;
208 
209 private:
210  vtkImageBlend(const vtkImageBlend&) = delete;
211  void operator=(const vtkImageBlend&) = delete;
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 #endif
vtkThreadedImageAlgorithm::ThreadedRequestData
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,...
vtkImageBlend::DataWasPassed
int DataWasPassed
Definition: vtkImageBlend.h:206
vtkImageBlend::BlendMode
int BlendMode
Definition: vtkImageBlend.h:204
vtkImageBlend::SetInputData
void SetInputData(vtkDataObject *input)
Definition: vtkImageBlend.h:109
vtkImageBlend::SetBlendModeToCompound
void SetBlendModeToCompound()
Definition: vtkImageBlend.h:159
vtkInformationVector
Store zero or more vtkInformation instances.
Definition: vtkInformationVector.h:35
vtkImageBlend::GetBlendModeAsString
const char * GetBlendModeAsString(void)
Get the blending mode as a descriptive string.
Definition: vtkImageBlend.h:218
VTK_IMAGE_BLEND_MODE_NORMAL
#define VTK_IMAGE_BLEND_MODE_NORMAL
Definition: vtkImageBlend.h:84
VTK_IMAGE_BLEND_MODE_COMPOUND
#define VTK_IMAGE_BLEND_MODE_COMPOUND
Definition: vtkImageBlend.h:85
vtkThreadedImageAlgorithm
Generic filter that has one input.
Definition: vtkThreadedImageAlgorithm.h:37
vtkImageBlend
blend images together using alpha or opacity
Definition: vtkImageBlend.h:87
vtkImageBlend::OpacityArrayLength
int OpacityArrayLength
Definition: vtkImageBlend.h:203
vtkImageAlgorithm::GetInput
vtkDataObject * GetInput()
Definition: vtkImageAlgorithm.h:77
vtkThreadedImageAlgorithm.h
vtkImageBlend::SetBlendModeToNormal
void SetBlendModeToNormal()
Definition: vtkImageBlend.h:158
vtkImageBlend::Opacity
double * Opacity
Definition: vtkImageBlend.h:202
vtkImageAlgorithm::SetInputData
void SetInputData(vtkDataObject *)
Assign a data object as input.
vtkImageAlgorithm::RequestUpdateExtent
virtual int RequestUpdateExtent(vtkInformation *, vtkInformationVector **, vtkInformationVector *)
Subclasses can reimplement this method to translate the update extent requests from each output port ...
vtkThreadedImageAlgorithm::PrintSelf
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
vtkImageData
topologically and geometrically regular array of data
Definition: vtkImageData.h:41
vtkIndent
a simple class to control print indentation
Definition: vtkIndent.h:33
vtkInformation
Store vtkAlgorithm input/output information.
Definition: vtkInformation.h:73
vtkImageBlend::GetInput
vtkDataObject * GetInput()
Definition: vtkImageBlend.h:119
vtkAlgorithm::New
static vtkAlgorithm * New()
vtkAlgorithmOutput
Proxy object to connect input/output ports.
Definition: vtkAlgorithmOutput.h:36
vtkImageStencilData
efficient description of an image stencil
Definition: vtkImageStencilData.h:33
vtkImageBlend::GetNumberOfInputs
int GetNumberOfInputs()
Get the number of inputs to this filter.
Definition: vtkImageBlend.h:127
vtkAlgorithm::GetNumberOfInputConnections
int GetNumberOfInputConnections(int port)
Get the number of inputs currently connected to a port.
vtkImageAlgorithm::FillInputPortInformation
int FillInputPortInformation(int port, vtkInformation *info) override
Fill the input port information objects for this algorithm.
vtkDataObject
general representation of visualization data
Definition: vtkDataObject.h:59
vtkImageBlend::CompoundThreshold
double CompoundThreshold
Definition: vtkImageBlend.h:205
vtkThreadedImageAlgorithm::RequestData
int RequestData(vtkInformation *request, vtkInformationVector **inputVector, vtkInformationVector *outputVector) override
This is called by the superclass.
vtkTypeBool
int vtkTypeBool
Definition: vtkABI.h:69
vtkImageBlend::CompoundAlpha
vtkTypeBool CompoundAlpha
Definition: vtkImageBlend.h:207