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

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

ProcessorNEW ()

Static Public Attributes

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_width The width of the mask ring.

Definition at line 2482 of file processor.h.


Member Function Documentation

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

Reimplemented from EMAN::CircularMaskProcessor.

Definition at line 1553 of file processor.cpp.

References data, EMAN::Util::fast_floor(), EMAN::EMData::get_data(), NullPointerException, ring_avg, sqrt(), x, and y.

01554 {
01555         if (!image) {
01556                 throw NullPointerException("NULL image");
01557         }
01558         int nitems = 0;
01559         float sum = 0;
01560         float *data = image->get_data();
01561         size_t i = 0;
01562 
01563         xc = Util::fast_floor(nx/2.0f) + dx;
01564         yc = Util::fast_floor(ny/2.0f) + dy;
01565         zc = Util::fast_floor(nz/2.0f) + dz;
01566         
01567         for (int z = 0; z < nz; ++z) {
01568                 for (int y = 0; y < ny; ++y) {
01569                         for (int x = 0; x < nx; ++x) {
01570                                 float x1 = sqrt((x - xc) * (x - xc) + (y - yc) * (y - yc) + (z - zc) * (z - zc));
01571                                 if (x1 <= outer_radius + ring_width && x1 >= outer_radius - ring_width) {
01572                                         sum += data[i];
01573                                         ++nitems;
01574                                 }
01575                                 ++i;
01576                         }
01577                 }
01578         }
01579 
01580         ring_avg = sum / nitems;
01581 }

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

02511                 {
02512                         return "A step cutoff to the the mean value in a ring centered on the outer radius";
02513                 }

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

02486                 {
02487                         return NAME;
02488                 }

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

References EMAN::TypeDict::put().

02504                 {
02505                         TypeDict d = CircularMaskProcessor::get_param_types();
02506                         d.put("ring_width", EMObject::INT, "The width of the mask ring.");
02507                         return d;
02508                 }

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

Definition at line 2489 of file processor.h.

02490                 {
02491                         return new MaskEdgeMeanProcessor();
02492                 }

void EMAN::MaskEdgeMeanProcessor::process_dist_pixel float *  pixel,
float  dist
const [inline, protected, virtual]
 

Implements EMAN::CircularMaskProcessor.

Definition at line 2521 of file processor.h.

References dist().

02522                 {
02523                         if (dist >= outer_radius_square || dist < inner_radius_square){
02524                                 *pixel = ring_avg;
02525                         }
02526                 }

void EMAN::MaskEdgeMeanProcessor::set_params const Dict new_params  )  [inline, virtual]
 

Set the processor parameters using a key/value dictionary.

Parameters:
new_params A dictionary containing the new parameters.

Reimplemented from EMAN::CircularMaskProcessor.

Definition at line 2494 of file processor.h.

02495                 {
02496                         CircularMaskProcessor::set_params(new_params);
02497                         ring_width = params["ring_width"];
02498                         if (ring_width == 0) {
02499                                 ring_width = 1;
02500                         }
02501                 }


Member Data Documentation

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

Definition at line 105 of file processor.cpp.

float EMAN::MaskEdgeMeanProcessor::ring_avg [private]
 

Definition at line 2530 of file processor.h.

Referenced by calc_locals().

int EMAN::MaskEdgeMeanProcessor::ring_width [private]
 

Definition at line 2529 of file processor.h.


The documentation for this class was generated from the following files:
Generated on Tue Jun 11 13:42:22 2013 for EMAN2 by  doxygen 1.3.9.1