#include <processor.h>
Inheritance diagram for EMAN::MaskEdgeMeanProcessor:
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 Processor * | NEW () |
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 |
ring_width | The width of the mask ring. |
Definition at line 2436 of file processor.h.
void MaskEdgeMeanProcessor::calc_locals | ( | EMData * | image | ) | [protected, virtual] |
Reimplemented from EMAN::CircularMaskProcessor.
Definition at line 1469 of file processor.cpp.
References data, 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.
01470 { 01471 if (!image) { 01472 throw NullPointerException("NULL image"); 01473 } 01474 int nitems = 0; 01475 float sum = 0; 01476 float *data = image->get_data(); 01477 size_t i = 0; 01478 01479 for (int z = 0; z < nz; ++z) { 01480 for (int y = 0; y < ny; ++y) { 01481 for (int x = 0; x < nx; ++x) { 01482 float x1 = sqrt((x - xc) * (x - xc) + (y - yc) * (y - yc) + (z - zc) * (z - zc)); 01483 if (x1 <= outer_radius + ring_width && x1 >= outer_radius - ring_width) { 01484 sum += data[i]; 01485 ++nitems; 01486 } 01487 ++i; 01488 } 01489 } 01490 } 01491 01492 ring_avg = sum / nitems; 01493 }
string EMAN::MaskEdgeMeanProcessor::get_desc | ( | ) | const [inline, virtual] |
Get the descrition of this specific processor.
This function must be overwritten by a subclass.
Reimplemented from EMAN::CircularMaskProcessor.
Definition at line 2464 of file processor.h.
02465 { 02466 return "A step cutoff to the the mean value in a ring centered on the outer radius"; 02467 }
string EMAN::MaskEdgeMeanProcessor::get_name | ( | ) | const [inline, virtual] |
Get the processor's name.
Each processor is identified by a unique name.
Implements EMAN::Processor.
Definition at line 2439 of file processor.h.
References NAME.
02440 { 02441 return NAME; 02442 }
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.
Reimplemented from EMAN::CircularMaskProcessor.
Definition at line 2457 of file processor.h.
References EMAN::CircularMaskProcessor::get_param_types(), EMAN::EMObject::INT, and EMAN::TypeDict::put().
02458 { 02459 TypeDict d = CircularMaskProcessor::get_param_types(); 02460 d.put("ring_width", EMObject::INT, "The width of the mask ring."); 02461 return d; 02462 }
static Processor* EMAN::MaskEdgeMeanProcessor::NEW | ( | ) | [inline, static] |
Definition at line 2443 of file processor.h.
02444 { 02445 return new MaskEdgeMeanProcessor(); 02446 }
void EMAN::MaskEdgeMeanProcessor::process_dist_pixel | ( | float * | pixel, | |
float | dist | |||
) | const [inline, protected, virtual] |
Implements EMAN::CircularMaskProcessor.
Definition at line 2475 of file processor.h.
References EMAN::CircularMaskProcessor::inner_radius_square, EMAN::CircularMaskProcessor::outer_radius_square, and ring_avg.
02476 { 02477 if (dist >= outer_radius_square || dist < inner_radius_square){ 02478 *pixel = ring_avg; 02479 } 02480 }
void EMAN::MaskEdgeMeanProcessor::set_params | ( | const Dict & | new_params | ) | [inline, virtual] |
Set the processor parameters using a key/value dictionary.
new_params | A dictionary containing the new parameters. |
Reimplemented from EMAN::CircularMaskProcessor.
Definition at line 2448 of file processor.h.
References EMAN::Processor::params, ring_width, and EMAN::CircularMaskProcessor::set_params().
02449 { 02450 CircularMaskProcessor::set_params(new_params); 02451 ring_width = params["ring_width"]; 02452 if (ring_width == 0) { 02453 ring_width = 1; 02454 } 02455 }
const string MaskEdgeMeanProcessor::NAME = "mask.ringmean" [static] |
float EMAN::MaskEdgeMeanProcessor::ring_avg [private] |
int EMAN::MaskEdgeMeanProcessor::ring_width [private] |