#include <processor.h>
Inheritance diagram for EMAN::AddNoiseProcessor:


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 TypeDict | get_param_types () const |
| Get processor parameter information in a dictionary. | |
| virtual string | get_desc () const |
| Get the descrition of this specific processor. | |
Static Public Member Functions | |
| Processor * | NEW () |
Static Public Attributes | |
| const string | NAME = "math.addnoise" |
Protected Member Functions | |
| virtual float | get_sigma (EMData *) |
| noise | noise factor used to generate Gaussian distribution random noise | |
| seed | seed for random number generator |
Definition at line 4528 of file processor.h.
|
|
Get the descrition of this specific processor. This function must be overwritten by a subclass.
Implements EMAN::Processor. Reimplemented in EMAN::AddSigmaNoiseProcessor. Definition at line 4551 of file processor.h. 04552 {
04553 return "add noise to an image, image multiply by noise then add a random value";
04554 }
|
|
|
Get the processor's name. Each processor is identified by a unique name.
Implements EMAN::Processor. Reimplemented in EMAN::AddSigmaNoiseProcessor. Definition at line 4533 of file processor.h. 04534 {
04535 return NAME;
04536 }
|
|
|
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 4543 of file processor.h. References EMAN::TypeDict::put(). 04544 {
04545 TypeDict d;
04546 d.put("noise", EMObject::FLOAT, "noise factor used to generate Gaussian distribution random noise");
04547 d.put("seed", EMObject::INT, "seed for random number generator");
04548 return d;
04549 }
|
|
|
Reimplemented in EMAN::AddSigmaNoiseProcessor. Definition at line 4559 of file processor.h. Referenced by process_inplace(). 04560 {
04561 return 1.0;
04562 }
|
|
|
Reimplemented in EMAN::AddSigmaNoiseProcessor. Definition at line 4538 of file processor.h. 04539 {
04540 return new AddNoiseProcessor();
04541 }
|
|
|
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 4370 of file processor.cpp. References EMAN::EMData::get_data(), EMAN::Randnum::get_gauss_rand(), get_sigma(), EMAN::EMData::get_size(), EMAN::Dict::has_key(), EMAN::Randnum::Instance(), LOGWARN, EMAN::Randnum::set_seed(), and EMAN::EMData::update(). 04371 {
04372 if (!image) {
04373 LOGWARN("NULL Image");
04374 return;
04375 }
04376
04377 Randnum * randnum = Randnum::Instance();
04378 if(params.has_key("seed")) {
04379 randnum->set_seed((int)params["seed"]);
04380 }
04381
04382 float addnoise = params["noise"];
04383 addnoise *= get_sigma(image);
04384 float *dat = image->get_data();
04385
04386 for (size_t j = 0; j < image->get_size(); ++j) {
04387 dat[j] += randnum->get_gauss_rand(addnoise, addnoise / 2);
04388 }
04389
04390 image->update();
04391 }
|
|
|
Reimplemented in EMAN::AddSigmaNoiseProcessor. Definition at line 158 of file processor.cpp. |
1.3.9.1