VTK  9.3.20240328
vtkSampleFunction.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
130 #ifndef vtkSampleFunction_h
131 #define vtkSampleFunction_h
132 
133 #include "vtkImageAlgorithm.h"
134 #include "vtkImagingHybridModule.h" // For export macro
135 
136 VTK_ABI_NAMESPACE_BEGIN
137 class vtkImplicitFunction;
138 class vtkDataArray;
139 
140 class VTKIMAGINGHYBRID_EXPORT vtkSampleFunction : public vtkImageAlgorithm
141 {
142 public:
144  void PrintSelf(ostream& os, vtkIndent indent) override;
145 
151 
153 
157  vtkGetObjectMacro(ImplicitFunction, vtkImplicitFunction);
159 
161 
164  vtkSetMacro(OutputScalarType, int);
165  vtkGetMacro(OutputScalarType, int);
166  void SetOutputScalarTypeToDouble() { this->SetOutputScalarType(VTK_DOUBLE); }
167  void SetOutputScalarTypeToFloat() { this->SetOutputScalarType(VTK_FLOAT); }
168  void SetOutputScalarTypeToLong() { this->SetOutputScalarType(VTK_LONG); }
169  void SetOutputScalarTypeToUnsignedLong() { this->SetOutputScalarType(VTK_UNSIGNED_LONG); }
170  void SetOutputScalarTypeToInt() { this->SetOutputScalarType(VTK_INT); }
171  void SetOutputScalarTypeToUnsignedInt() { this->SetOutputScalarType(VTK_UNSIGNED_INT); }
172  void SetOutputScalarTypeToShort() { this->SetOutputScalarType(VTK_SHORT); }
173  void SetOutputScalarTypeToUnsignedShort() { this->SetOutputScalarType(VTK_UNSIGNED_SHORT); }
174  void SetOutputScalarTypeToChar() { this->SetOutputScalarType(VTK_CHAR); }
175  void SetOutputScalarTypeToUnsignedChar() { this->SetOutputScalarType(VTK_UNSIGNED_CHAR); }
177 
181  void SetSampleDimensions(int i, int j, int k);
182 
184 
187  void SetSampleDimensions(int dim[3]);
188  vtkGetVectorMacro(SampleDimensions, int, 3);
190 
192 
196  void SetModelBounds(const double bounds[6]);
197  void SetModelBounds(double xMin, double xMax, double yMin, double yMax, double zMin, double zMax);
198  vtkGetVectorMacro(ModelBounds, double, 6);
200 
202 
207  vtkSetMacro(Capping, vtkTypeBool);
208  vtkGetMacro(Capping, vtkTypeBool);
209  vtkBooleanMacro(Capping, vtkTypeBool);
211 
213 
216  vtkSetMacro(CapValue, double);
217  vtkGetMacro(CapValue, double);
219 
221 
224  vtkSetMacro(ComputeNormals, vtkTypeBool);
225  vtkGetMacro(ComputeNormals, vtkTypeBool);
226  vtkBooleanMacro(ComputeNormals, vtkTypeBool);
228 
230 
234  vtkSetStringMacro(ScalarArrayName);
235  vtkGetStringMacro(ScalarArrayName);
237 
239 
243  vtkSetStringMacro(NormalArrayName);
244  vtkGetStringMacro(NormalArrayName);
246 
250  vtkMTimeType GetMTime() override;
251 
252 protected:
261 
262  ~vtkSampleFunction() override;
263 
265 
268  void Cap(vtkDataArray* s);
269 
271  int SampleDimensions[3];
272  double ModelBounds[6];
274  double CapValue;
279 
280 private:
281  vtkSampleFunction(const vtkSampleFunction&) = delete;
282  void operator=(const vtkSampleFunction&) = delete;
283 };
284 
285 VTK_ABI_NAMESPACE_END
286 #endif
abstract superclass for arrays of numeric data
Definition: vtkDataArray.h:154
general representation of visualization data
Detect and break reference loops.
Generic algorithm superclass for image algs.
abstract interface for implicit functions
a simple class to control print indentation
Definition: vtkIndent.h:108
Store zero or more vtkInformation instances.
Store vtkAlgorithm input/output information.
sample an implicit function over a structured point set
virtual void SetImplicitFunction(vtkImplicitFunction *)
Specify the implicit function to use to generate data.
void SetOutputScalarTypeToShort()
Set what type of scalar data this source should generate.
void SetOutputScalarTypeToUnsignedInt()
Set what type of scalar data this source should generate.
void SetOutputScalarTypeToUnsignedLong()
Set what type of scalar data this source should generate.
void SetOutputScalarTypeToUnsignedShort()
Set what type of scalar data this source should generate.
static vtkSampleFunction * New()
Construct with ModelBounds=(-1,1,-1,1,-1,1), SampleDimensions=(50,50,50), Capping turned off,...
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
vtkMTimeType GetMTime() override
Return the MTime also considering the implicit function.
void SetSampleDimensions(int i, int j, int k)
Specify the dimensions of the data on which to sample.
void ExecuteDataWithInformation(vtkDataObject *, vtkInformation *) override
This is a convenience method that is implemented in many subclasses instead of RequestData.
vtkSampleFunction()
Default constructor.
void SetOutputScalarTypeToChar()
Set what type of scalar data this source should generate.
vtkImplicitFunction * ImplicitFunction
void SetSampleDimensions(int dim[3])
Specify the dimensions of the data on which to sample.
void SetModelBounds(double xMin, double xMax, double yMin, double yMax, double zMin, double zMax)
Specify the region in space over which the sampling occurs.
void ReportReferences(vtkGarbageCollector *) override
void SetOutputScalarTypeToLong()
Set what type of scalar data this source should generate.
~vtkSampleFunction() override
void SetOutputScalarTypeToDouble()
Set what type of scalar data this source should generate.
vtkTypeBool ComputeNormals
int RequestInformation(vtkInformation *, vtkInformationVector **, vtkInformationVector *) override
Subclasses can reimplement this method to collect information from their inputs and set information f...
void SetOutputScalarTypeToInt()
Set what type of scalar data this source should generate.
void SetOutputScalarTypeToFloat()
Set what type of scalar data this source should generate.
void Cap(vtkDataArray *s)
void SetModelBounds(const double bounds[6])
Specify the region in space over which the sampling occurs.
void SetOutputScalarTypeToUnsignedChar()
Set what type of scalar data this source should generate.
int vtkTypeBool
Definition: vtkABI.h:64
#define VTK_SHORT
Definition: vtkType.h:36
#define VTK_UNSIGNED_INT
Definition: vtkType.h:39
#define VTK_DOUBLE
Definition: vtkType.h:43
#define VTK_UNSIGNED_CHAR
Definition: vtkType.h:35
#define VTK_UNSIGNED_SHORT
Definition: vtkType.h:37
vtkTypeUInt32 vtkMTimeType
Definition: vtkType.h:270
#define VTK_INT
Definition: vtkType.h:38
#define VTK_FLOAT
Definition: vtkType.h:42
#define VTK_CHAR
Definition: vtkType.h:33
#define VTK_UNSIGNED_LONG
Definition: vtkType.h:41
#define VTK_LONG
Definition: vtkType.h:40