#include <processor.h>
Inheritance diagram for EMAN::TestImageNoiseUniformRand:
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.uniform.rand" |
seed | seed for random number generator |
Definition at line 6444 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 6454 of file processor.h. 06455 { 06456 return "Replace a source image as a uniform random noise, random number generated from gsl_rng_mt19937, the pixel value is [0, 1)"; 06457 }
|
|
Get the processor's name. Each processor is identified by a unique name.
Implements EMAN::Processor. Definition at line 6449 of file processor.h. 06450 {
06451 return NAME;
06452 }
|
|
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 6464 of file processor.h. References EMAN::TypeDict::put(). 06465 { 06466 TypeDict d; 06467 d.put("seed", EMObject::INT, "seed for random number generator"); 06468 return d; 06469 }
|
|
Definition at line 6459 of file processor.h. 06460 { 06461 return new TestImageNoiseUniformRand(); 06462 }
|
|
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 7630 of file processor.cpp. References EMAN::EMData::get_data(), EMAN::Randnum::get_frand(), EMAN::Dict::has_key(), EMAN::Randnum::Instance(), nx, ny, EMAN::TestImageProcessor::preprocess(), EMAN::Randnum::set_seed(), and EMAN::EMData::update(). 07631 { 07632 preprocess(image); 07633 07634 Randnum * r = Randnum::Instance(); 07635 if(params.has_key("seed")) { 07636 r->set_seed((int)params["seed"]); 07637 } 07638 07639 float *dat = image->get_data(); 07640 size_t size = nx*ny*nz; 07641 for (size_t i=0; i<size; ++i) { 07642 dat[i] = r->get_frand(); 07643 } 07644 07645 image->update(); 07646 }
|
|
Definition at line 207 of file processor.cpp. |