/usr/include/vtk-6.2/vtkFastSplatter.h is in libvtk6-dev 6.2.0+dfsg1-10build1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 | /*=========================================================================
Program: Visualization Toolkit
Module: vtkFastSplatter.h
Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
All rights reserved.
See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notice for more information.
=========================================================================*/
/*----------------------------------------------------------------------------
Copyright (c) Sandia Corporation
See Copyright.txt or http://www.paraview.org/HTML/Copyright.html for details.
----------------------------------------------------------------------------*/
// .NAME vtkFastSplatter - A splatter optimized for splatting single kernels.
//
// .SECTION Description
//
// vtkFastSplatter takes any vtkPointSet as input (of which vtkPolyData and
// vtkUnstructuredGrid inherit). Each point in the data set is considered to be
// an impulse. These impulses are convolved with a given splat image. In other
// words, the splat image is added to the final image at every place where there
// is an input point.
//
// Note that point and cell data are thrown away. If you want a sampling
// of unstructured points consider vtkGaussianSplatter or vtkShepardMethod.
//
// Use input port 0 for the impulse data (vtkPointSet), and input port 1 for
// the splat image (vtkImageData)
//
// .SECTION Bugs
//
// Any point outside of the extents of the image is thrown away, even if it is
// close enough such that it's convolution with the splat image would overlap
// the extents.
//
#ifndef vtkFastSplatter_h
#define vtkFastSplatter_h
#include "vtkImagingHybridModule.h" // For export macro
#include "vtkImageAlgorithm.h"
class VTKIMAGINGHYBRID_EXPORT vtkFastSplatter : public vtkImageAlgorithm
{
public:
vtkTypeMacro(vtkFastSplatter, vtkImageAlgorithm);
static vtkFastSplatter *New();
virtual void PrintSelf(ostream &os, vtkIndent indent);
// Description:
// Set / get the (xmin,xmax, ymin,ymax, zmin,zmax) bounding box in which
// the sampling is performed. If any of the (min,max) bounds values are
// min >= max, then the bounds will be computed automatically from the input
// data. Otherwise, the user-specified bounds will be used.
vtkSetVector6Macro(ModelBounds,double);
vtkGetVectorMacro(ModelBounds,double,6);
// Description:
// Set/get the dimensions of the output image
vtkSetVector3Macro( OutputDimensions, int );
vtkGetVector3Macro( OutputDimensions, int );
//BTX
enum { NoneLimit, ClampLimit, ScaleLimit, FreezeScaleLimit };
//ETX
// Description:
// Set/get the way voxel values will be limited. If this is set to None (the
// default), the output can have arbitrarily large values. If set to clamp,
// the output will be clamped to [MinValue,MaxValue]. If set to scale, the
// output will be linearly scaled between MinValue and MaxValue.
vtkSetMacro(LimitMode, int);
vtkGetMacro(LimitMode, int);
void SetLimitModeToNone() { this->SetLimitMode(NoneLimit); }
void SetLimitModeToClamp() { this->SetLimitMode(ClampLimit); }
void SetLimitModeToScale() { this->SetLimitMode(ScaleLimit); }
void SetLimitModeToFreezeScale() { this->SetLimitMode(FreezeScaleLimit); }
// Description:
// See the LimitMode method.
vtkSetMacro(MinValue, double);
vtkGetMacro(MinValue, double);
vtkSetMacro(MaxValue, double);
vtkGetMacro(MaxValue, double);
// Description:
// This returns the number of points splatted (as opposed to
// discarded for being outside the image) during the previous pass.
vtkGetMacro(NumberOfPointsSplatted, int);
// Description:
// Convenience function for connecting the splat algorithm source.
// This is provided mainly for convenience using the filter with
// ParaView, VTK users should prefer SetInputConnection(1, splat) instead.
void SetSplatConnection(vtkAlgorithmOutput*);
protected:
vtkFastSplatter();
virtual ~vtkFastSplatter();
double ModelBounds[6];
int OutputDimensions[3];
int LimitMode;
double MinValue;
double MaxValue;
double FrozenScale;
vtkImageData *Buckets;
virtual int FillInputPortInformation(int port, vtkInformation *info);
virtual int RequestInformation(vtkInformation *,
vtkInformationVector **,
vtkInformationVector *);
virtual int RequestUpdateExtent(vtkInformation*,
vtkInformationVector**,
vtkInformationVector*);
virtual int RequestData(vtkInformation *,
vtkInformationVector **,
vtkInformationVector *);
// Used internally for converting points in world space to indices in
// the output image.
double Origin[3];
double Spacing[3];
// This is updated every time the filter executes
int NumberOfPointsSplatted;
// Used internally to track the data range. When the limit mode is
// set to FreezeScale, the data will be scaled as if this were the
// range regardless of what it actually is.
double LastDataMinValue;
double LastDataMaxValue;
private:
vtkFastSplatter(const vtkFastSplatter &); // Not implemented
void operator=(const vtkFastSplatter &); // Not implemented
};
//BTX
//-----------------------------------------------------------------------------
template<class T>
void vtkFastSplatterClamp(T *array, vtkIdType arraySize,
T minValue, T maxValue)
{
for (vtkIdType i = 0; i < arraySize; i++)
{
if (array[i] < minValue) array[i] = minValue;
if (array[i] > maxValue) array[i] = maxValue;
}
}
//-----------------------------------------------------------------------------
template<class T>
void vtkFastSplatterScale(T *array, int numComponents, vtkIdType numTuples,
T minValue, T maxValue,
double *dataMinValue, double *dataMaxValue)
{
T *a;
T min, max;
*dataMinValue = 0;
*dataMaxValue = 0;
vtkIdType t;
for (int c = 0; c < numComponents; c++)
{
// Find the min and max values in the array.
a = array+c;
min = max = *a;
a += numComponents;
for (t = 1; t < numTuples; t++, a += numComponents)
{
if (min > *a) min = *a;
if (max < *a) max = *a;
}
// Bias everything so that 0 is really the minimum.
if (min != 0)
{
for (t = 0, a = array+c; t < numTuples; t++, a += numComponents)
{
*a -= min;
}
}
// Scale the values.
if (max != min)
{
for (t = 0, a = array+c; t < numTuples; t++, a += numComponents)
{
*a = ((maxValue-minValue)*(*a))/(max-min);
}
}
// Bias everything again so that it lies in the correct range.
if (minValue != 0)
{
for (t = 0, a = array+c; t < numTuples; t++, a += numComponents)
{
*a += minValue;
}
}
if (c == 0)
{
*dataMinValue = min;
*dataMaxValue = max;
}
}
}
//-----------------------------------------------------------------------------
template<class T>
void vtkFastSplatterFrozenScale(T *array,
int numComponents, vtkIdType numTuples,
T minValue, T maxValue,
double min, double max)
{
T *a;
vtkIdType t;
for (int c = 0; c < numComponents; c++)
{
// Bias everything so that 0 is really the minimum.
if (min != 0)
{
for (t = 0, a = array+c; t < numTuples; t++, a += numComponents)
{
*a -= static_cast<T>(min);
}
}
// Scale the values.
if (max != min)
{
for (t = 0, a = array+c; t < numTuples; t++, a += numComponents)
{
*a = static_cast<T>(((maxValue-minValue)*(*a))/(max-min));
}
}
// Bias everything again so that it lies in the correct range.
if (minValue != 0)
{
for (t = 0, a = array+c; t < numTuples; t++, a += numComponents)
{
*a += minValue;
}
}
}
}
//ETX
#endif //vtkFastSplatter_h
|