 |
Bsoft
2.1.0
Bernard's software package
|
Go to the documentation of this file.
36 if ( rmin < dtmin ) rmin = dtmin;
37 if ( rmax > dtmax ) rmax = dtmax;
40 cout <<
"Generating a random image with a uniform distribution:" << endl;
41 cout <<
"Minimum and maximum: " << rmin <<
" " << rmax << endl << endl;
49 for ( i=0; i<datasize; i++ )
add(i, random()*range + rmin);
75 error_show(
"Error in Bimage::noise_gaussian: The standard deviation for a Gaussian distribution must be > 0!", __FILE__, __LINE__);
80 cout <<
"Generating a random image with a gaussian distribution:" << endl;
81 cout <<
"Average and standard deviation: " << ravg <<
" " << rstd << endl << endl;
88 for ( i=0; i<datasize; i++ )
118 error_show(
"Error in Bimage::noise_poisson: The average for a poisson distribution must be > 0!", __FILE__, __LINE__);
123 cout <<
"Generating a random image with a poisson distribution:" << endl;
124 cout <<
"Average: " << ravg << endl << endl;
131 for ( i=0; i<datasize; i++ )
159 cout <<
"Generating a random image with a logistical differential distribution:" << endl;
160 cout <<
"Average and standard deviation: " << ravg <<
" " << rstd << endl << endl;
167 for ( i=0; i<datasize; i++ )
186 long i, j, nn, xx, yy, zz, cc, imgsize(x*y*z);
187 double x2, y2, z2, s2, w,
sum;
188 double fac(-alpha/4);
192 cout <<
"Generating a spectral noise image:" << endl;
193 cout <<
"Alpha: " << alpha << endl << endl;
196 for ( i=nn=0; nn<n; nn++ ) {
198 for ( zz=0; zz<z; zz++ ) {
200 if ( z2 >= 0.5 ) z2 -= 1;
202 for ( yy=0; yy<y; yy++ ) {
204 if ( y2 >= 0.5 ) y2 -= 1;
206 for ( xx=0; xx<x; xx++, i++ ) {
208 if ( x2 >= 0.5 ) x2 -= 1;
213 for ( cc=0, j=i*c; cc<c; cc++, j++ )
214 set(j, w*(random()*range-1));
220 sum = sqrt(
sum/(3*imgsize));
221 for ( j=nn*imgsize; j<(nn+1)*imgsize; j++ )
set(j,
complex(j)/
sum);
void set(long j, double v)
Sets a single value at the given index.
double random_logistical(double avg, double std)
Generates a value with a logistical random distribution.
Header file for functions for creating random images.
void sum(long m, Bimage **p)
Sums an array of images with their FOM blocks.
int error_show(string message, string file, int line)
Displays the error with file and line reference.
double random_gaussian(double avg, double std)
Generates a value with a gaussian random distribution.
int noise_uniform(double rmin, double rmax)
Generates an image with a uniform random distribution of densities.
double random_poisson(double avg)
Generates a value deviating from the average based on a poisson distribution.
void add(long j, double v)
int noise_logistical(double ravg, double rstd)
Generates an image with a gaussian random distribution of densities.
int noise_gaussian(double ravg=0, double rstd=1)
Generates an image with a gaussian random distribution of densities.
Complex< double > complex(long j)
Returns a complex value at the given index.
Header file for image class.
Header file for general utilities.
long random_seed()
Gets a random seed and sets the flag.
int noise_poisson(double ravg)
Generates an image with a poisson random distribution of densities.
long get_rand_max()
Finds the maximum random number for a system.
long statistics()
Calculates the statistics for an image.
int noise_spectral(double alpha)
Generates a noise map with a defined spectral decay.