VTK  9.5.2
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
48#define VTK_ATTRIBUTE_MODE_DEFAULT 0
49#define VTK_ATTRIBUTE_MODE_USE_POINT_DATA 1
50#define VTK_ATTRIBUTE_MODE_USE_CELL_DATA 2
51
52// order / values are important because of the SetClampMacro
53#define VTK_COMPONENT_MODE_USE_SELECTED 0
54#define VTK_COMPONENT_MODE_USE_ALL 1
55#define VTK_COMPONENT_MODE_USE_ANY 2
56
57VTK_ABI_NAMESPACE_BEGIN
58class vtkDataArray;
59class vtkIdList;
60
61class VTKFILTERSCORE_EXPORT vtkThreshold : public vtkUnstructuredGridAlgorithm
62{
63public:
64 static vtkThreshold* New();
66 void PrintSelf(ostream& os, vtkIndent indent) override;
67
80
82
86 void SetThresholdFunction(int function);
89
91
95 vtkSetMacro(UpperThreshold, double);
96 vtkSetMacro(LowerThreshold, double);
97 vtkGetMacro(UpperThreshold, double);
98 vtkGetMacro(LowerThreshold, double);
100
102
111 vtkGetMacro(ComponentMode, int);
117
119
125 vtkSetClampMacro(SelectedComponent, int, 0, VTK_INT_MAX);
126 vtkGetMacro(SelectedComponent, int);
128
130
136 vtkSetMacro(AllScalars, vtkTypeBool);
137 vtkGetMacro(AllScalars, vtkTypeBool);
138 vtkBooleanMacro(AllScalars, vtkTypeBool);
140
142
154
156
161 vtkSetMacro(Invert, bool);
162 vtkGetMacro(Invert, bool);
163 vtkBooleanMacro(Invert, bool);
165
167
172 vtkSetMacro(OutputPointsPrecision, int);
173 vtkGetMacro(OutputPointsPrecision, int);
175
177
190 int Lower(double s) const;
191 int Upper(double s) const;
192 int Between(double s) const;
194protected:
196 ~vtkThreshold() override;
197
198 // Usual data generation method
200
201 int FillInputPortInformation(int port, vtkInformation* info) override;
202
207 bool Invert = false;
212
214
215 template <typename TScalarArray>
217 struct EvaluateCellsWorker;
218
219 template <typename TScalarsArray>
220 int EvaluateComponents(TScalarsArray& scalars, vtkIdType id);
221 template <typename TScalarsArray>
222 int EvaluateCell(TScalarsArray& scalars, const vtkIdType* cellPts, vtkIdType numCellPts);
223 template <typename TScalarsArray>
224 int EvaluateCell(TScalarsArray& scalars, int c, const vtkIdType* cellPts, vtkIdType numCellPts);
225
226private:
232 template <typename TScalarsArray>
233 bool ComputeMagnitude(double& magnitude, const TScalarsArray& scalars, vtkIdType id);
234
235 vtkThreshold(const vtkThreshold&) = delete;
236 void operator=(const vtkThreshold&) = delete;
237
238 int NumberOfComponents;
239};
240
241VTK_ABI_NAMESPACE_END
242#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:332
#define VTK_INT_MAX
Definition vtkType.h:161