#include <processor.h>


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 () |
Protected Member Functions | |
| void | process_pixel (float *pixel, const float *array, int n) const |
pixel = median of values surrounding pixel.
Definition at line 2749 of file processor.h.
| 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 2752 of file processor.h.
| static Processor* EMAN::BoxMedianProcessor::NEW | ( | ) | [inline, static] |
| 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 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.
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 }
1.5.6