VTK  9.1.0
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 =========================================================================*/
133 #ifndef vtkImageThreshold_h
134 #define vtkImageThreshold_h
135 
136 #include "vtkImagingCoreModule.h" // For export macro
138 
139 class VTKIMAGINGCORE_EXPORT vtkImageThreshold : public vtkThreadedImageAlgorithm
140 {
141 public:
144  void PrintSelf(ostream& os, vtkIndent indent) override;
145 
149  void ThresholdByUpper(double thresh);
150 
154  void ThresholdByLower(double thresh);
155 
159  void ThresholdBetween(double lower, double upper);
160 
162 
165  vtkSetMacro(ReplaceIn, vtkTypeBool);
166  vtkGetMacro(ReplaceIn, vtkTypeBool);
167  vtkBooleanMacro(ReplaceIn, vtkTypeBool);
169 
171 
174  void SetInValue(double val);
175  vtkGetMacro(InValue, double);
177 
179 
182  vtkSetMacro(ReplaceOut, vtkTypeBool);
183  vtkGetMacro(ReplaceOut, vtkTypeBool);
184  vtkBooleanMacro(ReplaceOut, vtkTypeBool);
186 
188 
191  void SetOutValue(double val);
192  vtkGetMacro(OutValue, double);
194 
196 
199  vtkGetMacro(UpperThreshold, double);
200  vtkGetMacro(LowerThreshold, double);
202 
204 
207  vtkSetMacro(OutputScalarType, int);
208  vtkGetMacro(OutputScalarType, int);
209  void SetOutputScalarTypeToDouble() { this->SetOutputScalarType(VTK_DOUBLE); }
210  void SetOutputScalarTypeToFloat() { this->SetOutputScalarType(VTK_FLOAT); }
211  void SetOutputScalarTypeToLong() { this->SetOutputScalarType(VTK_LONG); }
212  void SetOutputScalarTypeToUnsignedLong() { this->SetOutputScalarType(VTK_UNSIGNED_LONG); }
213  void SetOutputScalarTypeToInt() { this->SetOutputScalarType(VTK_INT); }
214  void SetOutputScalarTypeToUnsignedInt() { this->SetOutputScalarType(VTK_UNSIGNED_INT); }
215  void SetOutputScalarTypeToShort() { this->SetOutputScalarType(VTK_SHORT); }
216  void SetOutputScalarTypeToUnsignedShort() { this->SetOutputScalarType(VTK_UNSIGNED_SHORT); }
217  void SetOutputScalarTypeToChar() { this->SetOutputScalarType(VTK_CHAR); }
218  void SetOutputScalarTypeToSignedChar() { this->SetOutputScalarType(VTK_SIGNED_CHAR); }
219  void SetOutputScalarTypeToUnsignedChar() { this->SetOutputScalarType(VTK_UNSIGNED_CHAR); }
221 
222 protected:
224  ~vtkImageThreshold() override = default;
225 
229  double InValue;
231  double OutValue;
232 
234 
236 
238  vtkInformationVector* outputVector, vtkImageData*** inData, vtkImageData** outData,
239  int outExt[6], int id) override;
240 
241 private:
242  vtkImageThreshold(const vtkImageThreshold&) = delete;
243  void operator=(const vtkImageThreshold&) = delete;
244 };
245 
246 #endif
vtkImageThreshold::RequestInformation
int RequestInformation(vtkInformation *, vtkInformationVector **, vtkInformationVector *) override
Subclasses can reimplement this method to collect information from their inputs and set information f...
vtkImageThreshold::ThresholdByUpper
void ThresholdByUpper(double thresh)
The values greater than or equal to the value match.
VTK_UNSIGNED_INT
#define VTK_UNSIGNED_INT
Definition: vtkType.h:51
vtkImageThreshold::SetOutValue
void SetOutValue(double val)
Replace the in range pixels with this value.
vtkImageThreshold::New
static vtkImageThreshold * New()
vtkInformationVector
Store zero or more vtkInformation instances.
Definition: vtkInformationVector.h:145
VTK_UNSIGNED_SHORT
#define VTK_UNSIGNED_SHORT
Definition: vtkType.h:49
vtkImageThreshold::SetOutputScalarTypeToInt
void SetOutputScalarTypeToInt()
Set the desired output scalar type to cast to.
Definition: vtkImageThreshold.h:213
vtkThreadedImageAlgorithm
Generic filter that has one input.
Definition: vtkThreadedImageAlgorithm.h:39
vtkImageThreshold::ReplaceOut
vtkTypeBool ReplaceOut
Definition: vtkImageThreshold.h:230
vtkImageThreshold::InValue
double InValue
Definition: vtkImageThreshold.h:229
vtkImageThreshold::SetInValue
void SetInValue(double val)
Replace the in range pixels with this value.
vtkImageThreshold::SetOutputScalarTypeToSignedChar
void SetOutputScalarTypeToSignedChar()
Set the desired output scalar type to cast to.
Definition: vtkImageThreshold.h:218
vtkImageThreshold::ThreadedRequestData
void ThreadedRequestData(vtkInformation *request, vtkInformationVector **inputVector, vtkInformationVector *outputVector, vtkImageData ***inData, vtkImageData **outData, int outExt[6], int id) override
If the subclass does not define an Execute method, then the task will be broken up,...
vtkImageThreshold::ReplaceIn
vtkTypeBool ReplaceIn
Definition: vtkImageThreshold.h:228
vtkThreadedImageAlgorithm.h
vtkImageThreshold::PrintSelf
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
VTK_CHAR
#define VTK_CHAR
Definition: vtkType.h:45
vtkImageThreshold::SetOutputScalarTypeToUnsignedInt
void SetOutputScalarTypeToUnsignedInt()
Set the desired output scalar type to cast to.
Definition: vtkImageThreshold.h:214
vtkImageData
topologically and geometrically regular array of data
Definition: vtkImageData.h:157
vtkIndent
a simple class to control print indentation
Definition: vtkIndent.h:113
VTK_FLOAT
#define VTK_FLOAT
Definition: vtkType.h:54
VTK_DOUBLE
#define VTK_DOUBLE
Definition: vtkType.h:55
VTK_UNSIGNED_CHAR
#define VTK_UNSIGNED_CHAR
Definition: vtkType.h:47
vtkImageThreshold::ThresholdBetween
void ThresholdBetween(double lower, double upper)
The values in a range (inclusive) match.
VTK_LONG
#define VTK_LONG
Definition: vtkType.h:52
vtkImageThreshold::SetOutputScalarTypeToDouble
void SetOutputScalarTypeToDouble()
Set the desired output scalar type to cast to.
Definition: vtkImageThreshold.h:209
vtkImageThreshold::SetOutputScalarTypeToLong
void SetOutputScalarTypeToLong()
Set the desired output scalar type to cast to.
Definition: vtkImageThreshold.h:211
vtkImageThreshold::UpperThreshold
double UpperThreshold
Definition: vtkImageThreshold.h:226
VTK_UNSIGNED_LONG
#define VTK_UNSIGNED_LONG
Definition: vtkType.h:53
vtkInformation
Store vtkAlgorithm input/output information.
Definition: vtkInformation.h:183
vtkImageThreshold
Flexible threshold.
Definition: vtkImageThreshold.h:140
vtkImageThreshold::~vtkImageThreshold
~vtkImageThreshold() override=default
VTK_SHORT
#define VTK_SHORT
Definition: vtkType.h:48
vtkImageThreshold::SetOutputScalarTypeToFloat
void SetOutputScalarTypeToFloat()
Set the desired output scalar type to cast to.
Definition: vtkImageThreshold.h:210
vtkImageThreshold::vtkImageThreshold
vtkImageThreshold()
vtkImageThreshold::LowerThreshold
double LowerThreshold
Definition: vtkImageThreshold.h:227
vtkImageThreshold::OutputScalarType
int OutputScalarType
Definition: vtkImageThreshold.h:233
VTK_SIGNED_CHAR
#define VTK_SIGNED_CHAR
Definition: vtkType.h:46
vtkImageThreshold::SetOutputScalarTypeToUnsignedShort
void SetOutputScalarTypeToUnsignedShort()
Set the desired output scalar type to cast to.
Definition: vtkImageThreshold.h:216
VTK_INT
#define VTK_INT
Definition: vtkType.h:50
vtkImageThreshold::ThresholdByLower
void ThresholdByLower(double thresh)
The values less than or equal to the value match.
vtkImageThreshold::SetOutputScalarTypeToShort
void SetOutputScalarTypeToShort()
Set the desired output scalar type to cast to.
Definition: vtkImageThreshold.h:215
vtkImageThreshold::SetOutputScalarTypeToChar
void SetOutputScalarTypeToChar()
Set the desired output scalar type to cast to.
Definition: vtkImageThreshold.h:217
vtkImageThreshold::SetOutputScalarTypeToUnsignedLong
void SetOutputScalarTypeToUnsignedLong()
Set the desired output scalar type to cast to.
Definition: vtkImageThreshold.h:212
vtkTypeBool
int vtkTypeBool
Definition: vtkABI.h:69
vtkImageThreshold::SetOutputScalarTypeToUnsignedChar
void SetOutputScalarTypeToUnsignedChar()
Set the desired output scalar type to cast to.
Definition: vtkImageThreshold.h:219
vtkImageThreshold::OutValue
double OutValue
Definition: vtkImageThreshold.h:231