#include <processor.h>
Inheritance diagram for EMAN::BoxStatProcessor:
Public Member Functions | |
void | process_inplace (EMData *image) |
To process an image in-place. | |
TypeDict | get_param_types () const |
Get processor parameter information in a dictionary. | |
Static Public Member Functions | |
string | get_group_desc () |
Get the description of this group of processors. | |
Protected Member Functions | |
virtual void | process_pixel (float *pixel, const float *array, int n) const =0 |
These processors compute every output pixel using information from a reduced region on the neighborhood of the input pixel. The classical form are the 3x3 processors. BoxStatProcessors could perform diverse tasks ranging from noise reduction, to differential , to mathematical morphology. BoxStatProcessor class is the base class. Specific BoxStatProcessor needs to define process_pixel(float *pixel, const float *array, int n).
radius | The radius of the search box, default is 1 which results in a 3x3 box (3 = 2xradius + 1) |
Definition at line 2986 of file processor.h.
|
Get the description of this group of processors. This function is defined in a parent class. It gives a introduction to a group of processors.
Reimplemented from EMAN::Processor. Definition at line 2991 of file processor.h. 02992 { 02993 return "BoxStatProcessor files are a kind of neighborhood processors. These processors compute every output pixel using information from a reduced region on the neighborhood of the input pixel. The classical form are the 3x3 processors. BoxStatProcessors could perform diverse tasks ranging from noise reduction, to differential , to mathematical morphology. BoxStatProcessor class is the base class. Specific BoxStatProcessor needs to define process_pixel(float *pixel, const float *array, int n)."; 02994 }
|
|
Get processor parameter information in a dictionary. Each parameter has one record in the dictionary. Each record contains its name, data-type, and description.
Reimplemented from EMAN::Processor. Reimplemented in EMAN::PeakOnlyProcessor. Definition at line 2996 of file processor.h. References EMAN::TypeDict::put(). 02997 { 02998 TypeDict d; 02999 d.put("radius", EMObject::INT, "The radius of the search box, default is 1 which results in a 3x3 box (3 = 2xradius + 1)"); 03000 return d; 03001 }
|
|
To process an image in-place. For those processors which can only be processed out-of-place, override this function to just print out some error message to remind user call the out-of-place version.
Implements EMAN::Processor. Definition at line 1742 of file processor.cpp. References data, EMAN::EMData::get_data(), EMAN::EMData::get_xsize(), EMAN::EMData::get_ysize(), EMAN::EMData::get_zsize(), LOGWARN, nx, ny, process_pixel(), EMAN::Dict::set_default(), and EMAN::EMData::update(). 01743 { 01744 if (!image) { 01745 LOGWARN("NULL Image"); 01746 return; 01747 } 01748 01749 int nx = image->get_xsize(); 01750 int ny = image->get_ysize(); 01751 int nz = image->get_zsize(); 01752 01753 int n = params.set_default("radius",1); 01754 int areasize = 2 * n + 1; 01755 01756 int matrix_size = areasize * areasize; 01757 if (nz > 1) { 01758 matrix_size *= areasize; 01759 } 01760 01761 float *array = new float[matrix_size]; 01762 // image->process_inplace("normalize"); 01763 01764 float *data = image->get_data(); 01765 size_t total_size = (size_t)nx * (size_t)ny * (size_t)nz; 01766 float *data2 = new float[total_size]; 01767 memcpy(data2, data, total_size * sizeof(float)); 01768 01769 int z_begin = 0; 01770 int z_end = 1; 01771 int nzz=0; 01772 if (nz > 1) { 01773 z_begin = n; 01774 z_end = nz - n; 01775 nzz=n; 01776 } 01777 01778 int nxy = nx * ny; 01779 01780 for (int k = z_begin; k < z_end; k++) { 01781 size_t knxy = (size_t)k * nxy; 01782 01783 for (int j = n; j < ny - n; j++) { 01784 int jnx = j * nx; 01785 01786 for (int i = n; i < nx - n; i++) { 01787 size_t s = 0; 01788 01789 for (int i2 = i - n; i2 <= i + n; i2++) { 01790 for (int j2 = j - n; j2 <= j + n; j2++) { 01791 for (int k2 = k - nzz; k2 <= k + nzz; k2++) { 01792 array[s] = data2[i2 + j2 * nx + (size_t)k2 * nxy]; 01793 ++s; 01794 } 01795 } 01796 } 01797 01798 process_pixel(&data[i + jnx + knxy], array, matrix_size); 01799 } 01800 } 01801 } 01802 01803 image->update(); 01804 01805 if( data2 ) 01806 { 01807 delete[]data2; 01808 data2 = 0; 01809 } 01810 }
|
|
Implemented in EMAN::BoxMedianProcessor, EMAN::BoxSigmaProcessor, EMAN::BoxMaxProcessor, EMAN::MinusPeakProcessor, and EMAN::PeakOnlyProcessor. Referenced by process_inplace(). |