#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 6006 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 6016 of file processor.h. 06017 { 06018 return "Make a gradient image of the form y=mx+b, where x is any of the image axes."; 06019 }
|
|
Get the processor's name. Each processor is identified by a unique name.
Implements EMAN::Processor. Definition at line 6011 of file processor.h. References NAME. 06012 { 06013 return NAME; 06014 }
|
|
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 6026 of file processor.h. References EMAN::EMObject::FLOAT, EMAN::TypeDict::put(), and EMAN::EMObject::STRING. 06027 { 06028 TypeDict d; 06029 d.put("axis", EMObject::STRING, "The axis the will be used to determine pixel values. Must be x,y or z"); 06030 d.put("m", EMObject::FLOAT, "m in the equation m*axis+b. Default is 1.0"); 06031 d.put("b", EMObject::FLOAT, "b in the equation m*axis+b. Default is 0.0"); 06032 return d; 06033 }
|
|
Definition at line 6021 of file processor.h. 06022 { 06023 return new TestImageGradient(); 06024 }
|
|
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 6977 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(). 06978 { 06979 string axis = params.set_default("axis", "x"); 06980 06981 float m = params.set_default("m", 1.0f); 06982 float b = params.set_default("b", 0.0f); 06983 06984 if ( axis != "z" && axis != "y" && axis != "x") throw InvalidParameterException("Axis must be x,y or z"); 06985 06986 preprocess(image); 06987 06988 if ( axis == "x") 06989 { 06990 for(int k=0; k<nz;++k) { 06991 for(int j=0; j<ny; ++j) { 06992 for(int i=0; i <nx; ++i) { 06993 image->set_value_at(i,j,k,m*i+b); 06994 } 06995 } 06996 } 06997 } 06998 else if ( axis == "y") 06999 { 07000 for(int k=0; k<nz;++k) { 07001 for(int j=0; j<ny; ++j) { 07002 for(int i=0; i <nx; ++i) { 07003 image->set_value_at(i,j,k,m*j+b); 07004 } 07005 } 07006 } 07007 } 07008 else if ( axis == "z") 07009 { 07010 for(int k=0; k<nz;++k) { 07011 for(int j=0; j<ny; ++j) { 07012 for(int i=0; i <nx; ++i) { 07013 image->set_value_at(i,j,k,m*k+b); 07014 } 07015 } 07016 } 07017 } 07018 image->update(); 07019 }
|
|
Definition at line 6035 of file processor.h. Referenced by get_name(). |