VTK  9.2.6
vtkImageStencil.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkImageStencil.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 =========================================================================*/
26 #ifndef vtkImageStencil_h
27 #define vtkImageStencil_h
28 
29 #include "vtkImagingStencilModule.h" // For export macro
31 
33 
34 class VTKIMAGINGSTENCIL_EXPORT vtkImageStencil : public vtkThreadedImageAlgorithm
35 {
36 public:
37  static vtkImageStencil* New();
39  void PrintSelf(ostream& os, vtkIndent indent) override;
40 
42 
47  virtual void SetStencilData(vtkImageStencilData* stencil);
48  vtkImageStencilData* GetStencil();
50 
55  {
56  this->SetInputConnection(2, outputPort);
57  }
58 
60 
63  vtkSetMacro(ReverseStencil, vtkTypeBool);
64  vtkBooleanMacro(ReverseStencil, vtkTypeBool);
65  vtkGetMacro(ReverseStencil, vtkTypeBool);
67 
69 
74  virtual void SetBackgroundInputData(vtkImageData* input);
75  vtkImageData* GetBackgroundInput();
77 
79 
82  void SetBackgroundValue(double val) { this->SetBackgroundColor(val, val, val, val); }
83  double GetBackgroundValue() { return this->BackgroundColor[0]; }
85 
87 
91  vtkSetVector4Macro(BackgroundColor, double);
92  vtkGetVector4Macro(BackgroundColor, double);
94 
95 protected:
97  ~vtkImageStencil() override;
98 
99  void ThreadedRequestData(vtkInformation* request, vtkInformationVector** inputVector,
100  vtkInformationVector* outputVector, vtkImageData*** inData, vtkImageData** outData,
101  int extent[6], int id) override;
102 
104  double BackgroundColor[4];
105 
106  int FillInputPortInformation(int, vtkInformation*) override;
107 
108 private:
109  vtkImageStencil(const vtkImageStencil&) = delete;
110  void operator=(const vtkImageStencil&) = delete;
111 };
112 
113 #endif
Store vtkAlgorithm input/output information.
Proxy object to connect input/output ports.
int vtkTypeBool
Definition: vtkABI.h:69
Generic filter that has one input.
a simple class to control print indentation
Definition: vtkIndent.h:39
efficient description of an image stencil
topologically and geometrically regular array of data
Definition: vtkImageData.h:53
void SetBackgroundValue(double val)
Set the default output value to use when the second input is not set.
virtual void SetInputConnection(int port, vtkAlgorithmOutput *input)
Set the connection for the given input port index.
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.
vtkTypeBool ReverseStencil
combine images via a cookie-cutter operation
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.
void SetStencilConnection(vtkAlgorithmOutput *outputPort)
Specify the stencil to use.
double GetBackgroundValue()
Set the default output value to use when the second input is not set.