VTK  9.1.0
vtkThreshold.h
Go to the documentation of this file.
1/*=========================================================================
2
3 Program: Visualization Toolkit
4 Module: vtkThreshold.h
5
6 Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
7 All rights reserved.
8 See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
9
10 This software is distributed WITHOUT ANY WARRANTY; without even
11 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
12 PURPOSE. See the above copyright notice for more information.
13
14=========================================================================*/
146#ifndef vtkThreshold_h
147#define vtkThreshold_h
148
149#include "vtkDeprecation.h" // For VTK_DEPRECATED_IN_9_1_0
150#include "vtkFiltersCoreModule.h" // For export macro
152
153#define VTK_ATTRIBUTE_MODE_DEFAULT 0
154#define VTK_ATTRIBUTE_MODE_USE_POINT_DATA 1
155#define VTK_ATTRIBUTE_MODE_USE_CELL_DATA 2
156
157// order / values are important because of the SetClampMacro
158#define VTK_COMPONENT_MODE_USE_SELECTED 0
159#define VTK_COMPONENT_MODE_USE_ALL 1
160#define VTK_COMPONENT_MODE_USE_ANY 2
161
162class vtkDataArray;
163class vtkIdList;
164
165class VTKFILTERSCORE_EXPORT vtkThreshold : public vtkUnstructuredGridAlgorithm
166{
167public:
168 static vtkThreshold* New();
170 void PrintSelf(ostream& os, vtkIndent indent) override;
171
179 {
180 THRESHOLD_BETWEEN = 0,
182 THRESHOLD_UPPER
183 };
184
186
190 void SetThresholdFunction(int function);
193
197 VTK_DEPRECATED_IN_9_1_0("Use 'SetLowerThreshold' and 'SetThresholdFunction' instead.")
198 void ThresholdByLower(double lower);
199
203 VTK_DEPRECATED_IN_9_1_0("Use 'SetUpperThreshold' and 'SetThresholdFunction' instead.")
204 void ThresholdByUpper(double upper);
205
211 "Use 'SetLowerThreshold', 'SetUpperThreshold' and 'SetThresholdFunction' instead.")
212 void ThresholdBetween(double lower, double upper);
213
215
219 vtkSetMacro(UpperThreshold, double);
220 vtkSetMacro(LowerThreshold, double);
221 vtkGetMacro(UpperThreshold, double);
222 vtkGetMacro(LowerThreshold, double);
224
226
233 vtkSetMacro(AttributeMode, int);
234 vtkGetMacro(AttributeMode, int);
235 void SetAttributeModeToDefault() { this->SetAttributeMode(VTK_ATTRIBUTE_MODE_DEFAULT); }
237 {
238 this->SetAttributeMode(VTK_ATTRIBUTE_MODE_USE_POINT_DATA);
239 }
243
245
253 vtkSetClampMacro(ComponentMode, int, VTK_COMPONENT_MODE_USE_SELECTED, VTK_COMPONENT_MODE_USE_ANY);
254 vtkGetMacro(ComponentMode, int);
256 void SetComponentModeToUseAll() { this->SetComponentMode(VTK_COMPONENT_MODE_USE_ALL); }
257 void SetComponentModeToUseAny() { this->SetComponentMode(VTK_COMPONENT_MODE_USE_ANY); }
260
262
266 vtkSetClampMacro(SelectedComponent, int, 0, VTK_INT_MAX);
267 vtkGetMacro(SelectedComponent, int);
269
271
277 vtkSetMacro(AllScalars, vtkTypeBool);
278 vtkGetMacro(AllScalars, vtkTypeBool);
279 vtkBooleanMacro(AllScalars, vtkTypeBool);
281
283
291 vtkSetMacro(UseContinuousCellRange, vtkTypeBool);
292 vtkGetMacro(UseContinuousCellRange, vtkTypeBool);
293 vtkBooleanMacro(UseContinuousCellRange, vtkTypeBool);
295
297
304 void SetPointsDataTypeToDouble() { this->SetPointsDataType(VTK_DOUBLE); }
305 void SetPointsDataTypeToFloat() { this->SetPointsDataType(VTK_FLOAT); }
306 void SetPointsDataType(int type);
309
311
316 vtkSetMacro(Invert, bool);
317 vtkGetMacro(Invert, bool);
318 vtkBooleanMacro(Invert, bool);
320
322
327 void SetOutputPointsPrecision(int precision);
330
332
345 int Lower(double s) const;
346 int Upper(double s) const;
347 int Between(double s) const;
349protected:
351 ~vtkThreshold() override;
352
353 // Usual data generation method
355
356 int FillInputPortInformation(int port, vtkInformation* info) override;
357
360 vtkTypeBool AllScalars = 1;
361 vtkTypeBool UseContinuousCellRange = 0;
362 bool Invert = false;
363 int AttributeMode = -1;
365 int SelectedComponent = 0;
366 int OutputPointsPrecision = DEFAULT_PRECISION;
367
368 int (vtkThreshold::*ThresholdFunction)(double s) const = &vtkThreshold::Between;
369
371 int EvaluateCell(vtkDataArray* scalars, vtkIdList* cellPts, int numCellPts);
372 int EvaluateCell(vtkDataArray* scalars, int c, vtkIdList* cellPts, int numCellPts);
373
374private:
375 vtkThreshold(const vtkThreshold&) = delete;
376 void operator=(const vtkThreshold&) = delete;
377};
378
379#endif
abstract superclass for arrays of numeric data
Definition: vtkDataArray.h:159
list of point or cell ids
Definition: vtkIdList.h:140
a simple class to control print indentation
Definition: vtkIndent.h:113
Store zero or more vtkInformation instances.
Store vtkAlgorithm input/output information.
extracts cells where scalar value in cell satisfies threshold criterion
Definition: vtkThreshold.h:166
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
int EvaluateCell(vtkDataArray *scalars, vtkIdList *cellPts, int numCellPts)
void SetAttributeModeToUsePointData()
Control how the filter works with scalar point data and cell attribute data.
Definition: vtkThreshold.h:236
void SetPointsDataType(int type)
Set the data type of the output points (See the data types defined in vtkType.h).
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.
Definition: vtkThreshold.h:255
void SetComponentModeToUseAny()
Control how the decision of in / out is made with multi-component data.
Definition: vtkThreshold.h:257
ThresholdType
Possible values for the threshold function:
Definition: vtkThreshold.h:179
void SetComponentModeToUseAll()
Control how the decision of in / out is made with multi-component data.
Definition: vtkThreshold.h:256
int GetOutputPointsPrecision() const
Set/get the desired precision for the output types.
double LowerThreshold
Definition: vtkThreshold.h:358
void SetPointsDataTypeToDouble()
Set the data type of the output points (See the data types defined in vtkType.h).
Definition: vtkThreshold.h:304
const char * GetComponentModeAsString()
Control how the decision of in / out is made with multi-component data.
void SetAttributeModeToUseCellData()
Control how the filter works with scalar point data and cell attribute data.
Definition: vtkThreshold.h:240
int EvaluateComponents(vtkDataArray *scalars, vtkIdType id)
int FillInputPortInformation(int port, vtkInformation *info) override
Fill the input port information objects for this algorithm.
int GetPointsDataType()
Set the data type of the output points (See the data types defined in vtkType.h).
void SetPointsDataTypeToFloat()
Set the data type of the output points (See the data types defined in vtkType.h).
Definition: vtkThreshold.h:305
double UpperThreshold
Definition: vtkThreshold.h:359
void SetOutputPointsPrecision(int precision)
Set/get the desired precision for the output types.
int Upper(double s) const
Methods used for thresholding.
~vtkThreshold() override
int Between(double s) const
Methods used for thresholding.
int EvaluateCell(vtkDataArray *scalars, int c, vtkIdList *cellPts, int numCellPts)
int Lower(double s) const
Methods used for thresholding.
int GetThresholdFunction()
Get/Set the threshold method, defining which threshold bounds to use.
int RequestData(vtkInformation *, vtkInformationVector **, vtkInformationVector *) override
This is called by the superclass.
const char * GetAttributeModeAsString()
Control how the filter works with scalar point data and cell attribute data.
static vtkThreshold * New()
Superclass for algorithms that produce only unstructured grid as output.
int vtkTypeBool
Definition: vtkABI.h:69
#define VTK_DEPRECATED_IN_9_1_0(reason)
#define VTK_COMPONENT_MODE_USE_SELECTED
Definition: vtkThreshold.h:158
#define VTK_ATTRIBUTE_MODE_USE_POINT_DATA
Definition: vtkThreshold.h:154
#define VTK_ATTRIBUTE_MODE_DEFAULT
Definition: vtkThreshold.h:153
#define VTK_COMPONENT_MODE_USE_ALL
Definition: vtkThreshold.h:159
#define VTK_COMPONENT_MODE_USE_ANY
Definition: vtkThreshold.h:160
#define VTK_ATTRIBUTE_MODE_USE_CELL_DATA
Definition: vtkThreshold.h:155
int vtkIdType
Definition: vtkType.h:332
#define VTK_DOUBLE
Definition: vtkType.h:55
#define VTK_FLOAT
Definition: vtkType.h:54
#define VTK_INT_MAX
Definition: vtkType.h:155