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

EMAN::XGradientProcessor Class Reference

Determines the partial derivatives in the x direction Does this by constructing edge kernels in real space but convoluting in Fourier space. More...

#include <processor.h>

Inheritance diagram for EMAN::XGradientProcessor:

[legend]
Collaboration diagram for EMAN::XGradientProcessor:
[legend]
List of all members.

Public Member Functions

 XGradientProcessor ()
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.xgradient"

Detailed Description

Determines the partial derivatives in the x direction Does this by constructing edge kernels in real space but convoluting in Fourier space.

Author:
David Woolford
Date:
2007/12/04

Definition at line 529 of file processor.h.


Constructor & Destructor Documentation

EMAN::XGradientProcessor::XGradientProcessor  )  [inline]
 

Definition at line 532 of file processor.h.

00532 {}


Member Function Documentation

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

00547                 {
00548                         return "Determines the image gradient in the x direction";
00549                 }

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

00535                 {
00536                         return NAME;
00537                 }

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

00552                 {
00553                         TypeDict d;
00554                         return d;
00555                 }

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

Definition at line 541 of file processor.h.

00542                 {
00543                         return new XGradientProcessor();
00544                 }

void XGradientProcessor::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 9104 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().

09105 {
09106         if (image->is_complex()) throw ImageFormatException("Cannot edge detect a complex image");
09107 
09108         EMData* e = new EMData();
09109         int nx = image->get_xsize();
09110         int ny = image->get_ysize();
09111         int nz = image->get_zsize();
09112 
09113         if ( nz == 1 && ny == 1 ) {
09114                 if ( nx < 3 ) throw ImageDimensionException("Error - cannot edge detect an image with less than three pixels");
09115 
09116                 e->set_size(3,1,1);
09117                 e->set_value_at(0,-1);
09118                 e->set_value_at(2, 1);
09119 
09120                 Region r = Region(-nx/2+1,nx);
09121                 e->clip_inplace(r);
09122         } else if ( nz == 1 ) {
09123                 if ( nx < 3 || ny < 3 ) throw ImageDimensionException("Error - cannot edge detect an image with less than three pixels");
09124                 e->set_size(3,3,1);
09125                 e->set_value_at(0,0,-1);
09126                 e->set_value_at(0,1,-2);
09127                 e->set_value_at(0,2,-1);
09128 
09129                 e->set_value_at(2,0,1);
09130                 e->set_value_at(2,1,2);
09131                 e->set_value_at(2,2,1);
09132                 Region r = Region(-nx/2+1,-ny/2+1,nx,ny);
09133                 e->clip_inplace(r);
09134         } else {
09135                 if ( nx < 3 || ny < 3 || nz < 3) throw ImageDimensionException("Error - cannot edge detect an image with less than three pixels");
09136                 e->set_size(3,3,3);
09137                 e->set_value_at(0,0,0,-1);
09138                 e->set_value_at(0,1,0,-1);
09139                 e->set_value_at(0,2,0,-1);
09140                 e->set_value_at(0,0,1,-1);
09141                 e->set_value_at(0,1,1,-8);
09142                 e->set_value_at(0,2,1,-1);
09143                 e->set_value_at(0,0,2,-1);
09144                 e->set_value_at(0,1,2,-1);
09145                 e->set_value_at(0,2,2,-1);
09146 
09147                 e->set_value_at(2,0,0,1);
09148                 e->set_value_at(2,1,0,1);
09149                 e->set_value_at(2,2,0,1);
09150                 e->set_value_at(2,0,1,1);
09151                 e->set_value_at(2,1,1,8);
09152                 e->set_value_at(2,2,1,1);
09153                 e->set_value_at(2,0,2,1);
09154                 e->set_value_at(2,1,2,1);
09155                 e->set_value_at(2,2,2,1);
09156 
09157                 Region r = Region(-nx/2+1,-ny/2+1,-nz/2+1,nx,ny,nz);
09158                 e->clip_inplace(r);
09159         }
09160 
09161         Dict conv_parms;
09162         conv_parms["with"] = e;
09163         image->process_inplace("math.convolution", conv_parms);
09164         image->process_inplace("xform.phaseorigin.tocenter");
09165 
09166         delete e;
09167 }


Member Data Documentation

const string XGradientProcessor::NAME = "math.edge.xgradient" [static]
 

Definition at line 64 of file processor.cpp.


The documentation for this class was generated from the following files:
Generated on Fri Apr 30 15:39:19 2010 for EMAN2 by  doxygen 1.3.9.1