#include <processor.h>
Inheritance diagram for EMAN::AreaProcessor:
Public Member Functions | |
AreaProcessor () | |
void | process_inplace (EMData *image) |
To process an image in-place. | |
void | set_params (const Dict &new_params) |
Set the processor parameters using a key/value dictionary. | |
TypeDict | get_param_types () const |
Get processor parameter information in a dictionary. | |
string | get_desc () const |
Get the descrition of this specific processor. | |
Protected Member Functions | |
virtual void | process_pixel (float *pixel, float, float, float, float *area_matrix) const |
virtual void | create_kernel () const =0 |
Protected Attributes | |
int | areasize |
int | matrix_size |
float * | kernel |
int | nx |
int | ny |
int | nz |
This is the base class. Specific AreaProcessor needs to implement function create_kernel().
areasize | The width of the area to process (not radius) |
Definition at line 2821 of file processor.h.
|
Definition at line 2824 of file processor.h.
|
|
Implemented in EMAN::LaplacianProcessor, and EMAN::ZeroConstantProcessor. Referenced by process_inplace(). |
|
Get the descrition of this specific processor. This function must be overwritten by a subclass.
Implements EMAN::Processor. Reimplemented in EMAN::LaplacianProcessor, and EMAN::ZeroConstantProcessor. Definition at line 2843 of file processor.h. 02844 { 02845 return "AreaProcessor use pixel values and coordinates of a real-space square area. This is the base class. Specific AreaProcessor needs to implement function create_kernel()."; 02846 }
|
|
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 2836 of file processor.h. References EMAN::EMObject::INT, and EMAN::TypeDict::put(). 02837 { 02838 TypeDict d; 02839 d.put("areasize", EMObject::INT, "The width of the area to process (not radius)"); 02840 return d; 02841 }
|
|
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 1548 of file processor.cpp. References areasize, create_kernel(), data, EMAN::EMData::get_data(), EMAN::EMData::get_xsize(), EMAN::EMData::get_ysize(), EMAN::EMData::get_zsize(), kernel, LOGWARN, matrix(), matrix_size, nx, ny, nz, process_pixel(), EMAN::EMData::update(), x, and y. 01549 { 01550 if (!image) { 01551 LOGWARN("NULL Image"); 01552 return; 01553 } 01554 01555 float *data = image->get_data(); 01556 01557 nx = image->get_xsize(); 01558 ny = image->get_ysize(); 01559 nz = image->get_zsize(); 01560 01561 int n = (areasize - 1) / 2; 01562 matrix_size = areasize * areasize; 01563 01564 if (nz > 1) { 01565 matrix_size *= areasize; 01566 } 01567 01568 float *matrix = new float[matrix_size]; 01569 kernel = new float[matrix_size]; 01570 01571 int cpysize = areasize * (int) sizeof(float); 01572 int start = (nx * ny + nx + 1) * n; 01573 01574 int xend = nx - n; 01575 int yend = ny - n; 01576 01577 int zstart = n; 01578 int zend = nz - n; 01579 01580 int zbox_start = 0; 01581 int zbox_end = areasize; 01582 01583 if (nz == 1) { 01584 zstart = 0; 01585 zend = 1; 01586 zbox_end = 1; 01587 } 01588 01589 size_t nsec = (size_t)nx * (size_t)ny; 01590 int box_nsec = areasize * areasize; 01591 01592 create_kernel(); 01593 01594 size_t total_size = (size_t)nx * (size_t)ny * (size_t)nz; 01595 float *data2 = new float[total_size]; 01596 memcpy(data2, data, total_size * sizeof(float)); 01597 01598 size_t k; 01599 for (int z = zstart; z < zend; z++) { 01600 for (int y = n; y < yend; y++) { 01601 for (int x = n; x < xend; x++) { 01602 01603 k = z * nsec + y * nx + x; 01604 01605 for (int bz = zbox_start; bz < zbox_end; bz++) { 01606 for (int by = 0; by < areasize; by++) { 01607 memcpy(&matrix[bz * box_nsec + by * areasize], 01608 &data2[k - start + bz * nsec + by * nx], cpysize); 01609 } 01610 } 01611 01612 process_pixel(&data[k], (float) x, (float) y, (float) z, matrix); 01613 } 01614 } 01615 } 01616 01617 if( matrix ) 01618 { 01619 delete[]matrix; 01620 matrix = 0; 01621 } 01622 01623 if( kernel ) 01624 { 01625 delete[]kernel; 01626 kernel = 0; 01627 } 01628 image->update(); 01629 }
|
|
Reimplemented in EMAN::ZeroConstantProcessor. Definition at line 2849 of file processor.h. References kernel, and matrix_size. Referenced by process_inplace(). 02850 { 02851 for (int i = 0; i < matrix_size; i++) 02852 { 02853 *pixel += area_matrix[i] * kernel[i]; 02854 } 02855 }
|
|
Set the processor parameters using a key/value dictionary.
Reimplemented from EMAN::Processor. Definition at line 2830 of file processor.h. References areasize, and EMAN::Processor::params.
|
|
Definition at line 2859 of file processor.h. Referenced by EMAN::LaplacianProcessor::create_kernel(), process_inplace(), and set_params(). |
|
Definition at line 2861 of file processor.h. Referenced by EMAN::LaplacianProcessor::create_kernel(), process_inplace(), and process_pixel(). |
|
Definition at line 2860 of file processor.h. Referenced by process_inplace(), and process_pixel(). |
|
Definition at line 2862 of file processor.h. Referenced by process_inplace(). |
|
Definition at line 2863 of file processor.h. Referenced by process_inplace(). |
|
Definition at line 2864 of file processor.h. Referenced by EMAN::LaplacianProcessor::create_kernel(), and process_inplace(). |