#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 | |
static Processor * | NEW () |
Static Public Attributes | |
static const string | NAME = "testimage.gradient" |
, x,y or z.
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 6046 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 6056 of file processor.h. 06057 { 06058 return "Make a gradient image of the form y=mx+b, where x is any of the image axes."; 06059 }
|
|
Get the processor's name. Each processor is identified by a unique name.
Implements EMAN::Processor. Definition at line 6051 of file processor.h. References NAME. 06052 { 06053 return NAME; 06054 }
|
|
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 6066 of file processor.h. References EMAN::EMObject::FLOAT, EMAN::TypeDict::put(), and EMAN::EMObject::STRING. 06067 { 06068 TypeDict d; 06069 d.put("axis", EMObject::STRING, "The axis the will be used to determine pixel values. Must be x,y or z"); 06070 d.put("m", EMObject::FLOAT, "m in the equation m*axis+b. Default is 1.0"); 06071 d.put("b", EMObject::FLOAT, "b in the equation m*axis+b. Default is 0.0"); 06072 return d; 06073 }
|
|
Definition at line 6061 of file processor.h. 06062 { 06063 return new TestImageGradient(); 06064 }
|
|
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 7084 of file processor.cpp. References b, InvalidParameterException, EMAN::Processor::params, EMAN::TestImageProcessor::preprocess(), EMAN::Dict::set_default(), EMAN::EMData::set_value_at(), and EMAN::EMData::update(). 07085 { 07086 string axis = params.set_default("axis", "x"); 07087 07088 float m = params.set_default("m", 1.0f); 07089 float b = params.set_default("b", 0.0f); 07090 07091 if ( axis != "z" && axis != "y" && axis != "x") throw InvalidParameterException("Axis must be x,y or z"); 07092 07093 preprocess(image); 07094 07095 if ( axis == "x") 07096 { 07097 for(int k=0; k<nz;++k) { 07098 for(int j=0; j<ny; ++j) { 07099 for(int i=0; i <nx; ++i) { 07100 image->set_value_at(i,j,k,m*i+b); 07101 } 07102 } 07103 } 07104 } 07105 else if ( axis == "y") 07106 { 07107 for(int k=0; k<nz;++k) { 07108 for(int j=0; j<ny; ++j) { 07109 for(int i=0; i <nx; ++i) { 07110 image->set_value_at(i,j,k,m*j+b); 07111 } 07112 } 07113 } 07114 } 07115 else if ( axis == "z") 07116 { 07117 for(int k=0; k<nz;++k) { 07118 for(int j=0; j<ny; ++j) { 07119 for(int i=0; i <nx; ++i) { 07120 image->set_value_at(i,j,k,m*k+b); 07121 } 07122 } 07123 } 07124 } 07125 image->update(); 07126 }
|
|
Definition at line 6075 of file processor.h. Referenced by get_name(). |