#include <processor.h>
Inheritance diagram for EMAN::RotationalSubstractProcessor:
Public Member Functions | |
virtual void | process_inplace (EMData *image) |
To process an image in-place. | |
virtual string | get_name () const |
Get the processor's name. | |
virtual string | get_desc () const |
Get the descrition of this specific processor. | |
Static Public Member Functions | |
Processor * | NEW () |
Static Public Attributes | |
const string | NAME = "math.rotationalsubtract" |
Definition at line 4393 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 4408 of file processor.h. 04409 { 04410 return "subtracts circularly/spherically symmetric part of an image."; 04411 }
|
|
Get the processor's name. Each processor is identified by a unique name.
Implements EMAN::Processor. Definition at line 4398 of file processor.h. 04399 {
04400 return NAME;
04401 }
|
|
Definition at line 4403 of file processor.h. 04404 { 04405 return new RotationalSubstractProcessor(); 04406 }
|
|
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 4201 of file processor.cpp. References EMAN::EMData::calc_radial_dist(), dist(), EMAN::EMData::get_data(), EMAN::EMData::get_ndim(), EMAN::EMData::get_xsize(), EMAN::EMData::get_ysize(), ImageDimensionException, EMAN::EMData::is_complex(), LOGWARN, nx, ny, rdata, EMAN::EMData::update(), x, and y. 04202 { 04203 if (!image || image->is_complex()) { 04204 LOGWARN("only works on real image. do nothing."); 04205 return; 04206 } 04207 04208 if (image->get_ndim() != 2) throw ImageDimensionException("This processor works only for 2D images"); 04209 04210 float *rdata = image->get_data(); 04211 int nx = image->get_xsize(); 04212 int ny = image->get_ysize(); 04213 04214 vector < float >dist = image->calc_radial_dist(nx / 2, 0, 1,0); 04215 04216 int c = 0; 04217 for (int y = 0; y < ny; y++) { 04218 for (int x = 0; x < nx; x++, c++) { 04219 #ifdef _WIN32 04220 float r = (float) _hypot(x - nx / 2, y - ny / 2); 04221 #else 04222 float r = (float) hypot(x - nx / 2, y - ny / 2); 04223 #endif 04224 int i = (int) floor(r); 04225 r -= i; 04226 if (i >= 0 && i < nx / 2 - 1) { 04227 rdata[c] -= dist[i] * (1.0f - r) + dist[i + 1] * r; 04228 } 04229 else { 04230 rdata[c] = 0; 04231 } 04232 } 04233 } 04234 04235 image->update(); 04236 }
|
|
Definition at line 155 of file processor.cpp. |