VTK  9.7.1
vtkThresholdPoints.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
19 #ifndef vtkThresholdPoints_h
20 #define vtkThresholdPoints_h
21 
22 #include "vtkDeprecation.h"
23 #include "vtkFiltersCoreModule.h" // For export macro
24 #include "vtkPolyDataAlgorithm.h"
25 #include "vtkWrappingHints.h" // For VTK_MARSHALAUTO
26 
27 VTK_ABI_NAMESPACE_BEGIN
28 class VTKFILTERSCORE_EXPORT VTK_MARSHALAUTO vtkThresholdPoints : public vtkPolyDataAlgorithm
29 {
30 public:
31  static vtkThresholdPoints* New();
33  void PrintSelf(ostream& os, vtkIndent indent) override;
34 
42  {
43  THRESHOLD_BETWEEN = 0,
45  THRESHOLD_UPPER
46  };
47 
49 
52  void SetThresholdFunction(int function);
53  int GetThresholdFunction();
55 
59  VTK_DEPRECATED_IN_9_6_0("Use 'SetLowerThreshold' and 'SetThresholdFunction' instead.")
60  void ThresholdByLower(double lower);
61 
65  VTK_DEPRECATED_IN_9_6_0("Use 'SetUpperThreshold' and 'SetThresholdFunction' instead.")
66  void ThresholdByUpper(double upper);
67 
73  "Use 'SetLowerThreshold', 'SetUpperThreshold' and 'SetThresholdFunction' instead.")
74  void ThresholdBetween(double lower, double upper);
75 
77 
81  vtkSetMacro(UpperThreshold, double);
82  vtkGetMacro(UpperThreshold, double);
83  vtkSetMacro(LowerThreshold, double);
84  vtkGetMacro(LowerThreshold, double);
86 
88 
92  vtkSetMacro(InputArrayComponent, int);
93  vtkGetMacro(InputArrayComponent, int);
95 
97 
102  vtkSetMacro(OutputPointsPrecision, int);
103  vtkGetMacro(OutputPointsPrecision, int);
105 
106 protected:
108  ~vtkThresholdPoints() override = default;
109 
110  // Usual data generation method
111  int RequestData(vtkInformation*, vtkInformationVector**, vtkInformationVector*) override;
112 
113  int FillInputPortInformation(int port, vtkInformation* info) override;
114 
115  double LowerThreshold = -std::numeric_limits<double>::infinity();
116  double UpperThreshold = std::numeric_limits<double>::infinity();
117  int InputArrayComponent = 0;
118  int OutputPointsPrecision = DEFAULT_PRECISION;
119 
120  int (vtkThresholdPoints::*ThresholdFunction)(double s) = &vtkThresholdPoints::Between;
121 
122  int Lower(double s) { return (s <= this->LowerThreshold ? 1 : 0); }
123  int Upper(double s) { return (s >= this->UpperThreshold ? 1 : 0); }
124  int Between(double s)
125  {
126  return ((s >= this->LowerThreshold && s <= this->UpperThreshold) ? 1 : 0);
127  }
128 
129 private:
130  vtkThresholdPoints(const vtkThresholdPoints&) = delete;
131  void operator=(const vtkThresholdPoints&) = delete;
132 };
133 
134 VTK_ABI_NAMESPACE_END
135 #endif
Store vtkAlgorithm input/output information.
static vtkPolyDataAlgorithm * New()
#define VTK_DEPRECATED_IN_9_6_0(reason)
Superclass for algorithms that produce only polydata as output.
a simple class to control print indentation
Definition: vtkIndent.h:28
ThresholdType
Possible values for the threshold function:
extracts points whose scalar value satisfies threshold criterion
Store zero or more vtkInformation instances.
#define VTK_MARSHALAUTO
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.