EMAN::TestImageScurve Class Reference

Replace a source image with a lumpy S-curve used for alignment testing. More...

#include <processor.h>

Inheritance diagram for EMAN::TestImageScurve:

Inheritance graph
[legend]
Collaboration diagram for EMAN::TestImageScurve:

Collaboration graph
[legend]

List of all members.

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 ProcessorNEW ()


Detailed Description

Replace a source image with a lumpy S-curve used for alignment testing.

Definition at line 5747 of file processor.h.


Member Function Documentation

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.

Parameters:
image The image to be processed.

Implements EMAN::Processor.

Definition at line 6690 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.

06691 {
06692         preprocess(image);
06693 
06694         int dim_size = image->get_ndim();
06695         if( 2 != dim_size ) {
06696                 throw ImageDimensionException("works for 2D images only");
06697         }
06698 
06699         int nx = image->get_xsize();
06700         int ny = image->get_ysize();
06701         image->to_zero();
06702 
06703         for (int i=0; i<100; i++) {
06704                 int x=static_cast<int>( nx/2+nx/6.0*sin(i*2.0*3.14159/100.0) );
06705                 int y=ny/4+i*ny/200;
06706                 for (int xx=x-nx/10; xx<x+nx/10; xx++) {
06707                         for (int yy=y-ny/10; yy<y+ny/10; yy++) {
06708 #ifdef  _WIN32
06709                                 (*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);
06710 #else
06711                                 (*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);
06712 #endif
06713                         }
06714                 }
06715         }
06716 
06717         image->update();
06718 }

virtual string EMAN::TestImageScurve::get_name (  )  const [inline, virtual]

Get the processor's name.

Each processor is identified by a unique name.

Returns:
The processor's name.

Implements EMAN::Processor.

Definition at line 5752 of file processor.h.

05753                 {
05754                         return "testimage.scurve";
05755                 }

virtual string EMAN::TestImageScurve::get_desc (  )  const [inline, virtual]

Get the descrition of this specific processor.

This function must be overwritten by a subclass.

Returns:
The description of this processor.

Implements EMAN::Processor.

Definition at line 5757 of file processor.h.

05758                 {
05759                         return "Replace a source image with a lumpy S-curve used for alignment testing";
05760                 }

static Processor* EMAN::TestImageScurve::NEW (  )  [inline, static]

Definition at line 5762 of file processor.h.

05763                 {
05764                         return new TestImageScurve();
05765                 }

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.

Returns:
A dictionary containing the parameter info.

Reimplemented from EMAN::Processor.

Definition at line 5767 of file processor.h.

05768                 {
05769                         TypeDict d;
05770                         return d;
05771                 }


The documentation for this class was generated from the following files:

Generated on Sat Nov 21 02:20:38 2009 for EMAN2 by  doxygen 1.5.6