#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 4427 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 4442 of file processor.h. 04443 { 04444 return "subtracts circularly/spherically symmetric part of an image."; 04445 }
|
|
Get the processor's name. Each processor is identified by a unique name.
Implements EMAN::Processor. Definition at line 4432 of file processor.h. 04433 {
04434 return NAME;
04435 }
|
|
Definition at line 4437 of file processor.h. 04438 { 04439 return new RotationalSubstractProcessor(); 04440 }
|
|
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 4144 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. 04145 { 04146 if (!image || image->is_complex()) { 04147 LOGWARN("only works on real image. do nothing."); 04148 return; 04149 } 04150 04151 if (image->get_ndim() != 2) throw ImageDimensionException("This processor works only for 2D images"); 04152 04153 float *rdata = image->get_data(); 04154 int nx = image->get_xsize(); 04155 int ny = image->get_ysize(); 04156 04157 vector < float >dist = image->calc_radial_dist(nx / 2, 0, 1,0); 04158 04159 int c = 0; 04160 for (int y = 0; y < ny; y++) { 04161 for (int x = 0; x < nx; x++, c++) { 04162 #ifdef _WIN32 04163 float r = (float) _hypot(x - nx / 2, y - ny / 2); 04164 #else 04165 float r = (float) hypot(x - nx / 2, y - ny / 2); 04166 #endif 04167 int i = (int) floor(r); 04168 r -= i; 04169 if (i >= 0 && i < nx / 2 - 1) { 04170 rdata[c] -= dist[i] * (1.0f - r) + dist[i + 1] * r; 04171 } 04172 else { 04173 rdata[c] = 0; 04174 } 04175 } 04176 } 04177 04178 image->update(); 04179 }
|
|
Definition at line 155 of file processor.cpp. |