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

zero edges of volume on all sides More...

#include <processor.h>

Inheritance diagram for EMAN::ZeroEdgePlaneProcessor:
Inheritance graph
[legend]
Collaboration diagram for EMAN::ZeroEdgePlaneProcessor:
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.
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 = "mask.zeroedge3d"

Detailed Description

zero edges of volume on all sides

Parameters:
x0The number of columns to zero from left
x1The number of columns to zero from right
y0The number of rows to zero from the bottom
y1The number of rows to zero from the top
z0The number of slices to zero from the bottom
z1The number of slices to zero from the top

Definition at line 4227 of file processor.h.


Member Function Documentation

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

                {
                        return "zero edges of volume on all sides";
                }
string EMAN::ZeroEdgePlaneProcessor::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 4231 of file processor.h.

References NAME.

                {
                        return NAME;
                }
TypeDict EMAN::ZeroEdgePlaneProcessor::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 4246 of file processor.h.

References EMAN::EMObject::INT, and EMAN::TypeDict::put().

                {
                        TypeDict d;
                        d.put("x0", EMObject::INT, "The number of columns to zero from left");
                        d.put("x1", EMObject::INT, "The number of columns to zero from right");
                        d.put("y0", EMObject::INT, "The number of rows to zero from the bottom");
                        d.put("y1", EMObject::INT, "The number of rows to zero from the top");
                        d.put("z0", EMObject::INT, "The number of slices to zero from the bottom");
                        d.put("z1", EMObject::INT, "The number of slices to zero from the top");
                        return d;
                }
static Processor* EMAN::ZeroEdgePlaneProcessor::NEW ( ) [inline, static]

Definition at line 4236 of file processor.h.

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

References EMAN::EMData::get_data(), EMAN::EMData::get_xsize(), EMAN::EMData::get_ysize(), EMAN::EMData::get_zsize(), ImageDimensionException, LOGERR, LOGWARN, ny, EMAN::Processor::params, and EMAN::EMData::update().

{
        if (!image) {
                LOGWARN("NULL Image");
                return;
        }

        if (image->get_zsize() <= 1) {
                LOGERR("ZeroEdgePlaneProcessor only support 3D models");
                throw ImageDimensionException("3D model only");
        }

        int nx = image->get_xsize();
        int ny = image->get_ysize();
        int nz = image->get_zsize();

        float *d = image->get_data();

        int x0=params["x0"];
        int x1=params["x1"];
        int y0=params["y0"];
        int y1=params["y1"];
        int z0=params["z0"];
        int z1=params["z1"];

        size_t row_size = nx * sizeof(float);
        size_t nxy = nx * ny;
        size_t sec_size = nxy * sizeof(float);
        size_t y0row = y0 * row_size;
        size_t y1row = y1 * row_size;
        int max_y = ny-y1;
        size_t x0size = x0*sizeof(float);
        size_t x1size = x1*sizeof(float);

        memset(d,0,z0*sec_size);                                        // zero -z
        memset(d+(nxy*(nz-z1)),0,sec_size*z1);      // zero +z

        for (int z=z0; z<nz-z1; z++) {
                memset(d+z*nxy,0,y0row);                        // zero -y
                memset(d+z*nxy+(ny-y1)*nx,0,y1row);     // zero +y

                int znxy = z * nxy;
                int znxy2 = znxy + nx - x1;

                for (int y=y0; y<max_y; y++) {
                        memset(d+znxy+y*nx,0,x0size);   // zero -x
                        memset(d+znxy2+y*nx,0,x1size);  // zero +x
                }
        }

        image->update();
}

Member Data Documentation

const string ZeroEdgePlaneProcessor::NAME = "mask.zeroedge3d" [static]

Definition at line 4258 of file processor.h.

Referenced by get_name().


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