VTK  9.3.0
vtkPointDensityFilter.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
68 #ifndef vtkPointDensityFilter_h
69 #define vtkPointDensityFilter_h
70 
71 #include "vtkFiltersPointsModule.h" // For export macro
72 #include "vtkImageAlgorithm.h"
73 
74 #define VTK_DENSITY_ESTIMATE_FIXED_RADIUS 0
75 #define VTK_DENSITY_ESTIMATE_RELATIVE_RADIUS 1
76 
77 #define VTK_DENSITY_FORM_VOLUME_NORM 0
78 #define VTK_DENSITY_FORM_NPTS 1
79 
80 VTK_ABI_NAMESPACE_BEGIN
82 
83 class VTKFILTERSPOINTS_EXPORT vtkPointDensityFilter : public vtkImageAlgorithm
84 {
85 public:
87 
93  void PrintSelf(ostream& os, vtkIndent indent) override;
95 
97 
103  void SetSampleDimensions(int i, int j, int k);
104  void SetSampleDimensions(int dim[3]);
105  vtkGetVectorMacro(SampleDimensions, int, 3);
107 
109 
115  vtkSetVector6Macro(ModelBounds, double);
116  vtkGetVectorMacro(ModelBounds, double, 6);
118 
120 
126  vtkSetClampMacro(AdjustDistance, double, -1.0, 1.0);
127  vtkGetMacro(AdjustDistance, double);
129 
131 
136  vtkSetClampMacro(
138  vtkGetMacro(DensityEstimate, int);
140  {
141  this->SetDensityEstimate(VTK_DENSITY_ESTIMATE_FIXED_RADIUS);
142  }
144  {
145  this->SetDensityEstimate(VTK_DENSITY_ESTIMATE_RELATIVE_RADIUS);
146  }
149 
151 
156  vtkSetClampMacro(DensityForm, int, VTK_DENSITY_FORM_VOLUME_NORM, VTK_DENSITY_FORM_NPTS);
157  vtkGetMacro(DensityForm, int);
159  void SetDensityFormToNumberOfPoints() { this->SetDensityForm(VTK_DENSITY_FORM_NPTS); }
160  const char* GetDensityFormAsString();
162 
164 
169  vtkSetClampMacro(Radius, double, 0.0, VTK_DOUBLE_MAX);
170  vtkGetMacro(Radius, double);
172 
174 
181  vtkSetClampMacro(RelativeRadius, double, 0.0, VTK_DOUBLE_MAX);
182  vtkGetMacro(RelativeRadius, double);
184 
186 
190  vtkSetMacro(ScalarWeighting, bool);
191  vtkGetMacro(ScalarWeighting, bool);
192  vtkBooleanMacro(ScalarWeighting, bool);
194 
196 
203  vtkSetMacro(ComputeGradient, bool);
204  vtkGetMacro(ComputeGradient, bool);
205  vtkBooleanMacro(ComputeGradient, bool);
207 
209 
215  vtkGetObjectMacro(Locator, vtkAbstractPointLocator);
217 
225  {
226  ZERO = 0,
227  NON_ZERO = 1
228  };
229 
230 protected:
233 
234  int SampleDimensions[3]; // dimensions of volume over which to estimate density
235  double ModelBounds[6]; // bounding box of splatting dimensions
236  double AdjustDistance; // how much to pad the model bounds if automatically computed
237  double Origin[3], Spacing[3]; // output geometry
238  int DensityEstimate; // how to compute the density
239  int DensityForm; // how to represent density value
240  double RelativeRadius; // Radius factor for estimating density
241  double Radius; // Actually radius used
242  bool ScalarWeighting; // Are point densities weighted or not?
243  bool ComputeGradient; // Compute the gradient vector and magnitude
244  vtkAbstractPointLocator* Locator; // accelerate point searches
245 
249 
250  void ComputeModelBounds(vtkDataSet* input, vtkImageData* output, vtkInformation* outInfo);
251 
252 private:
254  void operator=(const vtkPointDensityFilter&) = delete;
255 };
256 
257 VTK_ABI_NAMESPACE_END
258 #endif
abstract class to quickly locate points in 3-space
abstract class to specify dataset behavior
Definition: vtkDataSet.h:62
Generic algorithm superclass for image algs.
topologically and geometrically regular array of data
Definition: vtkImageData.h:52
a simple class to control print indentation
Definition: vtkIndent.h:38
Store zero or more vtkInformation instances.
Store vtkAlgorithm input/output information.
produce density field from input point cloud
void ComputeModelBounds(vtkDataSet *input, vtkImageData *output, vtkInformation *outInfo)
void SetDensityEstimateToFixedRadius()
Specify the method to estimate point density.
static vtkPointDensityFilter * New()
Standard methods for instantiating, obtaining type information, and printing information.
int FillInputPortInformation(int port, vtkInformation *info) override
These method should be reimplemented by subclasses that have more than a single input or single outpu...
int RequestInformation(vtkInformation *, vtkInformationVector **, vtkInformationVector *) override
Subclasses can reimplement this method to collect information from their inputs and set information f...
void SetSampleDimensions(int dim[3])
Set / get the dimensions of the sampling volume.
void SetLocator(vtkAbstractPointLocator *locator)
Specify a point locator.
void SetSampleDimensions(int i, int j, int k)
Set / get the dimensions of the sampling volume.
vtkAbstractPointLocator * Locator
void SetDensityFormToVolumeNormalized()
Specify the form by which the density is expressed.
int RequestData(vtkInformation *, vtkInformationVector **, vtkInformationVector *) override
This is called in response to a REQUEST_DATA request from the executive.
void SetDensityFormToNumberOfPoints()
Specify the form by which the density is expressed.
void SetDensityEstimateToRelativeRadius()
Specify the method to estimate point density.
~vtkPointDensityFilter() override
const char * GetDensityFormAsString()
Specify the form by which the density is expressed.
void PrintSelf(ostream &os, vtkIndent indent) override
Standard methods for instantiating, obtaining type information, and printing information.
const char * GetDensityEstimateAsString()
Specify the method to estimate point density.
FunctionClass
This enum is used to classify the behavior of the function gradient.
@ info
Definition: vtkX3D.h:376
@ port
Definition: vtkX3D.h:447
#define VTK_DENSITY_ESTIMATE_RELATIVE_RADIUS
#define VTK_DENSITY_FORM_VOLUME_NORM
#define VTK_DENSITY_FORM_NPTS
#define VTK_DENSITY_ESTIMATE_FIXED_RADIUS
#define VTK_DOUBLE_MAX
Definition: vtkType.h:154