#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 4337 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 4352 of file processor.h. 04353 { 04354 return "subtracts circularly/spherically symmetric part of an image."; 04355 }
|
|
Get the processor's name. Each processor is identified by a unique name.
Implements EMAN::Processor. Definition at line 4342 of file processor.h. 04343 {
04344 return NAME;
04345 }
|
|
Definition at line 4347 of file processor.h. 04348 { 04349 return new RotationalSubstractProcessor(); 04350 }
|
|
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 4203 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. 04204 { 04205 if (!image || image->is_complex()) { 04206 LOGWARN("only works on real image. do nothing."); 04207 return; 04208 } 04209 04210 if (image->get_ndim() != 2) throw ImageDimensionException("This processor works only for 2D images"); 04211 04212 float *rdata = image->get_data(); 04213 int nx = image->get_xsize(); 04214 int ny = image->get_ysize(); 04215 04216 vector < float >dist = image->calc_radial_dist(nx / 2, 0, 1,0); 04217 04218 int c = 0; 04219 for (int y = 0; y < ny; y++) { 04220 for (int x = 0; x < nx; x++, c++) { 04221 #ifdef _WIN32 04222 float r = (float) _hypot(x - nx / 2, y - ny / 2); 04223 #else 04224 float r = (float) hypot(x - nx / 2, y - ny / 2); 04225 #endif 04226 int i = (int) floor(r); 04227 r -= i; 04228 if (i >= 0 && i < nx / 2 - 1) { 04229 rdata[c] -= dist[i] * (1.0f - r) + dist[i + 1] * r; 04230 } 04231 else { 04232 rdata[c] = 0; 04233 } 04234 } 04235 } 04236 04237 image->update(); 04238 }
|
|
Definition at line 153 of file processor.cpp. |