VTK  9.3.1
vtkImageThreshold.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
15 #ifndef vtkImageThreshold_h
16 #define vtkImageThreshold_h
17 
18 #include "vtkImagingCoreModule.h" // For export macro
20 
21 VTK_ABI_NAMESPACE_BEGIN
22 class VTKIMAGINGCORE_EXPORT vtkImageThreshold : public vtkThreadedImageAlgorithm
23 {
24 public:
25  static vtkImageThreshold* New();
27  void PrintSelf(ostream& os, vtkIndent indent) override;
28 
32  void ThresholdByUpper(double thresh);
33 
37  void ThresholdByLower(double thresh);
38 
42  void ThresholdBetween(double lower, double upper);
43 
45 
48  vtkSetMacro(ReplaceIn, vtkTypeBool);
49  vtkGetMacro(ReplaceIn, vtkTypeBool);
50  vtkBooleanMacro(ReplaceIn, vtkTypeBool);
52 
54 
57  void SetInValue(double val);
58  vtkGetMacro(InValue, double);
60 
62 
65  vtkSetMacro(ReplaceOut, vtkTypeBool);
66  vtkGetMacro(ReplaceOut, vtkTypeBool);
67  vtkBooleanMacro(ReplaceOut, vtkTypeBool);
69 
71 
74  void SetOutValue(double val);
75  vtkGetMacro(OutValue, double);
77 
79 
82  vtkGetMacro(UpperThreshold, double);
83  vtkGetMacro(LowerThreshold, double);
85 
87 
90  vtkSetMacro(OutputScalarType, int);
91  vtkGetMacro(OutputScalarType, int);
92  void SetOutputScalarTypeToDouble() { this->SetOutputScalarType(VTK_DOUBLE); }
93  void SetOutputScalarTypeToFloat() { this->SetOutputScalarType(VTK_FLOAT); }
94  void SetOutputScalarTypeToLong() { this->SetOutputScalarType(VTK_LONG); }
95  void SetOutputScalarTypeToUnsignedLong() { this->SetOutputScalarType(VTK_UNSIGNED_LONG); }
96  void SetOutputScalarTypeToInt() { this->SetOutputScalarType(VTK_INT); }
97  void SetOutputScalarTypeToUnsignedInt() { this->SetOutputScalarType(VTK_UNSIGNED_INT); }
98  void SetOutputScalarTypeToShort() { this->SetOutputScalarType(VTK_SHORT); }
99  void SetOutputScalarTypeToUnsignedShort() { this->SetOutputScalarType(VTK_UNSIGNED_SHORT); }
100  void SetOutputScalarTypeToChar() { this->SetOutputScalarType(VTK_CHAR); }
101  void SetOutputScalarTypeToSignedChar() { this->SetOutputScalarType(VTK_SIGNED_CHAR); }
102  void SetOutputScalarTypeToUnsignedChar() { this->SetOutputScalarType(VTK_UNSIGNED_CHAR); }
104 
105 protected:
107  ~vtkImageThreshold() override = default;
108 
112  double InValue;
114  double OutValue;
115 
117 
119 
120  void ThreadedRequestData(vtkInformation* request, vtkInformationVector** inputVector,
121  vtkInformationVector* outputVector, vtkImageData*** inData, vtkImageData** outData,
122  int outExt[6], int id) override;
123 
124 private:
125  vtkImageThreshold(const vtkImageThreshold&) = delete;
126  void operator=(const vtkImageThreshold&) = delete;
127 };
128 
129 VTK_ABI_NAMESPACE_END
130 #endif
#define VTK_UNSIGNED_INT
Definition: vtkType.h:39
void SetOutputScalarTypeToChar()
Set the desired output scalar type to cast to.
void SetOutputScalarTypeToUnsignedChar()
Set the desired output scalar type to cast to.
Store vtkAlgorithm input/output information.
#define VTK_UNSIGNED_SHORT
Definition: vtkType.h:37
void SetOutputScalarTypeToSignedChar()
Set the desired output scalar type to cast to.
void SetOutputScalarTypeToInt()
Set the desired output scalar type to cast to.
Flexible threshold.
int vtkTypeBool
Definition: vtkABI.h:64
#define VTK_DOUBLE
Definition: vtkType.h:43
Generic filter that has one input.
#define VTK_FLOAT
Definition: vtkType.h:42
a simple class to control print indentation
Definition: vtkIndent.h:28
topologically and geometrically regular array of data
Definition: vtkImageData.h:42
virtual int RequestInformation(vtkInformation *request, vtkInformationVector **inputVector, vtkInformationVector *outputVector)
Subclasses can reimplement this method to collect information from their inputs and set information f...
#define VTK_SHORT
Definition: vtkType.h:36
void SetOutputScalarTypeToFloat()
Set the desired output scalar type to cast to.
#define VTK_CHAR
Definition: vtkType.h:33
#define VTK_LONG
Definition: vtkType.h:40
void SetOutputScalarTypeToDouble()
Set the desired output scalar type to cast to.
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.
void SetOutputScalarTypeToUnsignedInt()
Set the desired output scalar type to cast to.
void SetOutputScalarTypeToLong()
Set the desired output scalar type to cast to.
#define VTK_SIGNED_CHAR
Definition: vtkType.h:34
#define VTK_UNSIGNED_CHAR
Definition: vtkType.h:35
void SetOutputScalarTypeToUnsignedShort()
Set the desired output scalar type to cast to.
void SetOutputScalarTypeToShort()
Set the desired output scalar type to cast to.
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.
#define VTK_UNSIGNED_LONG
Definition: vtkType.h:41
#define VTK_INT
Definition: vtkType.h:38
void SetOutputScalarTypeToUnsignedLong()
Set the desired output scalar type to cast to.