VTK  9.3.1
vtkImageStencil.h
Go to the documentation of this file.
1 // SPDX-FileCopyrightText: Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
2 // SPDX-License-Identifier: BSD-3-Clause
14 #ifndef vtkImageStencil_h
15 #define vtkImageStencil_h
16 
17 #include "vtkImagingStencilModule.h" // For export macro
19 
20 VTK_ABI_NAMESPACE_BEGIN
22 
23 class VTKIMAGINGSTENCIL_EXPORT vtkImageStencil : public vtkThreadedImageAlgorithm
24 {
25 public:
26  static vtkImageStencil* New();
28  void PrintSelf(ostream& os, vtkIndent indent) override;
29 
31 
36  virtual void SetStencilData(vtkImageStencilData* stencil);
37  vtkImageStencilData* GetStencil();
39 
44  {
45  this->SetInputConnection(2, outputPort);
46  }
47 
49 
52  vtkSetMacro(ReverseStencil, vtkTypeBool);
53  vtkBooleanMacro(ReverseStencil, vtkTypeBool);
54  vtkGetMacro(ReverseStencil, vtkTypeBool);
56 
58 
63  virtual void SetBackgroundInputData(vtkImageData* input);
64  vtkImageData* GetBackgroundInput();
66 
68 
71  void SetBackgroundValue(double val) { this->SetBackgroundColor(val, val, val, val); }
72  double GetBackgroundValue() { return this->BackgroundColor[0]; }
74 
76 
80  vtkSetVector4Macro(BackgroundColor, double);
81  vtkGetVector4Macro(BackgroundColor, double);
83 
84 protected:
86  ~vtkImageStencil() override;
87 
88  void ThreadedRequestData(vtkInformation* request, vtkInformationVector** inputVector,
89  vtkInformationVector* outputVector, vtkImageData*** inData, vtkImageData** outData,
90  int extent[6], int id) override;
91 
93  double BackgroundColor[4];
94 
95  int FillInputPortInformation(int, vtkInformation*) override;
96 
97 private:
98  vtkImageStencil(const vtkImageStencil&) = delete;
99  void operator=(const vtkImageStencil&) = delete;
100 };
101 
102 VTK_ABI_NAMESPACE_END
103 #endif
Store vtkAlgorithm input/output information.
Proxy object to connect input/output ports.
int vtkTypeBool
Definition: vtkABI.h:64
Generic filter that has one input.
a simple class to control print indentation
Definition: vtkIndent.h:28
efficient description of an image stencil
topologically and geometrically regular array of data
Definition: vtkImageData.h:42
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.