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