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

02886                 {
02887                         return "A processor for noise reduction. pixel = median of values surrounding pixel.";
02888                 }

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

References NAME.

02877                 {
02878                         return NAME;
02879                 }

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

Definition at line 2880 of file processor.h.

02881                 {
02882                         return new BoxMedianProcessor();
02883                 }

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

Implements EMAN::BoxStatProcessor.

Definition at line 2893 of file processor.h.

References data, and t.

02894                 {
02895                         float *data = new float[n];
02896                         memcpy(data, array, sizeof(float) * n);
02897 
02898                         for (int i = 0; i <= n / 2; i++)
02899                         {
02900                                 for (int j = i + 1; j < n; j++)
02901                                 {
02902                                         if (data[i] < data[j]) {
02903                                                 float t = data[i];
02904                                                 data[i] = data[j];
02905                                                 data[j] = t;
02906                                         }
02907                                 }
02908                         }
02909 
02910                         if (n % 2 != 0)
02911                         {
02912                                 *pixel = data[n / 2];
02913                         }
02914                         else {
02915                                 *pixel = (data[n / 2] + data[n / 2 - 1]) / 2;
02916                         }
02917                         if( data )
02918                         {
02919                                 delete[]data;
02920                                 data = 0;
02921                         }
02922                 }


Member Data Documentation

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

Definition at line 2890 of file processor.h.

Referenced by get_name().


The documentation for this class was generated from the following files:
Generated on Mon Mar 7 18:02:38 2011 for EMAN2 by  doxygen 1.4.7