VTK  9.6.1
vtkThreshold.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
41
42#ifndef vtkThreshold_h
43#define vtkThreshold_h
44
45#include "vtkFiltersCoreModule.h" // For export macro
47#include "vtkWrappingHints.h" // For VTK_MARSHALAUTO
48
49#define VTK_ATTRIBUTE_MODE_DEFAULT 0
50#define VTK_ATTRIBUTE_MODE_USE_POINT_DATA 1
51#define VTK_ATTRIBUTE_MODE_USE_CELL_DATA 2
52
53// order / values are important because of the SetClampMacro
54#define VTK_COMPONENT_MODE_USE_SELECTED 0
55#define VTK_COMPONENT_MODE_USE_ALL 1
56#define VTK_COMPONENT_MODE_USE_ANY 2
57
58VTK_ABI_NAMESPACE_BEGIN
59class vtkDataArray;
60class vtkIdList;
61
62class VTKFILTERSCORE_EXPORT VTK_MARSHALAUTO vtkThreshold : public vtkUnstructuredGridAlgorithm
63{
64public:
65 static vtkThreshold* New();
67 void PrintSelf(ostream& os, vtkIndent indent) override;
68
81
83
87 void SetThresholdFunction(int function);
90
92
96 vtkSetMacro(UpperThreshold, double);
97 vtkSetMacro(LowerThreshold, double);
98 vtkGetMacro(UpperThreshold, double);
99 vtkGetMacro(LowerThreshold, double);
101
103
112 vtkGetMacro(ComponentMode, int);
118
120
126 vtkSetClampMacro(SelectedComponent, int, 0, VTK_INT_MAX);
127 vtkGetMacro(SelectedComponent, int);
129
131
137 vtkSetMacro(AllScalars, vtkTypeBool);
138 vtkGetMacro(AllScalars, vtkTypeBool);
139 vtkBooleanMacro(AllScalars, vtkTypeBool);
141
143
155
157
162 vtkSetMacro(Invert, bool);
163 vtkGetMacro(Invert, bool);
164 vtkBooleanMacro(Invert, bool);
166
168
173 vtkSetMacro(OutputPointsPrecision, int);
174 vtkGetMacro(OutputPointsPrecision, int);
176
178
191 int Lower(double s) const;
192 int Upper(double s) const;
193 int Between(double s) const;
195protected:
197 ~vtkThreshold() override;
198
199 // Usual data generation method
201
202 int FillInputPortInformation(int port, vtkInformation* info) override;
203
208 bool Invert = false;
213
214 int (vtkThreshold::*ThresholdFunction)(double s) const = &vtkThreshold::Between;
215
216 template <typename TScalarArray>
218 struct EvaluateCellsWorker;
219
220 template <typename TScalarsArray>
221 int EvaluateComponents(TScalarsArray& scalars, vtkIdType id);
222 template <typename TScalarsArray>
223 int EvaluateCell(TScalarsArray& scalars, const vtkIdType* cellPts, vtkIdType numCellPts);
224 template <typename TScalarsArray>
225 int EvaluateCell(TScalarsArray& scalars, int c, const vtkIdType* cellPts, vtkIdType numCellPts);
226
227private:
233 template <typename TScalarsArray>
234 bool ComputeMagnitude(double& magnitude, const TScalarsArray& scalars, vtkIdType id);
235
236 vtkThreshold(const vtkThreshold&) = delete;
237 void operator=(const vtkThreshold&) = delete;
238
239 int NumberOfComponents;
240};
241
242VTK_ABI_NAMESPACE_END
243#endif
list of point or cell ids
Definition vtkIdList.h:24
a simple class to control print indentation
Definition vtkIndent.h:29
Store zero or more vtkInformation instances.
Store vtkAlgorithm input/output information.
int(vtkThreshold::* ThresholdFunction)(double s) const
virtual void SetComponentMode(int)
Control how the decision of in / out is made with multi-component data.
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
vtkTypeBool AllScalars
int EvaluateCell(TScalarsArray &scalars, const vtkIdType *cellPts, vtkIdType numCellPts)
void SetThresholdFunction(int function)
Get/Set the threshold method, defining which threshold bounds to use.
void SetComponentModeToUseSelected()
Control how the decision of in / out is made with multi-component data.
void SetComponentModeToUseAny()
Control how the decision of in / out is made with multi-component data.
ThresholdType
Possible values for the threshold function:
void SetComponentModeToUseAll()
Control how the decision of in / out is made with multi-component data.
double LowerThreshold
const char * GetComponentModeAsString()
Control how the decision of in / out is made with multi-component data.
int FillInputPortInformation(int port, vtkInformation *info) override
int EvaluateComponents(TScalarsArray &scalars, vtkIdType id)
double UpperThreshold
int Upper(double s) const
Methods used for thresholding.
~vtkThreshold() override
int Between(double s) const
Methods used for thresholding.
int Lower(double s) const
Methods used for thresholding.
int EvaluateCell(TScalarsArray &scalars, int c, const vtkIdType *cellPts, vtkIdType numCellPts)
int GetThresholdFunction()
Get/Set the threshold method, defining which threshold bounds to use.
vtkTypeBool UseContinuousCellRange
int RequestData(vtkInformation *, vtkInformationVector **, vtkInformationVector *) override
This is called by the superclass.
int OutputPointsPrecision
static vtkThreshold * New()
int vtkTypeBool
Definition vtkABI.h:64
#define vtkDataArray
#define VTK_COMPONENT_MODE_USE_SELECTED
#define VTK_COMPONENT_MODE_USE_ALL
#define VTK_COMPONENT_MODE_USE_ANY
int vtkIdType
Definition vtkType.h:368
#define VTK_INT_MAX
Definition vtkType.h:197
#define VTK_MARSHALAUTO
#define vtkThreshold