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 563 of file processor.h.

00563 {}


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 577 of file processor.h.

00578                         {
00579                                 return "Determines the image gradient in the y direction";
00580                         }

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 565 of file processor.h.

00566                         {
00567                                 return NAME;
00568                         }

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 583 of file processor.h.

00584                         {
00585                                 TypeDict d;
00586                                 return d;
00587                         }

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

Definition at line 572 of file processor.h.

00573                         {
00574                                 return new YGradientProcessor();
00575                         }

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 9344 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().

09345 {
09346         if (image->is_complex()) throw ImageFormatException("Cannot edge detect a complex image");
09347 
09348         EMData* e = new EMData();
09349         int nx = image->get_xsize();
09350         int ny = image->get_ysize();
09351         int nz = image->get_zsize();
09352 
09353         if ( nz == 1 && ny == 1 ) {
09354                 throw ImageDimensionException("Error - cannot detect Y edges for an image that that is 1D!");
09355         } else if ( nz == 1 ) {
09356                 if ( nx < 3 || ny < 3 ) throw ImageDimensionException("Error - cannot edge detect an image with less than three pixels");
09357                 e->set_size(3,3,1);
09358                 e->set_value_at(0,0,-1);
09359                 e->set_value_at(1,0,-2);
09360                 e->set_value_at(2,0,-1);
09361 
09362                 e->set_value_at(0,2,1);
09363                 e->set_value_at(1,2,2);
09364                 e->set_value_at(2,2,1);
09365                 Region r = Region(-nx/2+1,-ny/2+1,nx,ny);
09366                 e->clip_inplace(r);
09367         } else {
09368                 if ( nx < 3 || ny < 3 || nz < 3) throw ImageDimensionException("Error - cannot edge detect an image with less than three pixels");
09369                 e->set_size(3,3,3);
09370                 e->set_value_at(0,0,0,-1);
09371                 e->set_value_at(1,0,0,-1);
09372                 e->set_value_at(2,0,0,-1);
09373                 e->set_value_at(0,0,1,-1);
09374                 e->set_value_at(1,0,1,-8);
09375                 e->set_value_at(2,0,1,-1);
09376                 e->set_value_at(0,0,2,-1);
09377                 e->set_value_at(1,0,2,-1);
09378                 e->set_value_at(2,0,2,-1);
09379 
09380                 e->set_value_at(0,2,0,1);
09381                 e->set_value_at(1,2,0,1);
09382                 e->set_value_at(2,2,0,1);
09383                 e->set_value_at(0,2,1,1);
09384                 e->set_value_at(1,2,1,8);
09385                 e->set_value_at(2,2,1,1);
09386                 e->set_value_at(0,2,2,1);
09387                 e->set_value_at(1,2,2,1);
09388                 e->set_value_at(2,2,2,1);
09389 
09390                 Region r = Region(-nx/2+1,-ny/2+1,-nz/2+1,nx,ny,nz);
09391                 e->clip_inplace(r);
09392         }
09393 
09394         Dict conv_parms;
09395         conv_parms["with"] = e;
09396         image->process_inplace("math.convolution", conv_parms);
09397 
09398         delete e;
09399 }


Member Data Documentation

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

Definition at line 65 of file processor.cpp.


The documentation for this class was generated from the following files:
Generated on Thu Dec 9 13:47:38 2010 for EMAN2 by  doxygen 1.3.9.1