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 =========================================================================*/
77 #ifndef vtkPointDensityFilter_h
78 #define vtkPointDensityFilter_h
79 
80 #include "vtkFiltersPointsModule.h" // For export macro
81 #include "vtkImageAlgorithm.h"
82 
83 #define VTK_DENSITY_ESTIMATE_FIXED_RADIUS 0
84 #define VTK_DENSITY_ESTIMATE_RELATIVE_RADIUS 1
85 
86 #define VTK_DENSITY_FORM_VOLUME_NORM 0
87 #define VTK_DENSITY_FORM_NPTS 1
88 
90 
91 class VTKFILTERSPOINTS_EXPORT vtkPointDensityFilter : public vtkImageAlgorithm
92 {
93 public:
95 
99  static vtkPointDensityFilter *New();
101  void PrintSelf(ostream& os, vtkIndent indent) override;
103 
105 
111  void SetSampleDimensions(int i, int j, int k);
112  void SetSampleDimensions(int dim[3]);
113  vtkGetVectorMacro(SampleDimensions,int,3);
115 
117 
123  vtkSetVector6Macro(ModelBounds,double);
124  vtkGetVectorMacro(ModelBounds,double,6);
126 
128 
134  vtkSetClampMacro(AdjustDistance,double,-1.0,1.0);
135  vtkGetMacro(AdjustDistance,double);
137 
139 
144  vtkSetClampMacro(DensityEstimate,int, VTK_DENSITY_ESTIMATE_FIXED_RADIUS,
146  vtkGetMacro(DensityEstimate,int);
148  {this->SetDensityEstimate(VTK_DENSITY_ESTIMATE_FIXED_RADIUS);}
150  {this->SetDensityEstimate(VTK_DENSITY_ESTIMATE_RELATIVE_RADIUS);}
151  const char *GetDensityEstimateAsString();
153 
155 
160  vtkSetClampMacro(DensityForm,int, VTK_DENSITY_FORM_VOLUME_NORM,
162  vtkGetMacro(DensityForm,int);
164  {this->SetDensityForm(VTK_DENSITY_FORM_VOLUME_NORM);}
166  {this->SetDensityForm(VTK_DENSITY_FORM_NPTS);}
167  const char *GetDensityFormAsString();
169 
171 
176  vtkSetClampMacro(Radius,double,0.0,VTK_DOUBLE_MAX);
177  vtkGetMacro(Radius,double);
179 
181 
188  vtkSetClampMacro(RelativeRadius,double,0.0,VTK_DOUBLE_MAX);
189  vtkGetMacro(RelativeRadius,double);
191 
193 
197  vtkSetMacro(ScalarWeighting,bool);
198  vtkGetMacro(ScalarWeighting,bool);
199  vtkBooleanMacro(ScalarWeighting,bool);
201 
203 
210  vtkSetMacro(ComputeGradient,bool);
211  vtkGetMacro(ComputeGradient,bool);
212  vtkBooleanMacro(ComputeGradient,bool);
214 
216 
221  void SetLocator(vtkAbstractPointLocator *locator);
222  vtkGetObjectMacro(Locator,vtkAbstractPointLocator);
224 
232  {
233  ZERO=0,
234  NON_ZERO=1
235  };
236 
237 protected:
239  ~vtkPointDensityFilter() override;
240 
241  int SampleDimensions[3]; // dimensions of volume over which to estimate density
242  double ModelBounds[6]; // bounding box of splatting dimensions
243  double AdjustDistance; // how much to pad the model bounds if automatically computed
244  double Origin[3], Spacing[3]; // output geometry
245  int DensityEstimate; // how to compute the density
246  int DensityForm; // how to represent density value
247  double RelativeRadius; // Radius factor for estimating density
248  double Radius; // Actually radius used
249  bool ScalarWeighting; // Are point densities weighted or not?
250  bool ComputeGradient; // Compute the gradient vector and magnitude
251  vtkAbstractPointLocator *Locator; //accelerate point searches
252 
253  int FillInputPortInformation(int port, vtkInformation* info) override;
256  vtkInformationVector *) override;
259  vtkInformationVector *) override;
260 
261  void ComputeModelBounds(vtkDataSet *input, vtkImageData *output,
262  vtkInformation *outInfo);
263 
264 private:
266  void operator=(const vtkPointDensityFilter&) = delete;
267 };
268 
269 #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:84
VTK_DENSITY_FORM_VOLUME_NORM
#define VTK_DENSITY_FORM_VOLUME_NORM
Definition: vtkPointDensityFilter.h:86
vtkInformationVector
Store zero or more vtkInformation instances.
Definition: vtkInformationVector.h:35
vtkPointDensityFilter::DensityForm
int DensityForm
Definition: vtkPointDensityFilter.h:246
VTK_DENSITY_FORM_NPTS
#define VTK_DENSITY_FORM_NPTS
Definition: vtkPointDensityFilter.h:87
vtkImageAlgorithm.h
VTK_DENSITY_ESTIMATE_FIXED_RADIUS
#define VTK_DENSITY_ESTIMATE_FIXED_RADIUS
Definition: vtkPointDensityFilter.h:83
vtkPointDensityFilter::Radius
double Radius
Definition: vtkPointDensityFilter.h:248
vtkImageAlgorithm
Generic algorithm superclass for image algs.
Definition: vtkImageAlgorithm.h:37
vtkPointDensityFilter::Locator
vtkAbstractPointLocator * Locator
Definition: vtkPointDensityFilter.h:251
vtkPointDensityFilter::ComputeGradient
bool ComputeGradient
Definition: vtkPointDensityFilter.h:250
vtkPointDensityFilter::DensityEstimate
int DensityEstimate
Definition: vtkPointDensityFilter.h:245
vtkPointDensityFilter::SetDensityEstimateToFixedRadius
void SetDensityEstimateToFixedRadius()
Definition: vtkPointDensityFilter.h:147
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:91
vtkImageData
topologically and geometrically regular array of data
Definition: vtkImageData.h:39
vtkIndent
a simple class to control print indentation
Definition: vtkIndent.h:33
vtkPointDensityFilter::RelativeRadius
double RelativeRadius
Definition: vtkPointDensityFilter.h:247
vtkPointDensityFilter::ScalarWeighting
bool ScalarWeighting
Definition: vtkPointDensityFilter.h:249
vtkPointDensityFilter::SetDensityEstimateToRelativeRadius
void SetDensityEstimateToRelativeRadius()
Definition: vtkPointDensityFilter.h:149
vtkPointDensityFilter::SetDensityFormToNumberOfPoints
void SetDensityFormToNumberOfPoints()
Definition: vtkPointDensityFilter.h:165
vtkDataSet
abstract class to specify dataset behavior
Definition: vtkDataSet.h:56
vtkInformation
Store vtkAlgorithm input/output information.
Definition: vtkInformation.h:80
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:243
vtkPointDensityFilter::SetDensityFormToVolumeNormalized
void SetDensityFormToVolumeNormalized()
Definition: vtkPointDensityFilter.h:163
vtkAbstractPointLocator
abstract class to quickly locate points in 3-space
Definition: vtkAbstractPointLocator.h:38
vtkPointDensityFilter::FunctionClass
FunctionClass
This enum is used to classify the behavior of the function gradient.
Definition: vtkPointDensityFilter.h:231
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