EMAN2
Public Member Functions | Static Public Member Functions | Static Public Attributes | Protected Member Functions
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 3197 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 3209 of file processor.h.

                {
                        return "A processor for noise reduction. pixel = median of values surrounding pixel.";
                }
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 3200 of file processor.h.

References NAME.

                {
                        return NAME;
                }
static Processor* EMAN::BoxMedianProcessor::NEW ( ) [inline, static]

Definition at line 3204 of file processor.h.

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

Implements EMAN::BoxStatProcessor.

Definition at line 3217 of file processor.h.

References data, and t.

                {
                        float *data = new float[n];
                        memcpy(data, array, sizeof(float) * n);

                        for (int i = 0; i <= n / 2; i++)
                        {
                                for (int j = i + 1; j < n; j++)
                                {
                                        if (data[i] < data[j]) {
                                                float t = data[i];
                                                data[i] = data[j];
                                                data[j] = t;
                                        }
                                }
                        }

                        if (n % 2 != 0)
                        {
                                *pixel = data[n / 2];
                        }
                        else {
                                *pixel = (data[n / 2] + data[n / 2 - 1]) / 2;
                        }
                        if( data )
                        {
                                delete[]data;
                                data = 0;
                        }
                }

Member Data Documentation

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

Definition at line 3214 of file processor.h.

Referenced by get_name().


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