#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 4468 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 4483 of file processor.h.
|
|
Get the processor's name. Each processor is identified by a unique name.
Implements EMAN::Processor. Definition at line 4473 of file processor.h. References NAME. 04474 { 04475 return NAME; 04476 }
|
|
Definition at line 4478 of file processor.h. 04479 { 04480 return new RotationalSubstractProcessor(); 04481 }
|
|
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 4282 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. 04283 { 04284 if (!image || image->is_complex()) { 04285 LOGWARN("only works on real image. do nothing."); 04286 return; 04287 } 04288 04289 if (image->get_ndim() != 2) throw ImageDimensionException("This processor works only for 2D images"); 04290 04291 float *rdata = image->get_data(); 04292 int nx = image->get_xsize(); 04293 int ny = image->get_ysize(); 04294 04295 vector < float >dist = image->calc_radial_dist(nx / 2, 0, 1,0); 04296 04297 int c = 0; 04298 for (int y = 0; y < ny; y++) { 04299 for (int x = 0; x < nx; x++, c++) { 04300 #ifdef _WIN32 04301 float r = (float) _hypot(x - nx / 2, y - ny / 2); 04302 #else 04303 float r = (float) hypot(x - nx / 2, y - ny / 2); 04304 #endif 04305 int i = (int) floor(r); 04306 r -= i; 04307 if (i >= 0 && i < nx / 2 - 1) { 04308 rdata[c] -= dist[i] * (1.0f - r) + dist[i + 1] * r; 04309 } 04310 else { 04311 rdata[c] = 0; 04312 } 04313 } 04314 } 04315 04316 image->update(); 04317 }
|
|
Definition at line 4488 of file processor.h. Referenced by get_name(). |