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
150
151#ifndef vtkThreshold_h
152#define vtkThreshold_h
153
154#include "vtkFiltersCoreModule.h" // For export macro
156
157#define VTK_ATTRIBUTE_MODE_DEFAULT 0
158#define VTK_ATTRIBUTE_MODE_USE_POINT_DATA 1
159#define VTK_ATTRIBUTE_MODE_USE_CELL_DATA 2
160
161// order / values are important because of the SetClampMacro
162#define VTK_COMPONENT_MODE_USE_SELECTED 0
163#define VTK_COMPONENT_MODE_USE_ALL 1
164#define VTK_COMPONENT_MODE_USE_ANY 2
165
166VTK_ABI_NAMESPACE_BEGIN
167class vtkDataArray;
168class vtkIdList;
169
170class VTKFILTERSCORE_EXPORT vtkThreshold : public vtkUnstructuredGridAlgorithm
171{
172public:
173 static vtkThreshold* New();
175 void PrintSelf(ostream& os, vtkIndent indent) override;
176
189
191
195 void SetThresholdFunction(int function);
198
200
204 vtkSetMacro(UpperThreshold, double);
205 vtkSetMacro(LowerThreshold, double);
206 vtkGetMacro(UpperThreshold, double);
207 vtkGetMacro(LowerThreshold, double);
209
211
220 vtkGetMacro(ComponentMode, int);
226
228
234 vtkSetClampMacro(SelectedComponent, int, 0, VTK_INT_MAX);
235 vtkGetMacro(SelectedComponent, int);
237
239
245 vtkSetMacro(AllScalars, vtkTypeBool);
246 vtkGetMacro(AllScalars, vtkTypeBool);
247 vtkBooleanMacro(AllScalars, vtkTypeBool);
249
251
263
265
270 vtkSetMacro(Invert, bool);
271 vtkGetMacro(Invert, bool);
272 vtkBooleanMacro(Invert, bool);
274
276
281 vtkSetMacro(OutputPointsPrecision, int);
282 vtkGetMacro(OutputPointsPrecision, int);
284
286
299 int Lower(double s) const;
300 int Upper(double s) const;
301 int Between(double s) const;
303protected:
305 ~vtkThreshold() override;
306
307 // Usual data generation method
309
310 int FillInputPortInformation(int port, vtkInformation* info) override;
311
316 bool Invert = false;
321
323
324 template <typename TScalarArray>
326 struct EvaluateCellsWorker;
327
328 template <typename TScalarsArray>
329 int EvaluateComponents(TScalarsArray& scalars, vtkIdType id);
330 template <typename TScalarsArray>
331 int EvaluateCell(TScalarsArray& scalars, const vtkIdType* cellPts, vtkIdType numCellPts);
332 template <typename TScalarsArray>
333 int EvaluateCell(TScalarsArray& scalars, int c, const vtkIdType* cellPts, vtkIdType numCellPts);
334
335private:
341 template <typename TScalarsArray>
342 bool ComputeMagnitude(double& magnitude, const TScalarsArray& scalars, vtkIdType id);
343
344 vtkThreshold(const vtkThreshold&) = delete;
345 void operator=(const vtkThreshold&) = delete;
346
347 int NumberOfComponents;
348};
349
350VTK_ABI_NAMESPACE_END
351#endif
list of point or cell ids
Definition vtkIdList.h:133
a simple class to control print indentation
Definition vtkIndent.h:108
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