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

EMAN::YGradientProcessor Class Reference

#include <processor.h>

Inheritance diagram for EMAN::YGradientProcessor:

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

Collaboration graph
[legend]
List of all members.

Public Member Functions

 YGradientProcessor ()
string get_name () const
 Get the processor's name.
void process_inplace (EMData *image)
 To process an image in-place.
string get_desc () const
 Get the descrition of this specific processor.
TypeDict get_param_types () const
 Get processor parameter information in a dictionary.

Static Public Member Functions

ProcessorNEW ()

Static Public Attributes

const string NAME = "math.edge.ygradient"

Constructor & Destructor Documentation

EMAN::YGradientProcessor::YGradientProcessor  )  [inline]
 

Definition at line 588 of file processor.h.

00588 {}


Member Function Documentation

string EMAN::YGradientProcessor::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 602 of file processor.h.

00603                         {
00604                                 return "Determines the image gradient in the y direction";
00605                         }

string EMAN::YGradientProcessor::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 590 of file processor.h.

00591                         {
00592                                 return NAME;
00593                         }

TypeDict EMAN::YGradientProcessor::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 608 of file processor.h.

00609                         {
00610                                 TypeDict d;
00611                                 return d;
00612                         }

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

Definition at line 597 of file processor.h.

00598                         {
00599                                 return new YGradientProcessor();
00600                         }

void YGradientProcessor::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 9596 of file processor.cpp.

References EMAN::EMData::clip_inplace(), EMAN::EMData::get_xsize(), EMAN::EMData::get_ysize(), EMAN::EMData::get_zsize(), ImageDimensionException, ImageFormatException, EMAN::EMData::is_complex(), nx, ny, EMAN::EMData::process_inplace(), EMAN::EMData::set_size(), and EMAN::EMData::set_value_at().

09597 {
09598         if (image->is_complex()) throw ImageFormatException("Cannot edge detect a complex image");
09599 
09600         EMData* e = new EMData();
09601         int nx = image->get_xsize();
09602         int ny = image->get_ysize();
09603         int nz = image->get_zsize();
09604 
09605         if ( nz == 1 && ny == 1 ) {
09606                 throw ImageDimensionException("Error - cannot detect Y edges for an image that that is 1D!");
09607         } else if ( nz == 1 ) {
09608                 if ( nx < 3 || ny < 3 ) throw ImageDimensionException("Error - cannot edge detect an image with less than three pixels");
09609                 e->set_size(3,3,1);
09610                 e->set_value_at(0,0,-1);
09611                 e->set_value_at(1,0,-2);
09612                 e->set_value_at(2,0,-1);
09613 
09614                 e->set_value_at(0,2,1);
09615                 e->set_value_at(1,2,2);
09616                 e->set_value_at(2,2,1);
09617                 Region r = Region(-nx/2+1,-ny/2+1,nx,ny);
09618                 e->clip_inplace(r);
09619         } else {
09620                 if ( nx < 3 || ny < 3 || nz < 3) throw ImageDimensionException("Error - cannot edge detect an image with less than three pixels");
09621                 e->set_size(3,3,3);
09622                 e->set_value_at(0,0,0,-1);
09623                 e->set_value_at(1,0,0,-1);
09624                 e->set_value_at(2,0,0,-1);
09625                 e->set_value_at(0,0,1,-1);
09626                 e->set_value_at(1,0,1,-8);
09627                 e->set_value_at(2,0,1,-1);
09628                 e->set_value_at(0,0,2,-1);
09629                 e->set_value_at(1,0,2,-1);
09630                 e->set_value_at(2,0,2,-1);
09631 
09632                 e->set_value_at(0,2,0,1);
09633                 e->set_value_at(1,2,0,1);
09634                 e->set_value_at(2,2,0,1);
09635                 e->set_value_at(0,2,1,1);
09636                 e->set_value_at(1,2,1,8);
09637                 e->set_value_at(2,2,1,1);
09638                 e->set_value_at(0,2,2,1);
09639                 e->set_value_at(1,2,2,1);
09640                 e->set_value_at(2,2,2,1);
09641 
09642                 Region r = Region(-nx/2+1,-ny/2+1,-nz/2+1,nx,ny,nz);
09643                 e->clip_inplace(r);
09644         }
09645 
09646         Dict conv_parms;
09647         conv_parms["with"] = e;
09648         image->process_inplace("math.convolution", conv_parms);
09649 
09650         delete e;
09651 }


Member Data Documentation

const string YGradientProcessor::NAME = "math.edge.ygradient" [static]
 

Definition at line 64 of file processor.cpp.


The documentation for this class was generated from the following files:
Generated on Mon Aug 13 13:41:53 2012 for EMAN2 by  doxygen 1.3.9.1