#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 2943 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 2948 of file processor.h. 02949 {
02950 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).";
02951 }
|
|
|
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 2953 of file processor.h. References EMAN::TypeDict::put(). 02954 {
02955 TypeDict d;
02956 d.put("radius", EMObject::INT, "The radius of the search box, default is 1 which results in a 3x3 box (3 = 2xradius + 1)");
02957 return d;
02958 }
|
|
|
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 1729 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(). 01730 {
01731 if (!image) {
01732 LOGWARN("NULL Image");
01733 return;
01734 }
01735
01736 int nx = image->get_xsize();
01737 int ny = image->get_ysize();
01738 int nz = image->get_zsize();
01739
01740 int n = params.set_default("radius",1);
01741 int areasize = 2 * n + 1;
01742
01743 int matrix_size = areasize * areasize;
01744 if (nz > 1) {
01745 matrix_size *= areasize;
01746 }
01747
01748 float *array = new float[matrix_size];
01749 // image->process_inplace("normalize");
01750
01751 float *data = image->get_data();
01752 size_t total_size = (size_t)nx * (size_t)ny * (size_t)nz;
01753 float *data2 = new float[total_size];
01754 memcpy(data2, data, total_size * sizeof(float));
01755
01756 int z_begin = 0;
01757 int z_end = 1;
01758 int nzz=0;
01759 if (nz > 1) {
01760 z_begin = n;
01761 z_end = nz - n;
01762 nzz=n;
01763 }
01764
01765 int nxy = nx * ny;
01766
01767 for (int k = z_begin; k < z_end; k++) {
01768 size_t knxy = (size_t)k * nxy;
01769
01770 for (int j = n; j < ny - n; j++) {
01771 int jnx = j * nx;
01772
01773 for (int i = n; i < nx - n; i++) {
01774 size_t s = 0;
01775
01776 for (int i2 = i - n; i2 <= i + n; i2++) {
01777 for (int j2 = j - n; j2 <= j + n; j2++) {
01778 for (int k2 = k - nzz; k2 <= k + nzz; k2++) {
01779 array[s] = data2[i2 + j2 * nx + (size_t)k2 * nxy];
01780 ++s;
01781 }
01782 }
01783 }
01784
01785 process_pixel(&data[i + jnx + knxy], array, matrix_size);
01786 }
01787 }
01788 }
01789
01790 image->update();
01791
01792 if( data2 )
01793 {
01794 delete[]data2;
01795 data2 = 0;
01796 }
01797 }
|
|
||||||||||||||||
|
Implemented in EMAN::BoxMedianProcessor, EMAN::BoxSigmaProcessor, EMAN::BoxMaxProcessor, EMAN::MinusPeakProcessor, and EMAN::PeakOnlyProcessor. Referenced by process_inplace(). |
1.3.9.1