#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 6125 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 6135 of file processor.h.
06136 { 06137 return "Replace a source image with a lumpy S-curve used for alignment testing"; 06138 }
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 6130 of file processor.h.
References NAME.
06131 { 06132 return NAME; 06133 }
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 6145 of file processor.h.
06146 { 06147 TypeDict d; 06148 return d; 06149 }
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 7202 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.
07203 { 07204 preprocess(image); 07205 07206 int dim_size = image->get_ndim(); 07207 if( 2 != dim_size ) { 07208 throw ImageDimensionException("works for 2D images only"); 07209 } 07210 07211 int nx = image->get_xsize(); 07212 int ny = image->get_ysize(); 07213 image->to_zero(); 07214 07215 for (int i=0; i<100; i++) { 07216 int x=static_cast<int>( nx/2+nx/6.0*sin(i*2.0*3.14159/100.0) ); 07217 int y=ny/4+i*ny/200; 07218 for (int xx=x-nx/10; xx<x+nx/10; xx++) { 07219 for (int yy=y-ny/10; yy<y+ny/10; yy++) { 07220 #ifdef _WIN32 07221 (*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); 07222 #else 07223 (*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); 07224 #endif 07225 } 07226 } 07227 } 07228 07229 image->update(); 07230 }
const string TestImageScurve::NAME = "testimage.scurve" [static] |