VTK  9.2.6
vtkImageThreshold.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkImageThreshold.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 =========================================================================*/
27 #ifndef vtkImageThreshold_h
28 #define vtkImageThreshold_h
29 
30 #include "vtkImagingCoreModule.h" // For export macro
32 
33 class VTKIMAGINGCORE_EXPORT vtkImageThreshold : public vtkThreadedImageAlgorithm
34 {
35 public:
36  static vtkImageThreshold* New();
38  void PrintSelf(ostream& os, vtkIndent indent) override;
39 
43  void ThresholdByUpper(double thresh);
44 
48  void ThresholdByLower(double thresh);
49 
53  void ThresholdBetween(double lower, double upper);
54 
56 
59  vtkSetMacro(ReplaceIn, vtkTypeBool);
60  vtkGetMacro(ReplaceIn, vtkTypeBool);
61  vtkBooleanMacro(ReplaceIn, vtkTypeBool);
63 
65 
68  void SetInValue(double val);
69  vtkGetMacro(InValue, double);
71 
73 
76  vtkSetMacro(ReplaceOut, vtkTypeBool);
77  vtkGetMacro(ReplaceOut, vtkTypeBool);
78  vtkBooleanMacro(ReplaceOut, vtkTypeBool);
80 
82 
85  void SetOutValue(double val);
86  vtkGetMacro(OutValue, double);
88 
90 
93  vtkGetMacro(UpperThreshold, double);
94  vtkGetMacro(LowerThreshold, double);
96 
98 
101  vtkSetMacro(OutputScalarType, int);
102  vtkGetMacro(OutputScalarType, int);
103  void SetOutputScalarTypeToDouble() { this->SetOutputScalarType(VTK_DOUBLE); }
104  void SetOutputScalarTypeToFloat() { this->SetOutputScalarType(VTK_FLOAT); }
105  void SetOutputScalarTypeToLong() { this->SetOutputScalarType(VTK_LONG); }
106  void SetOutputScalarTypeToUnsignedLong() { this->SetOutputScalarType(VTK_UNSIGNED_LONG); }
107  void SetOutputScalarTypeToInt() { this->SetOutputScalarType(VTK_INT); }
108  void SetOutputScalarTypeToUnsignedInt() { this->SetOutputScalarType(VTK_UNSIGNED_INT); }
109  void SetOutputScalarTypeToShort() { this->SetOutputScalarType(VTK_SHORT); }
110  void SetOutputScalarTypeToUnsignedShort() { this->SetOutputScalarType(VTK_UNSIGNED_SHORT); }
111  void SetOutputScalarTypeToChar() { this->SetOutputScalarType(VTK_CHAR); }
112  void SetOutputScalarTypeToSignedChar() { this->SetOutputScalarType(VTK_SIGNED_CHAR); }
113  void SetOutputScalarTypeToUnsignedChar() { this->SetOutputScalarType(VTK_UNSIGNED_CHAR); }
115 
116 protected:
118  ~vtkImageThreshold() override = default;
119 
123  double InValue;
125  double OutValue;
126 
128 
130 
131  void ThreadedRequestData(vtkInformation* request, vtkInformationVector** inputVector,
132  vtkInformationVector* outputVector, vtkImageData*** inData, vtkImageData** outData,
133  int outExt[6], int id) override;
134 
135 private:
136  vtkImageThreshold(const vtkImageThreshold&) = delete;
137  void operator=(const vtkImageThreshold&) = delete;
138 };
139 
140 #endif
#define VTK_UNSIGNED_INT
Definition: vtkType.h:51
void SetOutputScalarTypeToChar()
Set the desired output scalar type to cast to.
void SetOutputScalarTypeToUnsignedChar()
Set the desired output scalar type to cast to.
Store vtkAlgorithm input/output information.
#define VTK_UNSIGNED_SHORT
Definition: vtkType.h:49
void SetOutputScalarTypeToSignedChar()
Set the desired output scalar type to cast to.
void SetOutputScalarTypeToInt()
Set the desired output scalar type to cast to.
Flexible threshold.
int vtkTypeBool
Definition: vtkABI.h:69
#define VTK_DOUBLE
Definition: vtkType.h:55
Generic filter that has one input.
#define VTK_FLOAT
Definition: vtkType.h:54
a simple class to control print indentation
Definition: vtkIndent.h:39
topologically and geometrically regular array of data
Definition: vtkImageData.h:53
virtual int RequestInformation(vtkInformation *request, vtkInformationVector **inputVector, vtkInformationVector *outputVector)
Subclasses can reimplement this method to collect information from their inputs and set information f...
#define VTK_SHORT
Definition: vtkType.h:48
void SetOutputScalarTypeToFloat()
Set the desired output scalar type to cast to.
#define VTK_CHAR
Definition: vtkType.h:45
#define VTK_LONG
Definition: vtkType.h:52
void SetOutputScalarTypeToDouble()
Set the desired output scalar type to cast to.
virtual void ThreadedRequestData(vtkInformation *request, vtkInformationVector **inputVector, vtkInformationVector *outputVector, vtkImageData ***inData, vtkImageData **outData, int extent[6], int threadId)
If the subclass does not define an Execute method, then the task will be broken up, multiple threads will be spawned, and each thread will call this method.
void SetOutputScalarTypeToUnsignedInt()
Set the desired output scalar type to cast to.
void SetOutputScalarTypeToLong()
Set the desired output scalar type to cast to.
#define VTK_SIGNED_CHAR
Definition: vtkType.h:46
#define VTK_UNSIGNED_CHAR
Definition: vtkType.h:47
void SetOutputScalarTypeToUnsignedShort()
Set the desired output scalar type to cast to.
void SetOutputScalarTypeToShort()
Set the desired output scalar type to cast to.
Store zero or more vtkInformation instances.
static vtkAlgorithm * New()
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
#define VTK_UNSIGNED_LONG
Definition: vtkType.h:53
#define VTK_INT
Definition: vtkType.h:50
void SetOutputScalarTypeToUnsignedLong()
Set the desired output scalar type to cast to.