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 ()

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


Member Function Documentation

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

02753                 {
02754                         return "eman1.filter.median";
02755                 }

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

Definition at line 2756 of file processor.h.

02757                 {
02758                         return new BoxMedianProcessor();
02759                 }

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

02762                 {
02763                         return "A processor for noise reduction. pixel = median of values surrounding pixel.";
02764                 }

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

Implements EMAN::BoxStatProcessor.

Definition at line 2768 of file processor.h.

References data, and t.

02769                 {
02770                         float *data = new float[n];
02771                         memcpy(data, array, sizeof(float) * n);
02772 
02773                         for (int i = 0; i <= n / 2; i++)
02774                         {
02775                                 for (int j = i + 1; j < n; j++)
02776                                 {
02777                                         if (data[i] < data[j]) {
02778                                                 float t = data[i];
02779                                                 data[i] = data[j];
02780                                                 data[j] = t;
02781                                         }
02782                                 }
02783                         }
02784 
02785                         if (n % 2 != 0)
02786                         {
02787                                 *pixel = data[n / 2];
02788                         }
02789                         else {
02790                                 *pixel = (data[n / 2] + data[n / 2 - 1]) / 2;
02791                         }
02792                         if( data )
02793                         {
02794                                 delete[]data;
02795                                 data = 0;
02796                         }
02797                 }


The documentation for this class was generated from the following file:

Generated on Sat Nov 21 02:20:29 2009 for EMAN2 by  doxygen 1.5.6