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


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.gradient" |
| axis | The axis the will be used to determine pixel values. Must be x,y or z. Default is x | |
| m | m in the equation m*axis+b. Default is 1.0 | |
| b | b in the equation m*axis+b. Default is 0.0 |
Definition at line 6012 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 6022 of file processor.h. 06023 {
06024 return "Make a gradient image of the form y=mx+b, where x is any of the image axes.";
06025 }
|
|
|
Get the processor's name. Each processor is identified by a unique name.
Implements EMAN::Processor. Definition at line 6017 of file processor.h. 06018 {
06019 return NAME;
06020 }
|
|
|
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 6032 of file processor.h. References EMAN::TypeDict::put(). 06033 {
06034 TypeDict d;
06035 d.put("axis", EMObject::STRING, "The axis the will be used to determine pixel values. Must be x,y or z");
06036 d.put("m", EMObject::FLOAT, "m in the equation m*axis+b. Default is 1.0");
06037 d.put("b", EMObject::FLOAT, "b in the equation m*axis+b. Default is 0.0");
06038 return d;
06039 }
|
|
|
Definition at line 6027 of file processor.h. 06028 {
06029 return new TestImageGradient();
06030 }
|
|
|
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 7076 of file processor.cpp. References b, InvalidParameterException, EMAN::TestImageProcessor::preprocess(), EMAN::Dict::set_default(), EMAN::EMData::set_value_at(), and EMAN::EMData::update(). 07077 {
07078 string axis = params.set_default("axis", "x");
07079
07080 float m = params.set_default("m", 1.0f);
07081 float b = params.set_default("b", 0.0f);
07082
07083 if ( axis != "z" && axis != "y" && axis != "x") throw InvalidParameterException("Axis must be x,y or z");
07084
07085 preprocess(image);
07086
07087 if ( axis == "x")
07088 {
07089 for(int k=0; k<nz;++k) {
07090 for(int j=0; j<ny; ++j) {
07091 for(int i=0; i <nx; ++i) {
07092 image->set_value_at(i,j,k,m*i+b);
07093 }
07094 }
07095 }
07096 }
07097 else if ( axis == "y")
07098 {
07099 for(int k=0; k<nz;++k) {
07100 for(int j=0; j<ny; ++j) {
07101 for(int i=0; i <nx; ++i) {
07102 image->set_value_at(i,j,k,m*j+b);
07103 }
07104 }
07105 }
07106 }
07107 else if ( axis == "z")
07108 {
07109 for(int k=0; k<nz;++k) {
07110 for(int j=0; j<ny; ++j) {
07111 for(int i=0; i <nx; ++i) {
07112 image->set_value_at(i,j,k,m*k+b);
07113 }
07114 }
07115 }
07116 }
07117 image->update();
07118 }
|
|
|
Definition at line 201 of file processor.cpp. |
1.3.9.1