#include <processor.h>
Inheritance diagram for EMAN::BoxMedianProcessor:
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 Processor * | NEW () |
Static Public Attributes | |
static const string | NAME = "eman1.filter.median" |
Protected Member Functions | |
void | process_pixel (float *pixel, const float *array, int n) const |
pixel = median of values surrounding pixel.
Definition at line 3008 of file processor.h.
string EMAN::BoxMedianProcessor::get_desc | ( | ) | const [inline, virtual] |
Get the descrition of this specific processor.
This function must be overwritten by a subclass.
Implements EMAN::Processor.
Definition at line 3020 of file processor.h.
03021 { 03022 return "A processor for noise reduction. pixel = median of values surrounding pixel."; 03023 }
string EMAN::BoxMedianProcessor::get_name | ( | ) | const [inline, virtual] |
Get the processor's name.
Each processor is identified by a unique name.
Implements EMAN::Processor.
Definition at line 3011 of file processor.h.
References NAME.
03012 { 03013 return NAME; 03014 }
static Processor* EMAN::BoxMedianProcessor::NEW | ( | ) | [inline, static] |
void EMAN::BoxMedianProcessor::process_pixel | ( | float * | pixel, | |
const float * | array, | |||
int | n | |||
) | const [inline, protected, virtual] |
Implements EMAN::BoxStatProcessor.
Definition at line 3028 of file processor.h.
03029 { 03030 float *data = new float[n]; 03031 memcpy(data, array, sizeof(float) * n); 03032 03033 for (int i = 0; i <= n / 2; i++) 03034 { 03035 for (int j = i + 1; j < n; j++) 03036 { 03037 if (data[i] < data[j]) { 03038 float t = data[i]; 03039 data[i] = data[j]; 03040 data[j] = t; 03041 } 03042 } 03043 } 03044 03045 if (n % 2 != 0) 03046 { 03047 *pixel = data[n / 2]; 03048 } 03049 else { 03050 *pixel = (data[n / 2] + data[n / 2 - 1]) / 2; 03051 } 03052 if( data ) 03053 { 03054 delete[]data; 03055 data = 0; 03056 } 03057 }
const string BoxMedianProcessor::NAME = "eman1.filter.median" [static] |