Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members

EMAN::TestImageGradient Class Reference

Put a gradient in the image of the form y = mx+b : "x" is a string indicating any of the image axes, i.e., x,y or z. More...

#include <processor.h>

Inheritance diagram for EMAN::TestImageGradient:

Inheritance graph
[legend]
Collaboration diagram for EMAN::TestImageGradient:

Collaboration graph
[legend]
List of all members.

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

ProcessorNEW ()

Static Public Attributes

const string NAME = "testimage.gradient"

Detailed Description

Put a gradient in the image of the form y = mx+b : "x" is a string indicating any of the image axes, i.e., x,y or z.

Author:
David Woolford <woolford@bcm.edu>
Date:
01/10/2008
Parameters:
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 5974 of file processor.h.


Member Function Documentation

virtual string EMAN::TestImageGradient::get_desc  )  const [inline, virtual]
 

Get the descrition of this specific processor.

This function must be overwritten by a subclass.

Returns:
The description of this processor.

Implements EMAN::Processor.

Definition at line 5984 of file processor.h.

05985                         {
05986                                 return "Make a gradient image of the form y=mx+b, where x is any of the image axes.";
05987                         }

virtual string EMAN::TestImageGradient::get_name  )  const [inline, virtual]
 

Get the processor's name.

Each processor is identified by a unique name.

Returns:
The processor's name.

Implements EMAN::Processor.

Definition at line 5979 of file processor.h.

05980                         {
05981                                 return NAME;
05982                         }

virtual TypeDict EMAN::TestImageGradient::get_param_types  )  const [inline, virtual]
 

Get processor parameter information in a dictionary.

Each parameter has one record in the dictionary. Each record contains its name, data-type, and description.

Returns:
A dictionary containing the parameter info.

Reimplemented from EMAN::Processor.

Definition at line 5994 of file processor.h.

References EMAN::TypeDict::put().

05995                         {
05996                                 TypeDict d;
05997                                 d.put("axis", EMObject::STRING, "The axis the will be used to determine pixel values. Must be x,y or z");
05998                                 d.put("m", EMObject::FLOAT, "m in the equation m*axis+b. Default is 1.0");
05999                                 d.put("b", EMObject::FLOAT, "b in the equation m*axis+b. Default is 0.0");
06000                                 return d;
06001                         }

Processor* EMAN::TestImageGradient::NEW  )  [inline, static]
 

Definition at line 5989 of file processor.h.

05990                         {
05991                                 return new TestImageGradient();
05992                         }

void TestImageGradient::process_inplace EMData image  )  [virtual]
 

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.

Parameters:
image The image to be processed.

Implements EMAN::Processor.

Definition at line 7048 of file processor.cpp.

References b, InvalidParameterException, EMAN::TestImageProcessor::preprocess(), EMAN::Dict::set_default(), EMAN::EMData::set_value_at(), and EMAN::EMData::update().

07049 {
07050         string axis = params.set_default("axis", "x");
07051 
07052         float m = params.set_default("m", 1.0f);
07053         float b = params.set_default("b", 0.0f);
07054 
07055         if ( axis != "z" && axis != "y" && axis != "x") throw InvalidParameterException("Axis must be x,y or z");
07056 
07057         preprocess(image);
07058 
07059         if ( axis == "x")
07060         {
07061                 for(int k=0; k<nz;++k) {
07062                         for(int j=0; j<ny; ++j) {
07063                                 for(int i=0; i <nx; ++i) {
07064                                         image->set_value_at(i,j,k,m*i+b);
07065                                 }
07066                         }
07067                 }
07068         }
07069         else if ( axis == "y")
07070         {
07071                 for(int k=0; k<nz;++k) {
07072                         for(int j=0; j<ny; ++j) {
07073                                 for(int i=0; i <nx; ++i) {
07074                                         image->set_value_at(i,j,k,m*j+b);
07075                                 }
07076                         }
07077                 }
07078         }
07079         else if ( axis == "z")
07080         {
07081                 for(int k=0; k<nz;++k) {
07082                         for(int j=0; j<ny; ++j) {
07083                                 for(int i=0; i <nx; ++i) {
07084                                         image->set_value_at(i,j,k,m*k+b);
07085                                 }
07086                         }
07087                 }
07088         }
07089         image->update();
07090 }


Member Data Documentation

const string TestImageGradient::NAME = "testimage.gradient" [static]
 

Definition at line 196 of file processor.cpp.


The documentation for this class was generated from the following files:
Generated on Mon May 2 13:30:47 2011 for EMAN2 by  doxygen 1.3.9.1