#include <processor.h>
Inheritance diagram for EMAN::DiffBlockProcessor:


Public Member Functions | |
| void | process_inplace (EMData *image) |
| To process an image in-place. | |
| string | get_name () const |
| Get the processor's name. | |
| string | get_desc () const |
| Get the descrition of this specific processor. | |
| TypeDict | get_param_types () const |
| Get processor parameter information in a dictionary. | |
Static Public Member Functions | |
| Processor * | NEW () |
Static Public Attributes | |
| const string | NAME = "eman1.filter.blockrange" |
| cal_half_width | cal_half_width is dx/dy for calculating an average | |
| fill_half_width | fill_half_width is dx/dy for fill/step |
Definition at line 3150 of file processor.h.
|
|
Get the descrition of this specific processor. This function must be overwritten by a subclass.
Implements EMAN::Processor. Definition at line 3164 of file processor.h. 03165 {
03166 return "averages over cal_half_width, then sets the value in a local block";
03167 }
|
|
|
Get the processor's name. Each processor is identified by a unique name.
Implements EMAN::Processor. Definition at line 3155 of file processor.h. Referenced by process_inplace(). 03156 {
03157 return NAME;
03158 }
|
|
|
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. Definition at line 3169 of file processor.h. References EMAN::TypeDict::put(). 03170 {
03171 TypeDict d;
03172 d.put("cal_half_width", EMObject::FLOAT, "cal_half_width is dx/dy for calculating an average");
03173 d.put("fill_half_width", EMObject::FLOAT, "fill_half_width is dx/dy for fill/step");
03174 return d;
03175 }
|
|
|
Definition at line 3159 of file processor.h. 03160 {
03161 return new DiffBlockProcessor();
03162 }
|
|
|
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 1771 of file processor.cpp. References data, EMAN::EMData::get_data(), get_name(), EMAN::EMData::get_xsize(), EMAN::EMData::get_ysize(), EMAN::EMData::get_zsize(), ImageDimensionException, LOGERR, LOGWARN, nx, ny, EMAN::EMData::update(), v0, x, and y. 01772 {
01773 if (!image) {
01774 LOGWARN("NULL Image");
01775 return;
01776 }
01777
01778 int nz = image->get_zsize();
01779
01780 if (nz > 1) {
01781 LOGERR("%s Processor doesn't support 3D", get_name().c_str());
01782 throw ImageDimensionException("3D model not supported");
01783 }
01784
01785 int nx = image->get_xsize();
01786 int ny = image->get_ysize();
01787
01788 int v1 = params["cal_half_width"];
01789 int v2 = params["fill_half_width"];
01790
01791 int v0 = v1 > v2 ? v1 : v2;
01792
01793 if (v2 <= 0) {
01794 v2 = v1;
01795 }
01796
01797 float *data = image->get_data();
01798
01799 for (int y = v0; y <= ny - v0 - 1; y += v2) {
01800 for (int x = v0; x <= nx - v0 - 1; x += v2) {
01801
01802 float sum = 0;
01803 for (int y1 = y - v1; y1 <= y + v1; y1++) {
01804 for (int x1 = x - v1; x1 <= x + v1; x1++) {
01805 sum += data[x1 + y1 * nx];
01806 }
01807 }
01808 float mean = sum / ((v1 * 2 + 1) * (v1 * 2 + 1));
01809
01810 for (int j = y - v2; j <= y + v2; j++) {
01811 for (int i = x - v2; i <= x + v2; i++) {
01812 data[i + j * nx] = mean;
01813 }
01814 }
01815 }
01816 }
01817
01818 image->update();
01819 }
|
|
|
Definition at line 121 of file processor.cpp. |
1.3.9.1