#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 2730 of file processor.h.
|
Definition at line 2733 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 2752 of file processor.h. 02753 { 02754 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()."; 02755 }
|
|
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 2745 of file processor.h. References EMAN::TypeDict::put(). 02746 { 02747 TypeDict d; 02748 d.put("areasize", EMObject::INT, "The width of the area to process (not radius)"); 02749 return d; 02750 }
|
|
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 1564 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. 01565 { 01566 if (!image) { 01567 LOGWARN("NULL Image"); 01568 return; 01569 } 01570 01571 float *data = image->get_data(); 01572 01573 nx = image->get_xsize(); 01574 ny = image->get_ysize(); 01575 nz = image->get_zsize(); 01576 01577 int n = (areasize - 1) / 2; 01578 matrix_size = areasize * areasize; 01579 01580 if (nz > 1) { 01581 matrix_size *= areasize; 01582 } 01583 01584 float *matrix = new float[matrix_size]; 01585 kernel = new float[matrix_size]; 01586 01587 size_t cpysize = areasize * sizeof(float); 01588 size_t start = (nx * ny + nx + 1) * n; 01589 01590 int xend = nx - n; 01591 int yend = ny - n; 01592 01593 int zstart = n; 01594 int zend = nz - n; 01595 01596 int zbox_start = 0; 01597 int zbox_end = areasize; 01598 01599 if (nz == 1) { 01600 zstart = 0; 01601 zend = 1; 01602 zbox_end = 1; 01603 } 01604 01605 size_t nsec = (size_t)nx * (size_t)ny; 01606 int box_nsec = areasize * areasize; 01607 01608 create_kernel(); 01609 01610 size_t total_size = (size_t)nx * (size_t)ny * (size_t)nz; 01611 float *data2 = new float[total_size]; 01612 memcpy(data2, data, total_size * sizeof(float)); 01613 01614 size_t k; 01615 for (int z = zstart; z < zend; z++) { 01616 for (int y = n; y < yend; y++) { 01617 for (int x = n; x < xend; x++) { 01618 01619 k = (size_t)z * nsec + y * nx + x; 01620 01621 for (int bz = zbox_start; bz < zbox_end; bz++) { 01622 for (int by = 0; by < areasize; by++) { 01623 memcpy(&matrix[(size_t)bz * box_nsec + by * areasize], 01624 &data2[k - start + bz * nsec + by * nx], cpysize); 01625 } 01626 } 01627 01628 process_pixel(&data[k], (float) x, (float) y, (float) z, matrix); 01629 } 01630 } 01631 } 01632 01633 if( matrix ) 01634 { 01635 delete[]matrix; 01636 matrix = 0; 01637 } 01638 01639 if( kernel ) 01640 { 01641 delete[]kernel; 01642 kernel = 0; 01643 } 01644 image->update(); 01645 }
|
|
Reimplemented in EMAN::ZeroConstantProcessor. Definition at line 2758 of file processor.h. Referenced by process_inplace(). 02759 { 02760 for (int i = 0; i < matrix_size; i++) 02761 { 02762 *pixel += area_matrix[i] * kernel[i]; 02763 } 02764 }
|
|
Set the processor parameters using a key/value dictionary.
Reimplemented from EMAN::Processor. Definition at line 2739 of file processor.h.
|
|
Definition at line 2768 of file processor.h. Referenced by process_inplace(). |
|
Definition at line 2770 of file processor.h. Referenced by process_inplace(). |
|
Definition at line 2769 of file processor.h. Referenced by process_inplace(). |
|
Definition at line 2771 of file processor.h. Referenced by process_inplace(). |
|
Definition at line 2772 of file processor.h. Referenced by process_inplace(). |
|
Definition at line 2773 of file processor.h. Referenced by process_inplace(). |