#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 | |
static Processor * | NEW () |
Static Public Attributes | |
static const string | NAME = "math.rotationalsubtract" |
Definition at line 4507 of file processor.h.
virtual string EMAN::RotationalSubstractProcessor::get_desc | ( | ) | const [inline, virtual] |
Get the descrition of this specific processor.
This function must be overwritten by a subclass.
Implements EMAN::Processor.
Definition at line 4522 of file processor.h.
virtual string EMAN::RotationalSubstractProcessor::get_name | ( | ) | const [inline, virtual] |
Get the processor's name.
Each processor is identified by a unique name.
Implements EMAN::Processor.
Definition at line 4512 of file processor.h.
References NAME.
04513 { 04514 return NAME; 04515 }
static Processor* EMAN::RotationalSubstractProcessor::NEW | ( | ) | [inline, static] |
Definition at line 4517 of file processor.h.
04518 { 04519 return new RotationalSubstractProcessor(); 04520 }
void RotationalSubstractProcessor::process_inplace | ( | EMData * | image | ) | [virtual] |
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.
image | The image to be processed. |
Implements EMAN::Processor.
Definition at line 4320 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, rdata, EMAN::EMData::update(), and x.
04321 { 04322 if (!image || image->is_complex()) { 04323 LOGWARN("only works on real image. do nothing."); 04324 return; 04325 } 04326 04327 if (image->get_ndim() != 2) throw ImageDimensionException("This processor works only for 2D images"); 04328 04329 float *rdata = image->get_data(); 04330 int nx = image->get_xsize(); 04331 int ny = image->get_ysize(); 04332 04333 vector < float >dist = image->calc_radial_dist(nx / 2, 0, 1,0); 04334 04335 int c = 0; 04336 for (int y = 0; y < ny; y++) { 04337 for (int x = 0; x < nx; x++, c++) { 04338 #ifdef _WIN32 04339 float r = (float) _hypot(x - nx / 2, y - ny / 2); 04340 #else 04341 float r = (float) hypot(x - nx / 2, y - ny / 2); 04342 #endif 04343 int i = (int) floor(r); 04344 r -= i; 04345 if (i >= 0 && i < nx / 2 - 1) { 04346 rdata[c] -= dist[i] * (1.0f - r) + dist[i + 1] * r; 04347 } 04348 else { 04349 rdata[c] = 0; 04350 } 04351 } 04352 } 04353 04354 image->update(); 04355 }
const string RotationalSubstractProcessor::NAME = "math.rotationalsubtract" [static] |