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

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

03017                 {
03018                         return "A processor for noise reduction. pixel = median of values surrounding pixel.";
03019                 }

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

References NAME.

03008                 {
03009                         return NAME;
03010                 }

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

Definition at line 3011 of file processor.h.

03012                 {
03013                         return new BoxMedianProcessor();
03014                 }

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

Implements EMAN::BoxStatProcessor.

Definition at line 3024 of file processor.h.

References data, and t.

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


Member Data Documentation

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

Definition at line 3021 of file processor.h.

Referenced by get_name().


The documentation for this class was generated from the following files:
Generated on Mon Jul 19 13:06:49 2010 for EMAN2 by  doxygen 1.4.4