VTK  9.7.1
vtkImageBinaryThreshold.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
18 #ifndef vtkImageBinaryThreshold_h
19 #define vtkImageBinaryThreshold_h
20 
21 #include "vtkImagingCoreModule.h" // For export macro
23 
24 VTK_ABI_NAMESPACE_BEGIN
25 
26 class VTKIMAGINGCORE_EXPORT vtkImageBinaryThreshold : public vtkThreadedImageAlgorithm
27 {
28 public:
29  static vtkImageBinaryThreshold* New();
31  void PrintSelf(ostream& os, vtkIndent indent) override;
32 
34 
38  vtkSetMacro(ReplaceIn, bool);
39  vtkGetMacro(ReplaceIn, bool);
40  vtkBooleanMacro(ReplaceIn, bool);
42 
44 
48  vtkSetMacro(InValue, double);
49  vtkGetMacro(InValue, double);
51 
53 
57  vtkSetMacro(ReplaceOut, bool);
58  vtkGetMacro(ReplaceOut, bool);
59  vtkBooleanMacro(ReplaceOut, bool);
61 
63 
67  vtkSetMacro(OutValue, double);
68  vtkGetMacro(OutValue, double);
70 
72 
76  vtkSetMacro(UpperThreshold, double);
77  vtkGetMacro(UpperThreshold, double);
79 
81 
85  vtkSetMacro(LowerThreshold, double);
86  vtkGetMacro(LowerThreshold, double);
88 
100  {
101  THRESHOLD_BETWEEN = 0,
104  };
105 
107 
111  vtkSetMacro(ThresholdFunction, int);
112  vtkGetMacro(ThresholdFunction, int);
114 
116 
122  vtkSetMacro(OutputScalarType, int);
123  vtkGetMacro(OutputScalarType, int);
124  void SetOutputScalarTypeToDouble() { this->SetOutputScalarType(VTK_DOUBLE); }
125  void SetOutputScalarTypeToFloat() { this->SetOutputScalarType(VTK_FLOAT); }
126  void SetOutputScalarTypeToLong() { this->SetOutputScalarType(VTK_LONG); }
127  void SetOutputScalarTypeToUnsignedLong() { this->SetOutputScalarType(VTK_UNSIGNED_LONG); }
128  void SetOutputScalarTypeToInt() { this->SetOutputScalarType(VTK_INT); }
129  void SetOutputScalarTypeToUnsignedInt() { this->SetOutputScalarType(VTK_UNSIGNED_INT); }
130  void SetOutputScalarTypeToShort() { this->SetOutputScalarType(VTK_SHORT); }
131  void SetOutputScalarTypeToUnsignedShort() { this->SetOutputScalarType(VTK_UNSIGNED_SHORT); }
132  void SetOutputScalarTypeToChar() { this->SetOutputScalarType(VTK_CHAR); }
133  void SetOutputScalarTypeToSignedChar() { this->SetOutputScalarType(VTK_SIGNED_CHAR); }
134  void SetOutputScalarTypeToUnsignedChar() { this->SetOutputScalarType(VTK_UNSIGNED_CHAR); }
136 
137 protected:
138  vtkImageBinaryThreshold() = default;
139  ~vtkImageBinaryThreshold() override = default;
140 
146 
153  void ThreadedRequestData(vtkInformation* request, vtkInformationVector** inputVector,
154  vtkInformationVector* outputVector, vtkImageData*** inData, vtkImageData** outData,
155  VTK_FUTURE_CONST int outExt[6], int id) override;
156 
157 private:
159  void operator=(const vtkImageBinaryThreshold&) = delete;
160 
161  int ThresholdFunction = ThresholdFunction::THRESHOLD_BETWEEN;
162  double UpperThreshold = VTK_FLOAT_MAX;
163  double LowerThreshold = VTK_FLOAT_MIN;
164  bool ReplaceIn = false;
165  double InValue = 0.0;
166  bool ReplaceOut = false;
167  double OutValue = 0.0;
168 
169  int OutputScalarType = -1; // invalid; output same as input
170 };
171 
172 VTK_ABI_NAMESPACE_END
173 #endif // vtkImageBinaryThreshold_h
#define VTK_UNSIGNED_INT
Definition: vtkType.h:40
Store vtkAlgorithm input/output information.
#define VTK_UNSIGNED_SHORT
Definition: vtkType.h:38
vtkImageBinaryThreshold is an image thresholding algorithm that allows users to replace pixel data by...
void SetOutputScalarTypeToLong()
Set the desired output scalar type to cast to.
#define VTK_DOUBLE
Definition: vtkType.h:44
Generic filter that has one input.
#define VTK_FLOAT
Definition: vtkType.h:43
void SetOutputScalarTypeToSignedChar()
Set the desired output scalar type to cast to.
#define VTK_FLOAT_MAX
Definition: vtkType.h:200
a simple class to control print indentation
Definition: vtkIndent.h:28
topologically and geometrically regular array of data
Definition: vtkImageData.h:45
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:37
#define VTK_CHAR
Definition: vtkType.h:34
#define VTK_LONG
Definition: vtkType.h:41
void SetOutputScalarTypeToDouble()
Set the desired output scalar type to cast to.
void SetOutputScalarTypeToShort()
Set the desired output scalar type to cast to.
virtual void ThreadedRequestData(vtkInformation *request, vtkInformationVector **inputVector, vtkInformationVector *outputVector, vtkImageData ***inData, vtkImageData **outData, VTK_FUTURE_CONST 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 SetOutputScalarTypeToChar()
Set the desired output scalar type to cast to.
void SetOutputScalarTypeToUnsignedLong()
Set the desired output scalar type to cast to.
#define VTK_SIGNED_CHAR
Definition: vtkType.h:35
void SetOutputScalarTypeToUnsignedInt()
Set the desired output scalar type to cast to.
void SetOutputScalarTypeToUnsignedChar()
Set the desired output scalar type to cast to.
#define VTK_UNSIGNED_CHAR
Definition: vtkType.h:36
void SetOutputScalarTypeToInt()
Set the desired output scalar type to cast to.
void SetOutputScalarTypeToFloat()
Set the desired output scalar type to cast to.
ThresholdFunction
Describe the behavior of the threshold:
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:42
void SetOutputScalarTypeToUnsignedShort()
Set the desired output scalar type to cast to.
#define VTK_INT
Definition: vtkType.h:39
#define VTK_FLOAT_MIN
Definition: vtkType.h:199