VTK
vtkGaussianSplatter.h
Go to the documentation of this file.
1/*=========================================================================
2
3 Program: Visualization Toolkit
4 Module: vtkGaussianSplatter.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=========================================================================*/
79#ifndef vtkGaussianSplatter_h
80#define vtkGaussianSplatter_h
81
82#include "vtkImagingHybridModule.h" // For export macro
83#include "vtkImageAlgorithm.h"
84
85#define VTK_ACCUMULATION_MODE_MIN 0
86#define VTK_ACCUMULATION_MODE_MAX 1
87#define VTK_ACCUMULATION_MODE_SUM 2
88
89class vtkDoubleArray;
91class vtkGaussianSplatterAlgorithm;
92
93class VTKIMAGINGHYBRID_EXPORT vtkGaussianSplatter : public vtkImageAlgorithm
94{
95public:
97 void PrintSelf(ostream& os, vtkIndent indent);
98
105
107
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
133 vtkSetClampMacro(Radius,double,0.0,1.0);
134 vtkGetMacro(Radius,double);
136
138
143 vtkSetClampMacro(ScaleFactor,double,0.0,VTK_DOUBLE_MAX);
144 vtkGetMacro(ScaleFactor,double);
146
148
153 vtkSetMacro(ExponentFactor,double);
154 vtkGetMacro(ExponentFactor,double);
156
158
163 vtkSetMacro(NormalWarping,int);
164 vtkGetMacro(NormalWarping,int);
165 vtkBooleanMacro(NormalWarping,int);
167
169
176 vtkSetClampMacro(Eccentricity,double,0.001,VTK_DOUBLE_MAX);
177 vtkGetMacro(Eccentricity,double);
179
181
184 vtkSetMacro(ScalarWarping,int);
185 vtkGetMacro(ScalarWarping,int);
186 vtkBooleanMacro(ScalarWarping,int);
188
190
195 vtkSetMacro(Capping,int);
196 vtkGetMacro(Capping,int);
197 vtkBooleanMacro(Capping,int);
199
201
205 vtkSetMacro(CapValue,double);
206 vtkGetMacro(CapValue,double);
208
210
216 vtkSetClampMacro(AccumulationMode,int,
218 vtkGetMacro(AccumulationMode,int);
220 {this->SetAccumulationMode(VTK_ACCUMULATION_MODE_MIN);}
222 {this->SetAccumulationMode(VTK_ACCUMULATION_MODE_MAX);}
224 {this->SetAccumulationMode(VTK_ACCUMULATION_MODE_SUM);}
227
229
233 vtkSetMacro(NullValue,double);
234 vtkGetMacro(NullValue,double);
236
238
243 vtkInformation *outInfo);
245 vtkInformation *outInfo);
247
249
254 friend class vtkGaussianSplatterAlgorithm;
255 double SamplePoint(double x[3]) //for compilers who can't handle this
256 {return (this->*Sample)(x);}
257 void SetScalar(int idx, double dist2, double *sPtr)
258 {
259 double v = (this->*SampleFactor)(this->S) * exp(static_cast<double>
260 (this->ExponentFactor*(dist2)/(this->Radius2)));
262
263 if ( ! this->Visited[idx] )
264 {
265 this->Visited[idx] = 1;
266 *sPtr = v;
267 }
268 else
269 {
270 switch (this->AccumulationMode)
271 {
273 if ( *sPtr > v )
274 {
275 *sPtr = v;
276 }
277 break;
279 if ( *sPtr < v )
280 {
281 *sPtr = v;
282 }
283 break;
285 *sPtr += v;
286 break;
287 }
288 }//not first visit
289 }
290
291protected:
294
303
304 int SampleDimensions[3]; // dimensions of volume to splat into
305 double Radius; // maximum distance splat propagates (as fraction 0->1)
306 double ExponentFactor; // scale exponent of gaussian function
307 double ModelBounds[6]; // bounding box of splatting dimensions
308 int NormalWarping; // on/off warping of splat via normal
309 double Eccentricity;// elliptic distortion due to normals
310 int ScalarWarping; // on/off warping of splat via scalar
311 double ScaleFactor; // splat size influenced by scale factor
312 int Capping; // Cap side of volume to close surfaces
313 double CapValue; // value to use for capping
314 int AccumulationMode; // how to combine scalar values
315
316 double Gaussian(double x[3]);
317 double EccentricGaussian(double x[3]);
318 double ScalarSampling(double s)
319 {return this->ScaleFactor * s;}
320 double PositionSampling(double)
321 {return this->ScaleFactor;}
322
323private:
324 double Radius2;
325 double (vtkGaussianSplatter::*Sample)(double x[3]);
326 double (vtkGaussianSplatter::*SampleFactor)(double s);
327 char *Visited;
328 double Eccentricity2;
329 double *P;
330 double *N;
331 double S;
332 double Origin[3];
333 double Spacing[3];
334 double SplatDistance[3];
335 double NullValue;
336
337private:
338 vtkGaussianSplatter(const vtkGaussianSplatter&) VTK_DELETE_FUNCTION;
339 void operator=(const vtkGaussianSplatter&) VTK_DELETE_FUNCTION;
340};
341
342#endif
abstract superclass for composite (multi-block or AMR) datasets
abstract class to specify dataset behavior
Definition: vtkDataSet.h:63
dynamic, self-adjusting array of double
splat points into a volume with an elliptical, Gaussian distribution
virtual int FillInputPortInformation(int port, vtkInformation *info)
Fill the input port information objects for this algorithm.
double EccentricGaussian(double x[3])
double SamplePoint(double x[3])
static vtkGaussianSplatter * New()
Construct object with dimensions=(50,50,50); automatic computation of bounds; a splat radius of 0....
double PositionSampling(double)
virtual int RequestData(vtkInformation *, vtkInformationVector **, vtkInformationVector *)
This is called in response to a REQUEST_DATA request from the executive.
void Cap(vtkDoubleArray *s)
double ScalarSampling(double s)
virtual int RequestInformation(vtkInformation *, vtkInformationVector **, vtkInformationVector *)
Subclasses can reimplement this method to collect information from their inputs and set information f...
void SetScalar(int idx, double dist2, double *sPtr)
void ComputeModelBounds(vtkDataSet *input, vtkImageData *output, vtkInformation *outInfo)
Compute the size of the sample bounding box automatically from the input data.
void ComputeModelBounds(vtkCompositeDataSet *input, vtkImageData *output, vtkInformation *outInfo)
double Gaussian(double x[3])
void SetSampleDimensions(int dim[3])
void PrintSelf(ostream &os, vtkIndent indent)
Methods invoked by print to print information about the object including superclasses.
void SetSampleDimensions(int i, int j, int k)
Set / get the dimensions of the sampling structured point set.
const char * GetAccumulationModeAsString()
Generic algorithm superclass for image algs.
topologically and geometrically regular array of data
Definition: vtkImageData.h:46
a simple class to control print indentation
Definition: vtkIndent.h:40
Store zero or more vtkInformation instances.
Store vtkAlgorithm input/output information.
@ info
Definition: vtkX3D.h:376
@ port
Definition: vtkX3D.h:447
#define VTK_ACCUMULATION_MODE_SUM
#define VTK_ACCUMULATION_MODE_MIN
#define VTK_ACCUMULATION_MODE_MAX
vtkSetMacro(IgnoreDriverBugs, bool)
Updates the extensions string.
vtkBooleanMacro(IgnoreDriverBugs, bool)
Updates the extensions string.
#define VTK_DOUBLE_MAX
Definition: vtkType.h:163