EMAN2
Public Member Functions | Static Public Member Functions | Static Public Attributes
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

static ProcessorNEW ()

Static Public Attributes

static const string NAME = "math.edge.ygradient"

Detailed Description

Definition at line 628 of file processor.h.


Constructor & Destructor Documentation

EMAN::YGradientProcessor::YGradientProcessor ( ) [inline]

Definition at line 631 of file processor.h.

Referenced by NEW().

{}

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

                        {
                                return "Determines the image gradient in the y direction";
                        }
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 633 of file processor.h.

References NAME.

                        {
                                return NAME;
                        }
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 651 of file processor.h.

                        {
                                TypeDict d;
                                return d;
                        }
static Processor* EMAN::YGradientProcessor::NEW ( ) [inline, static]

Definition at line 640 of file processor.h.

References YGradientProcessor().

                        {
                                return new YGradientProcessor();
                        }
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:
imageThe image to be processed.

Implements EMAN::Processor.

Definition at line 10293 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(), EMAN::EMData::process_inplace(), EMAN::EMData::set_size(), and EMAN::EMData::set_value_at().

{
        if (image->is_complex()) throw ImageFormatException("Cannot edge detect a complex image");

        EMData* e = new EMData();
        int nx = image->get_xsize();
        int ny = image->get_ysize();
        int nz = image->get_zsize();

        if ( nz == 1 && ny == 1 ) {
                throw ImageDimensionException("Error - cannot detect Y edges for an image that that is 1D!");
        } else if ( nz == 1 ) {
                if ( nx < 3 || ny < 3 ) throw ImageDimensionException("Error - cannot edge detect an image with less than three pixels");
                e->set_size(3,3,1);
                e->set_value_at(0,0,-1);
                e->set_value_at(1,0,-2);
                e->set_value_at(2,0,-1);

                e->set_value_at(0,2,1);
                e->set_value_at(1,2,2);
                e->set_value_at(2,2,1);
                Region r = Region(-nx/2+1,-ny/2+1,nx,ny);
                e->clip_inplace(r);
        } else {
                if ( nx < 3 || ny < 3 || nz < 3) throw ImageDimensionException("Error - cannot edge detect an image with less than three pixels");
                e->set_size(3,3,3);
                e->set_value_at(0,0,0,-1);
                e->set_value_at(1,0,0,-1);
                e->set_value_at(2,0,0,-1);
                e->set_value_at(0,0,1,-1);
                e->set_value_at(1,0,1,-8);
                e->set_value_at(2,0,1,-1);
                e->set_value_at(0,0,2,-1);
                e->set_value_at(1,0,2,-1);
                e->set_value_at(2,0,2,-1);

                e->set_value_at(0,2,0,1);
                e->set_value_at(1,2,0,1);
                e->set_value_at(2,2,0,1);
                e->set_value_at(0,2,1,1);
                e->set_value_at(1,2,1,8);
                e->set_value_at(2,2,1,1);
                e->set_value_at(0,2,2,1);
                e->set_value_at(1,2,2,1);
                e->set_value_at(2,2,2,1);

                Region r = Region(-nx/2+1,-ny/2+1,-nz/2+1,nx,ny,nz);
                e->clip_inplace(r);
        }

        Dict conv_parms;
        conv_parms["with"] = e;
        image->process_inplace("math.convolution", conv_parms);
        image->process_inplace("xform.phaseorigin.tocenter");

        delete e;
}

Member Data Documentation

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

Definition at line 657 of file processor.h.

Referenced by get_name().


The documentation for this class was generated from the following files: