#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 2786 of file processor.h.
|
|
Definition at line 2789 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 2808 of file processor.h. 02809 {
02810 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().";
02811 }
|
|
|
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 2801 of file processor.h. References EMAN::TypeDict::put(). 02802 {
02803 TypeDict d;
02804 d.put("areasize", EMObject::INT, "The width of the area to process (not radius)");
02805 return d;
02806 }
|
|
|
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 1595 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. 01596 {
01597 if (!image) {
01598 LOGWARN("NULL Image");
01599 return;
01600 }
01601
01602 float *data = image->get_data();
01603
01604 nx = image->get_xsize();
01605 ny = image->get_ysize();
01606 nz = image->get_zsize();
01607
01608 int n = (areasize - 1) / 2;
01609 matrix_size = areasize * areasize;
01610
01611 if (nz > 1) {
01612 matrix_size *= areasize;
01613 }
01614
01615 float *matrix = new float[matrix_size];
01616 kernel = new float[matrix_size];
01617
01618 size_t cpysize = areasize * sizeof(float);
01619 size_t start = (nx * ny + nx + 1) * n;
01620
01621 int xend = nx - n;
01622 int yend = ny - n;
01623
01624 int zstart = n;
01625 int zend = nz - n;
01626
01627 int zbox_start = 0;
01628 int zbox_end = areasize;
01629
01630 if (nz == 1) {
01631 zstart = 0;
01632 zend = 1;
01633 zbox_end = 1;
01634 }
01635
01636 size_t nsec = (size_t)nx * (size_t)ny;
01637 int box_nsec = areasize * areasize;
01638
01639 create_kernel();
01640
01641 size_t total_size = (size_t)nx * (size_t)ny * (size_t)nz;
01642 float *data2 = new float[total_size];
01643 memcpy(data2, data, total_size * sizeof(float));
01644
01645 size_t k;
01646 for (int z = zstart; z < zend; z++) {
01647 for (int y = n; y < yend; y++) {
01648 for (int x = n; x < xend; x++) {
01649
01650 k = (size_t)z * nsec + y * nx + x;
01651
01652 for (int bz = zbox_start; bz < zbox_end; bz++) {
01653 for (int by = 0; by < areasize; by++) {
01654 memcpy(&matrix[(size_t)bz * box_nsec + by * areasize],
01655 &data2[k - start + bz * nsec + by * nx], cpysize);
01656 }
01657 }
01658
01659 process_pixel(&data[k], (float) x, (float) y, (float) z, matrix);
01660 }
01661 }
01662 }
01663
01664 if( matrix )
01665 {
01666 delete[]matrix;
01667 matrix = 0;
01668 }
01669
01670 if( kernel )
01671 {
01672 delete[]kernel;
01673 kernel = 0;
01674 }
01675 image->update();
01676 }
|
|
||||||||||||||||||||||||
|
Reimplemented in EMAN::ZeroConstantProcessor. Definition at line 2814 of file processor.h. Referenced by process_inplace(). 02815 {
02816 for (int i = 0; i < matrix_size; i++)
02817 {
02818 *pixel += area_matrix[i] * kernel[i];
02819 }
02820 }
|
|
|
Set the processor parameters using a key/value dictionary.
Reimplemented from EMAN::Processor. Definition at line 2795 of file processor.h.
|
|
|
Definition at line 2824 of file processor.h. Referenced by process_inplace(). |
|
|
Definition at line 2826 of file processor.h. Referenced by process_inplace(). |
|
|
Definition at line 2825 of file processor.h. Referenced by process_inplace(). |
|
|
Definition at line 2827 of file processor.h. Referenced by process_inplace(). |
|
|
Definition at line 2828 of file processor.h. Referenced by process_inplace(). |
|
|
Definition at line 2829 of file processor.h. Referenced by process_inplace(). |
1.3.9.1