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

02801                 {
02802                         return "A processor for noise reduction. pixel = median of values surrounding pixel.";
02803                 }

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

02792                 {
02793                         return NAME;
02794                 }

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

Definition at line 2795 of file processor.h.

02796                 {
02797                         return new BoxMedianProcessor();
02798                 }

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

Implements EMAN::BoxStatProcessor.

Definition at line 2808 of file processor.h.

References data, and t.

02809                 {
02810                         float *data = new float[n];
02811                         memcpy(data, array, sizeof(float) * n);
02812 
02813                         for (int i = 0; i <= n / 2; i++)
02814                         {
02815                                 for (int j = i + 1; j < n; j++)
02816                                 {
02817                                         if (data[i] < data[j]) {
02818                                                 float t = data[i];
02819                                                 data[i] = data[j];
02820                                                 data[j] = t;
02821                                         }
02822                                 }
02823                         }
02824 
02825                         if (n % 2 != 0)
02826                         {
02827                                 *pixel = data[n / 2];
02828                         }
02829                         else {
02830                                 *pixel = (data[n / 2] + data[n / 2 - 1]) / 2;
02831                         }
02832                         if( data )
02833                         {
02834                                 delete[]data;
02835                                 data = 0;
02836                         }
02837                 }


Member Data Documentation

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

Definition at line 111 of file processor.cpp.


The documentation for this class was generated from the following files:
Generated on Thu Dec 9 13:47:55 2010 for EMAN2 by  doxygen 1.3.9.1