#include <processor.h>
Inheritance diagram for EMAN::TestImageNoiseGauss:
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 | |
static Processor * | NEW () |
Static Public Attributes | |
static const string | NAME = "testimage.noise.gauss" |
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.
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 6608 of file processor.h.
virtual string EMAN::TestImageNoiseGauss::get_desc | ( | ) | const [inline, virtual] |
Get the descrition of this specific processor.
This function must be overwritten by a subclass.
Implements EMAN::Processor.
Definition at line 6618 of file processor.h.
06619 { 06620 return "Replace a source image as a random noise, the random value is gaussian distributed"; 06621 }
virtual string EMAN::TestImageNoiseGauss::get_name | ( | ) | const [inline, virtual] |
Get the processor's name.
Each processor is identified by a unique name.
Implements EMAN::Processor.
Definition at line 6613 of file processor.h.
References NAME.
06614 { 06615 return NAME; 06616 }
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.
Reimplemented from EMAN::Processor.
Definition at line 6628 of file processor.h.
References EMAN::EMObject::FLOAT, EMAN::EMObject::INT, and EMAN::TypeDict::put().
06629 { 06630 TypeDict d; 06631 d.put("sigma", EMObject::FLOAT, "sigma value of gausian distributed noise, default is 0.5"); 06632 d.put("mean", EMObject::FLOAT, "mean value of gausian distributed noise, default is zero."); 06633 d.put("seed", EMObject::INT, "the seed for random number generator, default is not to reseed."); 06634 06635 return d; 06636 }
static Processor* EMAN::TestImageNoiseGauss::NEW | ( | ) | [inline, static] |
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.
image | The image to be processed. |
Implements EMAN::Processor.
Definition at line 8019 of file processor.cpp.
References EMAN::EMData::get_data(), EMAN::Randnum::get_gauss_rand(), EMAN::Dict::has_key(), EMAN::Randnum::Instance(), mean(), EMAN::Processor::params, EMAN::TestImageProcessor::preprocess(), EMAN::Randnum::set_seed(), and EMAN::EMData::update().
08020 { 08021 preprocess(image); 08022 08023 float sigma = params["sigma"]; 08024 if (sigma<=0) { sigma = 1.0; } 08025 float mean = params["mean"]; 08026 08027 Randnum * r = Randnum::Instance(); 08028 if (params.has_key("seed")) { 08029 r->set_seed((int)params["seed"]); 08030 } 08031 08032 float *dat = image->get_data(); 08033 size_t size = (size_t)nx*ny*nz; 08034 for (size_t i=0; i<size; ++i) { 08035 dat[i] = r->get_gauss_rand(mean, sigma); 08036 } 08037 08038 image->update(); 08039 }
const string TestImageNoiseGauss::NAME = "testimage.noise.gauss" [static] |