#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 | |
static Processor * | NEW () |
Static Public Attributes | |
static const string | NAME = "testimage.noise.uniform.rand" |
seed | seed for random number generator |
Definition at line 6482 of file processor.h.
virtual string EMAN::TestImageNoiseUniformRand::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 6492 of file processor.h.
06493 { 06494 return "Replace a source image as a uniform random noise, random number generated from gsl_rng_mt19937, the pixel value is [0, 1)"; 06495 }
virtual string EMAN::TestImageNoiseUniformRand::get_name | ( | ) | const [inline, virtual] |
Get the processor's name.
Each processor is identified by a unique name.
Implements EMAN::Processor.
Definition at line 6487 of file processor.h.
References NAME.
06488 { 06489 return NAME; 06490 }
virtual TypeDict EMAN::TestImageNoiseUniformRand::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 6502 of file processor.h.
References EMAN::EMObject::INT, and EMAN::TypeDict::put().
06503 { 06504 TypeDict d; 06505 d.put("seed", EMObject::INT, "seed for random number generator"); 06506 return d; 06507 }
static Processor* EMAN::TestImageNoiseUniformRand::NEW | ( | ) | [inline, static] |
Definition at line 6497 of file processor.h.
06498 { 06499 return new TestImageNoiseUniformRand(); 06500 }
void TestImageNoiseUniformRand::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 7849 of file processor.cpp.
References EMAN::EMData::get_data(), EMAN::Randnum::get_frand(), EMAN::Dict::has_key(), EMAN::Randnum::Instance(), EMAN::Processor::params, EMAN::TestImageProcessor::preprocess(), EMAN::Randnum::set_seed(), and EMAN::EMData::update().
07850 { 07851 preprocess(image); 07852 07853 Randnum * r = Randnum::Instance(); 07854 if(params.has_key("seed")) { 07855 r->set_seed((int)params["seed"]); 07856 } 07857 07858 float *dat = image->get_data(); 07859 size_t size = (size_t)nx*ny*nz; 07860 for (size_t i=0; i<size; ++i) { 07861 dat[i] = r->get_frand(); 07862 } 07863 07864 image->update(); 07865 }
const string TestImageNoiseUniformRand::NAME = "testimage.noise.uniform.rand" [static] |