EMAN2
Public Member Functions | Static Public Member Functions | Static Public Attributes
EMAN::MeanZeroEdgeProcessor Class Reference

Fill zeroes at edges with nearest horizontal/vertical value damped towards Mean2. More...

#include <processor.h>

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

List of all members.

Public Member Functions

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

Static Public Member Functions

static ProcessorNEW ()

Static Public Attributes

static const string NAME = "mask.dampedzeroedgefill"

Detailed Description

Fill zeroes at edges with nearest horizontal/vertical value damped towards Mean2.

Definition at line 4100 of file processor.h.


Member Function Documentation

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

                {
                        return "Fill zeroes at edges with nearest horizontal/vertical value damped towards Mean2.";
                }
string EMAN::MeanZeroEdgeProcessor::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 4105 of file processor.h.

References NAME.

                {
                        return NAME;
                }
static Processor* EMAN::MeanZeroEdgeProcessor::NEW ( ) [inline, static]

Definition at line 4110 of file processor.h.

                {
                        return new MeanZeroEdgeProcessor();
                }
void MeanZeroEdgeProcessor::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 3370 of file processor.cpp.

References EMAN::Dict::get(), EMAN::EMData::get_attr_dict(), EMAN::EMData::get_data(), EMAN::EMData::get_xsize(), EMAN::EMData::get_ysize(), EMAN::EMData::get_zsize(), ImageDimensionException, LOGERR, LOGWARN, nx, ny, EMAN::EMData::update(), and v.

{
        if (!image) {
                LOGWARN("NULL Image");
                return;
        }
        if (image->get_zsize() > 1) {
                LOGERR("MeanZeroEdgeProcessor doesn't support 3D model");
                throw ImageDimensionException("3D model not supported");
        }

        int nx = image->get_xsize();
        int ny = image->get_ysize();
        Dict dict = image->get_attr_dict();
        float mean_nonzero = dict.get("mean_nonzero");

        float *d = image->get_data();
        int i = 0;
        int j = 0;

        for (j = 0; j < ny; j++) {
                for (i = 0; i < nx - 1; i++) {
                        if (d[i + j * nx] != 0) {
                                break;
                        }
                }

                if (i == nx - 1) {
                        i = -1;
                }

                float v = d[i + j * nx] - mean_nonzero;

                while (i >= 0) {
                        v *= 0.9f;
                        d[i + j * nx] = v + mean_nonzero;
                        i--;
                }


                for (i = nx - 1; i > 0; i--) {
                        if (d[i + j * nx] != 0) {
                                break;
                        }
                }

                if (i == 0) {
                        i = nx;
                }

                v = d[i + j * nx] - mean_nonzero;

                while (i < nx) {
                        v *= .9f;
                        d[i + j * nx] = v + mean_nonzero;
                        i++;
                }
        }


        for (i = 0; i < nx; i++) {
                for (j = 0; j < ny; j++) {
                        if (d[i + j * nx] != 0)
                                break;
                }

                float v = d[i + j * nx] - mean_nonzero;

                while (j >= 0) {
                        v *= .9f;
                        d[i + j * nx] = v + mean_nonzero;
                        j--;
                }

                for (j = ny - 1; j > 0; j--) {
                        if (d[i + j * nx] != 0)
                                break;
                }

                v = d[i + j * nx] - mean_nonzero;

                while (j < ny) {
                        v *= .9f;
                        d[i + j * nx] = v + mean_nonzero;
                        j++;
                }
        }

        image->update();
}

Member Data Documentation

const string MeanZeroEdgeProcessor::NAME = "mask.dampedzeroedgefill" [static]

Definition at line 4120 of file processor.h.

Referenced by get_name().


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