EMAN::BoxMedianProcessor Class Reference

A processor for noise reduction. More...

#include <processor.h>

Inheritance diagram for EMAN::BoxMedianProcessor:

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

Collaboration graph
[legend]
List of all members.

Public Member Functions

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 = "eman1.filter.median"

Protected Member Functions

void process_pixel (float *pixel, const float *array, int n) const

Detailed Description

A processor for noise reduction.

pixel = median of values surrounding pixel.

Definition at line 3010 of file processor.h.


Member Function Documentation

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

03023                 {
03024                         return "A processor for noise reduction. pixel = median of values surrounding pixel.";
03025                 }

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

References NAME.

03014                 {
03015                         return NAME;
03016                 }

static Processor* EMAN::BoxMedianProcessor::NEW (  )  [inline, static]

Definition at line 3017 of file processor.h.

03018                 {
03019                         return new BoxMedianProcessor();
03020                 }

void EMAN::BoxMedianProcessor::process_pixel ( float *  pixel,
const float *  array,
int  n 
) const [inline, protected, virtual]

Implements EMAN::BoxStatProcessor.

Definition at line 3030 of file processor.h.

References data, and t.

03031                 {
03032                         float *data = new float[n];
03033                         memcpy(data, array, sizeof(float) * n);
03034 
03035                         for (int i = 0; i <= n / 2; i++)
03036                         {
03037                                 for (int j = i + 1; j < n; j++)
03038                                 {
03039                                         if (data[i] < data[j]) {
03040                                                 float t = data[i];
03041                                                 data[i] = data[j];
03042                                                 data[j] = t;
03043                                         }
03044                                 }
03045                         }
03046 
03047                         if (n % 2 != 0)
03048                         {
03049                                 *pixel = data[n / 2];
03050                         }
03051                         else {
03052                                 *pixel = (data[n / 2] + data[n / 2 - 1]) / 2;
03053                         }
03054                         if( data )
03055                         {
03056                                 delete[]data;
03057                                 data = 0;
03058                         }
03059                 }


Member Data Documentation

const string BoxMedianProcessor::NAME = "eman1.filter.median" [static]

Definition at line 3027 of file processor.h.

Referenced by get_name().


The documentation for this class was generated from the following files:
Generated on Tue Jun 11 12:43:58 2013 for EMAN2 by  doxygen 1.4.7