EMAN2
Public Member Functions | Static Public Member Functions | Static Public Attributes | Protected Member Functions | Private Attributes
EMAN::MaskEdgeMeanProcessor Class Reference

A step cutoff to the the mean value in a ring centered on the outer radius. More...

#include <processor.h>

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

List of all members.

Public Member Functions

string get_name () const
 Get the processor's name.
void set_params (const Dict &new_params)
 Set the processor parameters using a key/value dictionary.
TypeDict get_param_types () const
 Get processor parameter information in a dictionary.
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.ringmean"

Protected Member Functions

void calc_locals (EMData *image)
void process_dist_pixel (float *pixel, float dist) const

Private Attributes

int ring_width
float ring_avg

Detailed Description

A step cutoff to the the mean value in a ring centered on the outer radius.

Parameters:
ring_widthThe width of the mask ring.

Definition at line 2664 of file processor.h.


Member Function Documentation

void MaskEdgeMeanProcessor::calc_locals ( EMData image) [protected, virtual]

Reimplemented from EMAN::CircularMaskProcessor.

Definition at line 1567 of file processor.cpp.

References data, EMAN::CircularMaskProcessor::dx, EMAN::CircularMaskProcessor::dy, EMAN::CircularMaskProcessor::dz, EMAN::Util::fast_floor(), EMAN::EMData::get_data(), NullPointerException, EMAN::CoordinateProcessor::nx, EMAN::CoordinateProcessor::ny, EMAN::CoordinateProcessor::nz, EMAN::CircularMaskProcessor::outer_radius, ring_avg, ring_width, sqrt(), x, EMAN::CircularMaskProcessor::xc, y, EMAN::CircularMaskProcessor::yc, and EMAN::CircularMaskProcessor::zc.

{
        if (!image) {
                throw NullPointerException("NULL image");
        }
        int nitems = 0;
        float sum = 0;
        float *data = image->get_data();
        size_t i = 0;

        xc = Util::fast_floor(nx/2.0f) + dx;
        yc = Util::fast_floor(ny/2.0f) + dy;
        zc = Util::fast_floor(nz/2.0f) + dz;

        for (int z = 0; z < nz; ++z) {
                for (int y = 0; y < ny; ++y) {
                        for (int x = 0; x < nx; ++x) {
                                float x1 = sqrt((x - xc) * (x - xc) + (y - yc) * (y - yc) + (z - zc) * (z - zc));
                                if (x1 <= outer_radius + ring_width && x1 >= outer_radius - ring_width) {
                                        sum += data[i];
                                        ++nitems;
                                }
                                ++i;
                        }
                }
        }

        ring_avg = sum / nitems;
}
string EMAN::MaskEdgeMeanProcessor::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.

Reimplemented from EMAN::CircularMaskProcessor.

Definition at line 2692 of file processor.h.

                {
                        return "A step cutoff to the the mean value in a ring centered on the outer radius";
                }
string EMAN::MaskEdgeMeanProcessor::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 2667 of file processor.h.

References NAME.

                {
                        return NAME;
                }
TypeDict EMAN::MaskEdgeMeanProcessor::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::CircularMaskProcessor.

Definition at line 2685 of file processor.h.

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

                {
                        TypeDict d = CircularMaskProcessor::get_param_types();
                        d.put("ring_width", EMObject::INT, "The width of the mask ring.");
                        return d;
                }
static Processor* EMAN::MaskEdgeMeanProcessor::NEW ( ) [inline, static]

Definition at line 2671 of file processor.h.

                {
                        return new MaskEdgeMeanProcessor();
                }
void EMAN::MaskEdgeMeanProcessor::process_dist_pixel ( float *  pixel,
float  dist 
) const [inline, protected, virtual]
void EMAN::MaskEdgeMeanProcessor::set_params ( const Dict new_params) [inline, virtual]

Set the processor parameters using a key/value dictionary.

Parameters:
new_paramsA dictionary containing the new parameters.

Reimplemented from EMAN::CircularMaskProcessor.

Definition at line 2676 of file processor.h.

References EMAN::Processor::params, and ring_width.

                {
                        CircularMaskProcessor::set_params(new_params);
                        ring_width = params["ring_width"];
                        if (ring_width == 0) {
                                ring_width = 1;
                        }
                }

Member Data Documentation

const string MaskEdgeMeanProcessor::NAME = "mask.ringmean" [static]

Definition at line 2697 of file processor.h.

Referenced by get_name().

Definition at line 2712 of file processor.h.

Referenced by calc_locals(), and process_dist_pixel().

Definition at line 2711 of file processor.h.

Referenced by calc_locals(), and set_params().


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