#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 3231 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 3245 of file processor.h. 03246 { 03247 return "averages over cal_half_width, then sets the value in a local block"; 03248 }
|
|
Get the processor's name. Each processor is identified by a unique name.
Implements EMAN::Processor. Definition at line 3236 of file processor.h. Referenced by process_inplace(). 03237 {
03238 return NAME;
03239 }
|
|
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 3250 of file processor.h. References EMAN::TypeDict::put(). 03251 { 03252 TypeDict d; 03253 d.put("cal_half_width", EMObject::FLOAT, "cal_half_width is dx/dy for calculating an average"); 03254 d.put("fill_half_width", EMObject::FLOAT, "fill_half_width is dx/dy for fill/step"); 03255 return d; 03256 }
|
|
Definition at line 3240 of file processor.h. 03241 { 03242 return new DiffBlockProcessor(); 03243 }
|
|
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 1812 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. 01813 { 01814 if (!image) { 01815 LOGWARN("NULL Image"); 01816 return; 01817 } 01818 01819 int nz = image->get_zsize(); 01820 01821 if (nz > 1) { 01822 LOGERR("%s Processor doesn't support 3D", get_name().c_str()); 01823 throw ImageDimensionException("3D model not supported"); 01824 } 01825 01826 int nx = image->get_xsize(); 01827 int ny = image->get_ysize(); 01828 01829 int v1 = params["cal_half_width"]; 01830 int v2 = params["fill_half_width"]; 01831 01832 int v0 = v1 > v2 ? v1 : v2; 01833 01834 if (v2 <= 0) { 01835 v2 = v1; 01836 } 01837 01838 float *data = image->get_data(); 01839 01840 for (int y = v0; y <= ny - v0 - 1; y += v2) { 01841 for (int x = v0; x <= nx - v0 - 1; x += v2) { 01842 01843 float sum = 0; 01844 for (int y1 = y - v1; y1 <= y + v1; y1++) { 01845 for (int x1 = x - v1; x1 <= x + v1; x1++) { 01846 sum += data[x1 + y1 * nx]; 01847 } 01848 } 01849 float mean = sum / ((v1 * 2 + 1) * (v1 * 2 + 1)); 01850 01851 for (int j = y - v2; j <= y + v2; j++) { 01852 for (int i = x - v2; i <= x + v2; i++) { 01853 data[i + j * nx] = mean; 01854 } 01855 } 01856 } 01857 } 01858 01859 image->update(); 01860 }
|
|
Definition at line 122 of file processor.cpp. |