#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 4431 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 4446 of file processor.h. 04447 { 04448 return "subtracts circularly/spherically symmetric part of an image."; 04449 }
|
|
Get the processor's name. Each processor is identified by a unique name.
Implements EMAN::Processor. Definition at line 4436 of file processor.h. 04437 {
04438 return NAME;
04439 }
|
|
Definition at line 4441 of file processor.h. 04442 { 04443 return new RotationalSubstractProcessor(); 04444 }
|
|
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 4229 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. 04230 { 04231 if (!image || image->is_complex()) { 04232 LOGWARN("only works on real image. do nothing."); 04233 return; 04234 } 04235 04236 if (image->get_ndim() != 2) throw ImageDimensionException("This processor works only for 2D images"); 04237 04238 float *rdata = image->get_data(); 04239 int nx = image->get_xsize(); 04240 int ny = image->get_ysize(); 04241 04242 vector < float >dist = image->calc_radial_dist(nx / 2, 0, 1,0); 04243 04244 int c = 0; 04245 for (int y = 0; y < ny; y++) { 04246 for (int x = 0; x < nx; x++, c++) { 04247 #ifdef _WIN32 04248 float r = (float) _hypot(x - nx / 2, y - ny / 2); 04249 #else 04250 float r = (float) hypot(x - nx / 2, y - ny / 2); 04251 #endif 04252 int i = (int) floor(r); 04253 r -= i; 04254 if (i >= 0 && i < nx / 2 - 1) { 04255 rdata[c] -= dist[i] * (1.0f - r) + dist[i + 1] * r; 04256 } 04257 else { 04258 rdata[c] = 0; 04259 } 04260 } 04261 } 04262 04263 image->update(); 04264 }
|
|
Definition at line 161 of file processor.cpp. |