Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members

EMAN::TestImageNoiseGauss Class Reference

Replace a source image with gaussian distributed random noise If you don't provide a seed at all, it should be seeded using the best available source of randomness( time(0) in this implementation). More...

#include <processor.h>

Inheritance diagram for EMAN::TestImageNoiseGauss:

Inheritance graph
[legend]
Collaboration diagram for EMAN::TestImageNoiseGauss:

Collaboration graph
[legend]
List of all members.

Public Member Functions

virtual void process_inplace (EMData *image)
 To process an image in-place.
virtual string get_name () const
 Get the processor's name.
virtual string get_desc () const
 Get the descrition of this specific processor.
virtual TypeDict get_param_types () const
 Get processor parameter information in a dictionary.

Static Public Member Functions

ProcessorNEW ()

Static Public Attributes

const string NAME = "testimage.noise.gauss"

Detailed Description

Replace a source image with gaussian distributed random noise If you don't provide a seed at all, it should be seeded using the best available source of randomness( time(0) in this implementation).

The testimage classes using random numbers should take an int 'seed' parameter. If this parameter is provided, it will be cast into an unsigned int. This will permit initialization to a known state if desired.

Parameters:
sigma sigma value of gausian distributed noise, default is 0.5
mean mean value of gausian distributed noise, default is zero
seed mean value of gausian distributed noise, default is zero

Definition at line 6312 of file processor.h.


Member Function Documentation

virtual string EMAN::TestImageNoiseGauss::get_desc  )  const [inline, virtual]
 

Get the descrition of this specific processor.

This function must be overwritten by a subclass.

Returns:
The description of this processor.

Implements EMAN::Processor.

Definition at line 6322 of file processor.h.

06323                 {
06324                         return "Replace a source image as a random noise, the random value is gaussian distributed";
06325                 }

virtual string EMAN::TestImageNoiseGauss::get_name  )  const [inline, virtual]
 

Get the processor's name.

Each processor is identified by a unique name.

Returns:
The processor's name.

Implements EMAN::Processor.

Definition at line 6317 of file processor.h.

06318                 {
06319                         return NAME;
06320                 }

virtual TypeDict EMAN::TestImageNoiseGauss::get_param_types  )  const [inline, virtual]
 

Get processor parameter information in a dictionary.

Each parameter has one record in the dictionary. Each record contains its name, data-type, and description.

Returns:
A dictionary containing the parameter info.

Reimplemented from EMAN::Processor.

Definition at line 6332 of file processor.h.

References EMAN::TypeDict::put().

06333                 {
06334                         TypeDict d;
06335                         d.put("sigma", EMObject::FLOAT, "sigma value of gausian distributed noise, default is 0.5");
06336                         d.put("mean", EMObject::FLOAT, "mean value of gausian distributed noise, default is zero.");
06337                         d.put("seed", EMObject::INT, "the seed for random number generator, default is not to reseed.");
06338 
06339                         return d;
06340                 }

Processor* EMAN::TestImageNoiseGauss::NEW  )  [inline, static]
 

Definition at line 6327 of file processor.h.

06328                 {
06329                         return new TestImageNoiseGauss();
06330                 }

void TestImageNoiseGauss::process_inplace EMData image  )  [virtual]
 

To process an image in-place.

For those processors which can only be processed out-of-place, override this function to just print out some error message to remind user call the out-of-place version.

Parameters:
image The image to be processed.

Implements EMAN::Processor.

Definition at line 7684 of file processor.cpp.

References EMAN::EMData::get_data(), EMAN::Randnum::get_gauss_rand(), EMAN::Dict::has_key(), EMAN::Randnum::Instance(), nx, ny, EMAN::TestImageProcessor::preprocess(), EMAN::Randnum::set_seed(), and EMAN::EMData::update().

07685 {
07686         preprocess(image);
07687 
07688         float sigma = params["sigma"];
07689         if (sigma<=0) { sigma = 1.0; }
07690         float mean = params["mean"];
07691 
07692         Randnum * r = Randnum::Instance();
07693         if (params.has_key("seed")) {
07694                 r->set_seed((int)params["seed"]);
07695         }
07696 
07697         float *dat = image->get_data();
07698         size_t size = nx*ny*nz;
07699         for (size_t i=0; i<size; ++i) {
07700                 dat[i] = r->get_gauss_rand(mean, sigma);
07701         }
07702 
07703         image->update();
07704 }


Member Data Documentation

const string TestImageNoiseGauss::NAME = "testimage.noise.gauss" [static]
 

Definition at line 203 of file processor.cpp.


The documentation for this class was generated from the following files:
Generated on Thu Dec 9 13:48:25 2010 for EMAN2 by  doxygen 1.3.9.1