/usr/include/vtk-7.1/vtkLICNoiseHelper.h is in libvtk7-dev 7.1.1+dfsg1-2.
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 | /*=========================================================================
Program: Visualization Toolkit
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.
=========================================================================*/
/**
* @class vtkLICNoiseHelper
*
* A small collection of noise routines for LIC
*/
#ifndef vtkLICNoiseHelper_h
#define vtkLICNoiseHelper_h
#include "vtkRenderingLICOpenGL2Module.h" // for export
#include "vtkMinimalStandardRandomSequence.h"
class vtkImageData;
/**
An interface to a random number generator. We can't use
c stdlib since we're not gauranteed to get consistent.
sequences across platform or library version and that
would prevent consistent output during regression tests.
*/
class vtkLICRandomNumberGeneratorInterface
{
public:
vtkLICRandomNumberGeneratorInterface()
{
this->RNG = vtkMinimalStandardRandomSequence::New();
}
~vtkLICRandomNumberGeneratorInterface()
{
this->RNG->Delete();
}
/**
Seed the random number generator
*/
void SetSeed(int seedVal)
{
this->RNG->SetSeed(seedVal);
}
/**
Get a random number in the range of 0 to 1.
*/
double GetRandomNumber()
{
double val = this->RNG->GetValue();
this->RNG->Next();
return val;
}
private:
void operator=(const vtkLICRandomNumberGeneratorInterface &) VTK_DELETE_FUNCTION;
vtkLICRandomNumberGeneratorInterface(const vtkLICRandomNumberGeneratorInterface &) VTK_DELETE_FUNCTION;
private:
vtkMinimalStandardRandomSequence *RNG;
};
/**
2D Noise Generator. Generate arrays for use as noise texture
in the LIC algorithm. Can generate noise with uniform or Gaussian
distributions, with a desired number of noise levels, and a
desired frequency (f < 1 is impulse noise).
*/
class vtkLICRandomNoise2D
{
public:
vtkLICRandomNoise2D(){}
//@{
/**
* Generate a patch of random gray scale values along with an
* alpha channel (in vtk array format). The data should be
* deleted by later calling DeleteValues. Grain size and sideLen
* may be modified to match the noise generator requirements,
* returned arrays will be sized accordingly.
* type - UNIFORM=0, GAUSSIAN=1, PERLIN=2
* sideLen - side length of square patch in pixels (in/out)
* grainSize - grain size of noise values in pixels (in/out)
* nLevels - number of noise intesity levels
* minNoiseVal - set the min for noise pixels (position distribution)
* maxNoiseVal - set the max for noise pixels (position distribution)
* impulseProb - probability of impulse noise,1 touches every pixel
* impulseBgNoiseVal - set the background color for impulse noise
* seed - seed for random number generator
*/
enum {
UNIFORM = 0,
GAUSSIAN = 1,
PERLIN = 2
};
float *Generate(
int type,
int &sideLen,
int &grainLize,
float minNoiseVal,
float maxNoiseVal,
int nLevels,
double impulseProb,
float impulseBgNoiseVal,
int seed);
//@}
/**
* Delete the passed in array of values.
*/
void DeleteValues(unsigned char *vals){ free(vals); }
static vtkImageData *GetNoiseResource();
private:
/**
* Generate noise with a uniform distribution.
*/
float *GenerateUniform(
int sideLen,
int grainLize,
float minNoiseVal,
float maxNoiseVal,
int nLevels,
double impulseProb,
float impulseBgNoiseVal,
int seed);
/**
* Generate noise with a Gaussian distribution.
*/
float *GenerateGaussian(
int sideLen,
int grainLize,
float minNoiseVal,
float maxNoiseVal,
int nLevels,
double impulseProb,
float impulseBgNoiseVal,
int seed);
/**
* Generate Perlin noise with a Gaussian distribution.
*/
float *GeneratePerlin(
int sideLen,
int grainLize,
float minNoiseVal,
float maxNoiseVal,
int nLevels,
double impulseProb,
float impulseBgNoiseVal,
int seed);
/**
* A way of controling the probability (from 0.0 to 1.0) that you
* generate values. returns 1 if you should generate a value.
* for example this is used to control the frequency of impulse
* noise.
*/
int ShouldGenerateValue(double prob);
/**
* Get a valid the length of the side of the patch and grains size in pixels
* given a desired patch side length and a grain size. This ensures that all
* grains are the same size.
*/
void GetValidDimensionAndGrainSize(int type, int &dim, int &grainSize);
private:
vtkLICRandomNumberGeneratorInterface ValueGen;
vtkLICRandomNumberGeneratorInterface ProbGen;
};
#endif
// VTK-HeaderTest-Exclude: vtkLICNoiseHelper.h
|