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


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.puregaussian" |
| x_sigma | sigma value for this Gaussian blob on x direction | |
| y_sigma | sigma value for this Gaussian blob on y direction | |
| z_sigma | sigma value for this Gaussian blob on z direction | |
| x_center | center for this Gaussian blob on x direction | |
| y_center | center for this Gaussian blob on y direction | |
| z_center | center for this Gaussian blob on z direction |
Definition at line 5791 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 5801 of file processor.h. 05802 {
05803 return "Replace a source image as a strict Gaussian ";
05804 }
|
|
|
Get the processor's name. Each processor is identified by a unique name.
Implements EMAN::Processor. Definition at line 5796 of file processor.h. 05797 {
05798 return NAME;
05799 }
|
|
|
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 5811 of file processor.h. References EMAN::TypeDict::put(). 05812 {
05813 TypeDict d;
05814 d.put("x_sigma", EMObject::FLOAT, "sigma value for this Gaussian blob on x direction");
05815 d.put("y_sigma", EMObject::FLOAT, "sigma value for this Gaussian blob on y direction");
05816 d.put("z_sigma", EMObject::FLOAT, "sigma value for this Gaussian blob on z direction");
05817 d.put("x_center", EMObject::FLOAT, "center for this Gaussian blob on x direction" );
05818 d.put("y_center", EMObject::FLOAT, "center for this Gaussian blob on y direction" );
05819 d.put("z_center", EMObject::FLOAT, "center for this Gaussian blob on z direction" );
05820 return d;
05821 }
|
|
|
Definition at line 5806 of file processor.h. 05807 {
05808 return new TestImagePureGaussian();
05809 }
|
|
|
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 7232 of file processor.cpp. References EMAN::EMData::get_xsize(), EMAN::EMData::get_ysize(), EMAN::EMData::get_zsize(), norm(), nx, ny, pi, EMAN::TestImageProcessor::preprocess(), sqrt(), EMAN::EMData::update(), x, and y. 07233 {
07234 preprocess(image);
07235
07236 float x_sigma = params["x_sigma"];
07237 float y_sigma = params["y_sigma"];
07238 float z_sigma = params["z_sigma"];
07239
07240 float x_center = params["x_center"];
07241 float y_center = params["y_center"];
07242 float z_center = params["z_center"];
07243
07244 int nx = image->get_xsize();
07245 int ny = image->get_ysize();
07246 int nz = image->get_zsize();
07247
07248 float x_twosig2 = 2*x_sigma*x_sigma;
07249 float y_twosig2 = 2*y_sigma*y_sigma;
07250 float z_twosig2 = 2*z_sigma*z_sigma;
07251
07252 float sr2pi = sqrt( 2.0f*(float)pi );
07253 float norm = 1.0f/ ( x_sigma*sr2pi );
07254 if (ny > 1) {
07255 norm *= 1.0f/ ( y_sigma*sr2pi );
07256 if (nz > 1) norm *= 1.0f/ ( z_sigma*sr2pi );
07257 }
07258
07259 float z, y, x, sum, val;
07260 for (int iz=0; iz < nz; ++iz) {
07261 z = static_cast<float>(iz) - z_center;
07262 for (int iy=0; iy < ny; ++iy) {
07263 y = static_cast<float>(iy) - y_center;
07264 for (int ix=0; ix < nx; ++ix) {
07265 x = static_cast<float>(ix) - x_center;
07266 sum = x*x/x_twosig2 + y*y/y_twosig2 + z*z/z_twosig2;
07267 val = norm*exp(-sum);
07268 (*image)(ix,iy,iz) = val;
07269 }
07270 }
07271 }
07272 image->update();
07273 }
|
|
|
Definition at line 195 of file processor.cpp. |
1.3.9.1