#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 | |
Processor * | NEW () |
Static Public Attributes | |
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 6484 of file processor.h.
|
Get the descrition of this specific processor. This function must be overwritten by a subclass.
Implements EMAN::Processor. Definition at line 6494 of file processor.h. 06495 { 06496 return "Replace a source image as a random noise, the random value is gaussian distributed"; 06497 }
|
|
Get the processor's name. Each processor is identified by a unique name.
Implements EMAN::Processor. Definition at line 6489 of file processor.h. 06490 {
06491 return NAME;
06492 }
|
|
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 6504 of file processor.h. References EMAN::TypeDict::put(). 06505 { 06506 TypeDict d; 06507 d.put("sigma", EMObject::FLOAT, "sigma value of gausian distributed noise, default is 0.5"); 06508 d.put("mean", EMObject::FLOAT, "mean value of gausian distributed noise, default is zero."); 06509 d.put("seed", EMObject::INT, "the seed for random number generator, default is not to reseed."); 06510 06511 return d; 06512 }
|
|
Definition at line 6499 of file processor.h. 06500 { 06501 return new TestImageNoiseGauss(); 06502 }
|
|
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.
Implements EMAN::Processor. Definition at line 7648 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(). 07649 { 07650 preprocess(image); 07651 07652 float sigma = params["sigma"]; 07653 if (sigma<=0) { sigma = 1.0; } 07654 float mean = params["mean"]; 07655 07656 Randnum * r = Randnum::Instance(); 07657 if (params.has_key("seed")) { 07658 r->set_seed((int)params["seed"]); 07659 } 07660 07661 float *dat = image->get_data(); 07662 size_t size = nx*ny*nz; 07663 for (size_t i=0; i<size; ++i) { 07664 dat[i] = r->get_gauss_rand(mean, sigma); 07665 } 07666 07667 image->update(); 07668 }
|
|
Definition at line 208 of file processor.cpp. |