#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 2929 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 2941 of file processor.h.
02942 { 02943 return "A processor for noise reduction. pixel = median of values surrounding pixel."; 02944 }
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 2932 of file processor.h.
References NAME.
02933 { 02934 return NAME; 02935 }
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 2949 of file processor.h.
02950 { 02951 float *data = new float[n]; 02952 memcpy(data, array, sizeof(float) * n); 02953 02954 for (int i = 0; i <= n / 2; i++) 02955 { 02956 for (int j = i + 1; j < n; j++) 02957 { 02958 if (data[i] < data[j]) { 02959 float t = data[i]; 02960 data[i] = data[j]; 02961 data[j] = t; 02962 } 02963 } 02964 } 02965 02966 if (n % 2 != 0) 02967 { 02968 *pixel = data[n / 2]; 02969 } 02970 else { 02971 *pixel = (data[n / 2] + data[n / 2 - 1]) / 2; 02972 } 02973 if( data ) 02974 { 02975 delete[]data; 02976 data = 0; 02977 } 02978 }
const string BoxMedianProcessor::NAME = "eman1.filter.median" [static] |