VTK  9.2.6
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 =========================================================================*/
152 #ifndef vtkThreshold_h
153 #define vtkThreshold_h
154 
155 #include "vtkDeprecation.h" // For VTK_DEPRECATED_IN_9_1_0
156 #include "vtkFiltersCoreModule.h" // For export macro
158 
159 #define VTK_ATTRIBUTE_MODE_DEFAULT 0
160 #define VTK_ATTRIBUTE_MODE_USE_POINT_DATA 1
161 #define VTK_ATTRIBUTE_MODE_USE_CELL_DATA 2
162 
163 // order / values are important because of the SetClampMacro
164 #define VTK_COMPONENT_MODE_USE_SELECTED 0
165 #define VTK_COMPONENT_MODE_USE_ALL 1
166 #define VTK_COMPONENT_MODE_USE_ANY 2
167 
168 class vtkDataArray;
169 class vtkIdList;
170 
171 class VTKFILTERSCORE_EXPORT vtkThreshold : public vtkUnstructuredGridAlgorithm
172 {
173 public:
174  static vtkThreshold* New();
176  void PrintSelf(ostream& os, vtkIndent indent) override;
177 
185  {
186  THRESHOLD_BETWEEN = 0,
188  THRESHOLD_UPPER
189  };
190 
192 
196  void SetThresholdFunction(int function);
199 
203  VTK_DEPRECATED_IN_9_1_0("Use 'SetLowerThreshold' and 'SetThresholdFunction' instead.")
204  void ThresholdByLower(double lower);
205 
209  VTK_DEPRECATED_IN_9_1_0("Use 'SetUpperThreshold' and 'SetThresholdFunction' instead.")
210  void ThresholdByUpper(double upper);
211 
217  "Use 'SetLowerThreshold', 'SetUpperThreshold' and 'SetThresholdFunction' instead.")
218  void ThresholdBetween(double lower, double upper);
219 
221 
225  vtkSetMacro(UpperThreshold, double);
226  vtkSetMacro(LowerThreshold, double);
227  vtkGetMacro(UpperThreshold, double);
228  vtkGetMacro(LowerThreshold, double);
230 
232 
239  vtkSetMacro(AttributeMode, int);
240  vtkGetMacro(AttributeMode, int);
241  void SetAttributeModeToDefault() { this->SetAttributeMode(VTK_ATTRIBUTE_MODE_DEFAULT); }
243  {
244  this->SetAttributeMode(VTK_ATTRIBUTE_MODE_USE_POINT_DATA);
245  }
249 
251 
259  vtkSetClampMacro(ComponentMode, int, VTK_COMPONENT_MODE_USE_SELECTED, VTK_COMPONENT_MODE_USE_ANY);
260  vtkGetMacro(ComponentMode, int);
262  void SetComponentModeToUseAll() { this->SetComponentMode(VTK_COMPONENT_MODE_USE_ALL); }
263  void SetComponentModeToUseAny() { this->SetComponentMode(VTK_COMPONENT_MODE_USE_ANY); }
266 
268 
272  vtkSetClampMacro(SelectedComponent, int, 0, VTK_INT_MAX);
273  vtkGetMacro(SelectedComponent, int);
275 
277 
283  vtkSetMacro(AllScalars, vtkTypeBool);
284  vtkGetMacro(AllScalars, vtkTypeBool);
285  vtkBooleanMacro(AllScalars, vtkTypeBool);
287 
289 
297  vtkSetMacro(UseContinuousCellRange, vtkTypeBool);
298  vtkGetMacro(UseContinuousCellRange, vtkTypeBool);
299  vtkBooleanMacro(UseContinuousCellRange, vtkTypeBool);
301 
303 
310  void SetPointsDataTypeToDouble() { this->SetPointsDataType(VTK_DOUBLE); }
311  void SetPointsDataTypeToFloat() { this->SetPointsDataType(VTK_FLOAT); }
315 
317 
322  vtkSetMacro(Invert, bool);
323  vtkGetMacro(Invert, bool);
324  vtkBooleanMacro(Invert, bool);
326 
328 
333  void SetOutputPointsPrecision(int precision);
336 
338 
351  int Lower(double s) const;
352  int Upper(double s) const;
353  int Between(double s) const;
355 protected:
357  ~vtkThreshold() override;
358 
359  // Usual data generation method
361 
363 
366  vtkTypeBool AllScalars = 1;
367  vtkTypeBool UseContinuousCellRange = 0;
368  bool Invert = false;
369  int AttributeMode = -1;
370  int ComponentMode = VTK_COMPONENT_MODE_USE_SELECTED;
371  int SelectedComponent = 0;
372  int OutputPointsPrecision = DEFAULT_PRECISION;
373 
374  int (vtkThreshold::*ThresholdFunction)(double s) const = &vtkThreshold::Between;
375 
377  int EvaluateCell(vtkDataArray* scalars, vtkIdList* cellPts, int numCellPts);
378  int EvaluateCell(vtkDataArray* scalars, int c, vtkIdList* cellPts, int numCellPts);
379 
380 private:
381  vtkThreshold(const vtkThreshold&) = delete;
382  void operator=(const vtkThreshold&) = delete;
383 };
384 
385 #endif
abstract superclass for arrays of numeric data
Definition: vtkDataArray.h:165
list of point or cell ids
Definition: vtkIdList.h:143
a simple class to control print indentation
Definition: vtkIndent.h:119
Store zero or more vtkInformation instances.
Store vtkAlgorithm input/output information.
extracts cells where scalar value in cell satisfies threshold criterion
Definition: vtkThreshold.h:172
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)
const char * GetComponentModeAsString()
Control how the decision of in / out is made with multi-component data.
void SetAttributeModeToUsePointData()
Control how the filter works with scalar point data and cell attribute data.
Definition: vtkThreshold.h:242
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:261
void SetComponentModeToUseAny()
Control how the decision of in / out is made with multi-component data.
Definition: vtkThreshold.h:263
const char * GetAttributeModeAsString()
Control how the filter works with scalar point data and cell attribute data.
ThresholdType
Possible values for the threshold function:
Definition: vtkThreshold.h:185
void SetComponentModeToUseAll()
Control how the decision of in / out is made with multi-component data.
Definition: vtkThreshold.h:262
int GetOutputPointsPrecision() const
Set/get the desired precision for the output types.
double LowerThreshold
Definition: vtkThreshold.h:364
void SetPointsDataTypeToDouble()
Set the data type of the output points (See the data types defined in vtkType.h).
Definition: vtkThreshold.h:310
void SetAttributeModeToUseCellData()
Control how the filter works with scalar point data and cell attribute data.
Definition: vtkThreshold.h:246
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:311
double UpperThreshold
Definition: vtkThreshold.h:365
void SetOutputPointsPrecision(int precision)
Set/get the desired precision for the output types.
static vtkThreshold * New()
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.
Superclass for algorithms that produce only unstructured grid as output.
@ info
Definition: vtkX3D.h:382
@ port
Definition: vtkX3D.h:453
@ type
Definition: vtkX3D.h:522
int vtkTypeBool
Definition: vtkABI.h:69
#define VTK_DEPRECATED_IN_9_1_0(reason)
#define VTK_COMPONENT_MODE_USE_SELECTED
Definition: vtkThreshold.h:164
#define VTK_ATTRIBUTE_MODE_USE_POINT_DATA
Definition: vtkThreshold.h:160
#define VTK_ATTRIBUTE_MODE_DEFAULT
Definition: vtkThreshold.h:159
#define VTK_COMPONENT_MODE_USE_ALL
Definition: vtkThreshold.h:165
#define VTK_COMPONENT_MODE_USE_ANY
Definition: vtkThreshold.h:166
#define VTK_ATTRIBUTE_MODE_USE_CELL_DATA
Definition: vtkThreshold.h:161
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