#include <processor.h>
Inheritance diagram for EMAN::GradientRemoverProcessor:
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. | |
Static Public Member Functions | |
static Processor * | NEW () |
Static Public Attributes | |
static const string | NAME = "math.lineargradientfix" |
Definition at line 3584 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 3598 of file processor.h.
|
|
Get the processor's name. Each processor is identified by a unique name.
Implements EMAN::Processor. Definition at line 3589 of file processor.h. References NAME. Referenced by process_inplace(). 03590 { 03591 return NAME; 03592 }
|
|
Definition at line 3593 of file processor.h. 03594 { 03595 return new GradientRemoverProcessor(); 03596 }
|
|
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 2550 of file processor.cpp. References b, EMAN::Util::calc_least_square_fit(), EMAN::EMData::get_data(), get_name(), EMAN::EMData::get_xsize(), EMAN::EMData::get_ysize(), EMAN::EMData::get_zsize(), ImageDimensionException, LOGERR, LOGWARN, and EMAN::EMData::update(). 02551 { 02552 if (!image) { 02553 LOGWARN("NULL Image"); 02554 return; 02555 } 02556 02557 int nz = image->get_zsize(); 02558 if (nz > 1) { 02559 LOGERR("%s Processor doesn't support 3D model", get_name().c_str()); 02560 throw ImageDimensionException("3D model not supported"); 02561 } 02562 02563 int nx = image->get_xsize(); 02564 int ny = image->get_ysize(); 02565 float *dy = new float[ny]; 02566 float m = 0; 02567 float b = 0; 02568 float sum_y = 0; 02569 float *data = image->get_data(); 02570 02571 for (int i = 0; i < ny; i++) { 02572 Util::calc_least_square_fit(nx, 0, data + i * nx, &m, &b, false); 02573 dy[i] = b; 02574 sum_y += m; 02575 } 02576 02577 float mean_y = sum_y / ny; 02578 float sum_x = 0; 02579 Util::calc_least_square_fit(ny, 0, dy, &sum_x, &b, false); 02580 02581 for (int j = 0; j < ny; j++) { 02582 for (int i = 0; i < nx; i++) { 02583 data[i + j * nx] -= i * sum_x + j * mean_y + b; 02584 } 02585 } 02586 02587 image->update(); 02588 }
|
|
Definition at line 3603 of file processor.h. Referenced by get_name(). |