#include <processor.h>
Inheritance diagram for EMAN::TestImageScurve:
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. | |
virtual TypeDict | get_param_types () const |
Get processor parameter information in a dictionary. | |
Static Public Member Functions | |
static Processor * | NEW () |
Static Public Attributes | |
static const string | NAME = "testimage.scurve" |
Definition at line 6156 of file processor.h.
virtual string EMAN::TestImageScurve::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 6166 of file processor.h.
06167 { 06168 return "Replace a source image with a lumpy S-curve used for alignment testing"; 06169 }
virtual string EMAN::TestImageScurve::get_name | ( | ) | const [inline, virtual] |
Get the processor's name.
Each processor is identified by a unique name.
Implements EMAN::Processor.
Definition at line 6161 of file processor.h.
References NAME.
06162 { 06163 return NAME; 06164 }
virtual TypeDict EMAN::TestImageScurve::get_param_types | ( | ) | const [inline, virtual] |
Get processor parameter information in a dictionary.
Each parameter has one record in the dictionary. Each record contains its name, data-type, and description.
Reimplemented from EMAN::Processor.
Definition at line 6176 of file processor.h.
06177 { 06178 TypeDict d; 06179 return d; 06180 }
static Processor* EMAN::TestImageScurve::NEW | ( | ) | [inline, static] |
void TestImageScurve::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 7288 of file processor.cpp.
References EMAN::EMData::get_ndim(), EMAN::EMData::get_xsize(), EMAN::EMData::get_ysize(), ImageDimensionException, EMAN::TestImageProcessor::preprocess(), EMAN::EMData::to_zero(), EMAN::EMData::update(), and x.
07289 { 07290 preprocess(image); 07291 07292 int dim_size = image->get_ndim(); 07293 if( 2 != dim_size ) { 07294 throw ImageDimensionException("works for 2D images only"); 07295 } 07296 07297 int nx = image->get_xsize(); 07298 int ny = image->get_ysize(); 07299 image->to_zero(); 07300 07301 for (int i=0; i<100; i++) { 07302 int x=static_cast<int>( nx/2+nx/6.0*sin(i*2.0*3.14159/100.0) ); 07303 int y=ny/4+i*ny/200; 07304 for (int xx=x-nx/10; xx<x+nx/10; xx++) { 07305 for (int yy=y-ny/10; yy<y+ny/10; yy++) { 07306 #ifdef _WIN32 07307 (*image)(xx,yy)+=exp(-pow(static_cast<float>(_hypot(xx-x,yy-y))*30.0f/nx,2.0f))*(sin(static_cast<float>((xx-x)*(yy-y)))+.5f); 07308 #else 07309 (*image)(xx,yy)+=exp(-pow(static_cast<float>(hypot(xx-x,yy-y))*30.0f/nx,2.0f))*(sin(static_cast<float>((xx-x)*(yy-y)))+.5f); 07310 #endif 07311 } 07312 } 07313 } 07314 07315 image->update(); 07316 }
const string TestImageScurve::NAME = "testimage.scurve" [static] |