VTK
vtkPointDensityFilter.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkPointDensityFilter.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 =========================================================================*/
80 #ifndef vtkPointDensityFilter_h
81 #define vtkPointDensityFilter_h
82 
83 #include "vtkFiltersPointsModule.h" // For export macro
84 #include "vtkImageAlgorithm.h"
85 
86 #define VTK_DENSITY_ESTIMATE_FIXED_RADIUS 0
87 #define VTK_DENSITY_ESTIMATE_RELATIVE_RADIUS 1
88 
89 #define VTK_DENSITY_FORM_VOLUME_NORM 0
90 #define VTK_DENSITY_FORM_NPTS 1
91 
93 
94 class VTKFILTERSPOINTS_EXPORT vtkPointDensityFilter : public vtkImageAlgorithm
95 {
96 public:
98 
102  static vtkPointDensityFilter *New();
104  void PrintSelf(ostream& os, vtkIndent indent) override;
106 
108 
114  void SetSampleDimensions(int i, int j, int k);
115  void SetSampleDimensions(int dim[3]);
116  vtkGetVectorMacro(SampleDimensions,int,3);
118 
120 
126  vtkSetVector6Macro(ModelBounds,double);
127  vtkGetVectorMacro(ModelBounds,double,6);
129 
131 
137  vtkSetClampMacro(AdjustDistance,double,-1.0,1.0);
138  vtkGetMacro(AdjustDistance,double);
140 
142 
147  vtkSetClampMacro(DensityEstimate,int, VTK_DENSITY_ESTIMATE_FIXED_RADIUS,
149  vtkGetMacro(DensityEstimate,int);
151  {this->SetDensityEstimate(VTK_DENSITY_ESTIMATE_FIXED_RADIUS);}
153  {this->SetDensityEstimate(VTK_DENSITY_ESTIMATE_RELATIVE_RADIUS);}
154  const char *GetDensityEstimateAsString();
156 
158 
163  vtkSetClampMacro(DensityForm,int, VTK_DENSITY_FORM_VOLUME_NORM,
165  vtkGetMacro(DensityForm,int);
167  {this->SetDensityForm(VTK_DENSITY_FORM_VOLUME_NORM);}
169  {this->SetDensityForm(VTK_DENSITY_FORM_NPTS);}
170  const char *GetDensityFormAsString();
172 
174 
179  vtkSetClampMacro(Radius,double,0.0,VTK_DOUBLE_MAX);
180  vtkGetMacro(Radius,double);
182 
184 
191  vtkSetClampMacro(RelativeRadius,double,0.0,VTK_DOUBLE_MAX);
192  vtkGetMacro(RelativeRadius,double);
194 
196 
200  vtkSetMacro(ScalarWeighting,bool);
201  vtkGetMacro(ScalarWeighting,bool);
202  vtkBooleanMacro(ScalarWeighting,bool);
204 
206 
213  vtkSetMacro(ComputeGradient,bool);
214  vtkGetMacro(ComputeGradient,bool);
215  vtkBooleanMacro(ComputeGradient,bool);
217 
219 
224  void SetLocator(vtkAbstractPointLocator *locator);
225  vtkGetObjectMacro(Locator,vtkAbstractPointLocator);
227 
235  {
236  ZERO=0,
237  NON_ZERO=1
238  };
239 
240 protected:
242  ~vtkPointDensityFilter() override;
243 
244  int SampleDimensions[3]; // dimensions of volume over which to estimate density
245  double ModelBounds[6]; // bounding box of splatting dimensions
246  double AdjustDistance; // how much to pad the model bounds if automatically computed
247  double Origin[3], Spacing[3]; // output geometry
248  int DensityEstimate; // how to compute the density
249  int DensityForm; // how to represent density value
250  double RelativeRadius; // Radius factor for estimating density
251  double Radius; // Actually radius used
252  bool ScalarWeighting; // Are point densities weighted or not?
253  bool ComputeGradient; // Compute the gradient vector and magnitude
254  vtkAbstractPointLocator *Locator; //accelerate point searches
255 
256  int FillInputPortInformation(int port, vtkInformation* info) override;
259  vtkInformationVector *) override;
262  vtkInformationVector *) override;
263 
264  void ComputeModelBounds(vtkDataSet *input, vtkImageData *output,
265  vtkInformation *outInfo);
266 
267 private:
269  void operator=(const vtkPointDensityFilter&) = delete;
270 };
271 
272 #endif
vtkImageAlgorithm::RequestData
virtual int RequestData(vtkInformation *request, vtkInformationVector **inputVector, vtkInformationVector *outputVector)
This is called in response to a REQUEST_DATA request from the executive.
VTK_DENSITY_ESTIMATE_RELATIVE_RADIUS
#define VTK_DENSITY_ESTIMATE_RELATIVE_RADIUS
Definition: vtkPointDensityFilter.h:87
VTK_DENSITY_FORM_VOLUME_NORM
#define VTK_DENSITY_FORM_VOLUME_NORM
Definition: vtkPointDensityFilter.h:89
vtkInformationVector
Store zero or more vtkInformation instances.
Definition: vtkInformationVector.h:41
vtkPointDensityFilter::DensityForm
int DensityForm
Definition: vtkPointDensityFilter.h:249
VTK_DENSITY_FORM_NPTS
#define VTK_DENSITY_FORM_NPTS
Definition: vtkPointDensityFilter.h:90
vtkImageAlgorithm.h
VTK_DENSITY_ESTIMATE_FIXED_RADIUS
#define VTK_DENSITY_ESTIMATE_FIXED_RADIUS
Definition: vtkPointDensityFilter.h:86
vtkPointDensityFilter::Radius
double Radius
Definition: vtkPointDensityFilter.h:251
vtkImageAlgorithm
Generic algorithm superclass for image algs.
Definition: vtkImageAlgorithm.h:40
vtkPointDensityFilter::Locator
vtkAbstractPointLocator * Locator
Definition: vtkPointDensityFilter.h:254
vtkPointDensityFilter::ComputeGradient
bool ComputeGradient
Definition: vtkPointDensityFilter.h:253
vtkPointDensityFilter::DensityEstimate
int DensityEstimate
Definition: vtkPointDensityFilter.h:248
vtkPointDensityFilter::SetDensityEstimateToFixedRadius
void SetDensityEstimateToFixedRadius()
Definition: vtkPointDensityFilter.h:150
vtkX3D::port
Definition: vtkX3D.h:447
vtkImageAlgorithm::RequestInformation
virtual int RequestInformation(vtkInformation *request, vtkInformationVector **inputVector, vtkInformationVector *outputVector)
Subclasses can reimplement this method to collect information from their inputs and set information f...
vtkPointDensityFilter
produce density field from input point cloud
Definition: vtkPointDensityFilter.h:94
vtkImageData
topologically and geometrically regular array of data
Definition: vtkImageData.h:45
vtkIndent
a simple class to control print indentation
Definition: vtkIndent.h:39
vtkPointDensityFilter::RelativeRadius
double RelativeRadius
Definition: vtkPointDensityFilter.h:250
vtkPointDensityFilter::ScalarWeighting
bool ScalarWeighting
Definition: vtkPointDensityFilter.h:252
vtkPointDensityFilter::SetDensityEstimateToRelativeRadius
void SetDensityEstimateToRelativeRadius()
Definition: vtkPointDensityFilter.h:152
vtkPointDensityFilter::SetDensityFormToNumberOfPoints
void SetDensityFormToNumberOfPoints()
Definition: vtkPointDensityFilter.h:168
vtkDataSet
abstract class to specify dataset behavior
Definition: vtkDataSet.h:62
vtkInformation
Store vtkAlgorithm input/output information.
Definition: vtkInformation.h:86
vtkX3D::info
Definition: vtkX3D.h:376
vtkImageAlgorithm::PrintSelf
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
vtkAlgorithm::New
static vtkAlgorithm * New()
vtkPointDensityFilter::AdjustDistance
double AdjustDistance
Definition: vtkPointDensityFilter.h:246
vtkPointDensityFilter::SetDensityFormToVolumeNormalized
void SetDensityFormToVolumeNormalized()
Definition: vtkPointDensityFilter.h:166
vtkAbstractPointLocator
abstract class to quickly locate points in 3-space
Definition: vtkAbstractPointLocator.h:41
vtkPointDensityFilter::FunctionClass
FunctionClass
This enum is used to classify the behavior of the function gradient.
Definition: vtkPointDensityFilter.h:234
vtkImageAlgorithm::FillInputPortInformation
int FillInputPortInformation(int port, vtkInformation *info) override
Fill the input port information objects for this algorithm.
VTK_DOUBLE_MAX
#define VTK_DOUBLE_MAX
Definition: vtkType.h:169