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


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.gaussian" |
| sigma | sigma value for this Gaussian blob | |
| axis | specify a major axis for asymmetric features | |
| c | distance between focus and the center of an ellipse |
Definition at line 6091 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 6101 of file processor.h. 06102 {
06103 return "Replace a source image as a Gaussian Blob";
06104 }
|
|
|
Get the processor's name. Each processor is identified by a unique name.
Implements EMAN::Processor. Definition at line 6096 of file processor.h. 06097 {
06098 return NAME;
06099 }
|
|
|
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 6111 of file processor.h. References EMAN::TypeDict::put(). 06112 {
06113 TypeDict d;
06114 d.put("sigma", EMObject::FLOAT, "sigma value for this Gaussian blob");
06115 d.put("axis", EMObject::STRING, "specify a major axis for asymmetric features");
06116 d.put("c", EMObject::FLOAT, "distance between focus and the center of an ellipse");
06117 return d;
06118 }
|
|
|
Definition at line 6106 of file processor.h. 06107 {
06108 return new TestImageGaussian();
06109 }
|
|
|
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 7022 of file processor.cpp. References EMAN::EMData::get_data(), InvalidValueException, nx, ny, EMAN::TestImageProcessor::preprocess(), sqrt(), and EMAN::EMData::update(). 07023 {
07024 preprocess(image);
07025
07026 float sigma = params["sigma"];
07027 string axis = (const char*)params["axis"];
07028 float c = params["c"];
07029
07030 float *dat = image->get_data();
07031 float r; //this is the distance of pixel from the image center(nx/2, ny/2, nz/2)
07032 float x2, y2, z2; //this is the coordinates of this pixel from image center
07033 for (int k = 0; k < nz; ++k) {
07034 for (int j = 0; j < ny; ++j) {
07035 for (int i = 0; i < nx; ++i, ++dat) {
07036 x2 = (float)( i - nx/2 );
07037 y2 = (float)( j - ny/2 );
07038 z2 = (float)( k - nz/2 );
07039
07040 if(axis==""){
07041 r = (float)sqrt(x2*x2+y2*y2+z2*z2);
07042 }
07043 else if(axis == "x"){
07044 float lc = -c;
07045 float rc = c;
07046 r = ( (float)sqrt((x2-lc)*(x2-lc)+y2*y2+z2*z2) +
07047 (float)sqrt((x2-rc)*(x2-rc)+y2*y2+z2*z2) ) /2.0f - c;
07048 }
07049 else if(axis == "y"){
07050 float lc = -c;
07051 float rc = c;
07052 r = ( (float)sqrt(x2*x2+(y2-lc)*(y2-lc)+z2*z2) +
07053 (float)sqrt(x2*x2+(y2-rc)*(y2-rc)+z2*z2) ) /2.0f - c;
07054 }
07055 else if(axis == "z"){
07056 if( nz == 1 ){
07057 throw InvalidValueException(0, "This is a 2D image, no asymmetric feature for z axis");
07058 }
07059 float lc = -c;
07060 float rc = c;
07061 r = ( (float)sqrt(x2*x2+y2*y2+(z2-lc)*(z2-lc)) +
07062 (float)sqrt(x2*x2+y2*y2+(z2-rc)*(z2-rc)) ) /2.0f - c;
07063 }
07064 else{
07065 throw InvalidValueException(0, "please specify a valid axis for asymmetric features");
07066 }
07067 //the amplitude of the pixel is proportional to the distance of this pixel from the center
07068 *dat = (float)gsl_ran_gaussian_pdf((double)r,(double)sigma);
07069 }
07070 }
07071 }
07072
07073 image->update();
07074 }
|
|
|
Definition at line 203 of file processor.cpp. |
1.3.9.1