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

ProcessorNEW ()

Static Public Attributes

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

02980                 {
02981                         return "A processor for noise reduction. pixel = median of values surrounding pixel.";
02982                 }

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

02971                 {
02972                         return NAME;
02973                 }

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

Definition at line 2974 of file processor.h.

02975                 {
02976                         return new BoxMedianProcessor();
02977                 }

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

Implements EMAN::BoxStatProcessor.

Definition at line 2987 of file processor.h.

References data, and t.

02988                 {
02989                         float *data = new float[n];
02990                         memcpy(data, array, sizeof(float) * n);
02991 
02992                         for (int i = 0; i <= n / 2; i++)
02993                         {
02994                                 for (int j = i + 1; j < n; j++)
02995                                 {
02996                                         if (data[i] < data[j]) {
02997                                                 float t = data[i];
02998                                                 data[i] = data[j];
02999                                                 data[j] = t;
03000                                         }
03001                                 }
03002                         }
03003 
03004                         if (n % 2 != 0)
03005                         {
03006                                 *pixel = data[n / 2];
03007                         }
03008                         else {
03009                                 *pixel = (data[n / 2] + data[n / 2 - 1]) / 2;
03010                         }
03011                         if( data )
03012                         {
03013                                 delete[]data;
03014                                 data = 0;
03015                         }
03016                 }


Member Data Documentation

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

Definition at line 122 of file processor.cpp.


The documentation for this class was generated from the following files:
Generated on Tue Jul 12 13:52:06 2011 for EMAN2 by  doxygen 1.3.9.1