#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 6043 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 6053 of file processor.h. 06054 { 06055 return "Make a gradient image of the form y=mx+b, where x is any of the image axes."; 06056 }
|
|
Get the processor's name. Each processor is identified by a unique name.
Implements EMAN::Processor. Definition at line 6048 of file processor.h. 06049 {
06050 return NAME;
06051 }
|
|
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 6063 of file processor.h. References EMAN::TypeDict::put(). 06064 { 06065 TypeDict d; 06066 d.put("axis", EMObject::STRING, "The axis the will be used to determine pixel values. Must be x,y or z"); 06067 d.put("m", EMObject::FLOAT, "m in the equation m*axis+b. Default is 1.0"); 06068 d.put("b", EMObject::FLOAT, "b in the equation m*axis+b. Default is 0.0"); 06069 return d; 06070 }
|
|
Definition at line 6058 of file processor.h. 06059 { 06060 return new TestImageGradient(); 06061 }
|
|
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 7162 of file processor.cpp. References b, InvalidParameterException, EMAN::TestImageProcessor::preprocess(), EMAN::Dict::set_default(), EMAN::EMData::set_value_at(), and EMAN::EMData::update(). 07163 { 07164 string axis = params.set_default("axis", "x"); 07165 07166 float m = params.set_default("m", 1.0f); 07167 float b = params.set_default("b", 0.0f); 07168 07169 if ( axis != "z" && axis != "y" && axis != "x") throw InvalidParameterException("Axis must be x,y or z"); 07170 07171 preprocess(image); 07172 07173 if ( axis == "x") 07174 { 07175 for(int k=0; k<nz;++k) { 07176 for(int j=0; j<ny; ++j) { 07177 for(int i=0; i <nx; ++i) { 07178 image->set_value_at(i,j,k,m*i+b); 07179 } 07180 } 07181 } 07182 } 07183 else if ( axis == "y") 07184 { 07185 for(int k=0; k<nz;++k) { 07186 for(int j=0; j<ny; ++j) { 07187 for(int i=0; i <nx; ++i) { 07188 image->set_value_at(i,j,k,m*j+b); 07189 } 07190 } 07191 } 07192 } 07193 else if ( axis == "z") 07194 { 07195 for(int k=0; k<nz;++k) { 07196 for(int j=0; j<ny; ++j) { 07197 for(int i=0; i <nx; ++i) { 07198 image->set_value_at(i,j,k,m*k+b); 07199 } 07200 } 07201 } 07202 } 07203 image->update(); 07204 }
|
|
Definition at line 196 of file processor.cpp. |