EMAN2
Public Member Functions | Static Public Member Functions | Static Public Attributes | List of all members
EMAN::TestImageSinewaveCircular Class Reference

Replace a source image as a circular sine wave in specified wave length. More...

#include <processor.h>

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

Public Member Functions

virtual void process_inplace (EMData *image)
 To process an image in-place. More...
 
virtual string get_name () const
 Get the processor's name. More...
 
virtual string get_desc () const
 Get the descrition of this specific processor. More...
 
virtual TypeDict get_param_types () const
 Get processor parameter information in a dictionary. More...
 
- Public Member Functions inherited from EMAN::Processor
virtual ~Processor ()
 
virtual EMDataprocess (const EMData *const image)
 To proccess an image out-of-place. More...
 
virtual void process_list_inplace (vector< EMData * > &images)
 To process multiple images using the same algorithm. More...
 
virtual Dict get_params () const
 Get the processor parameters in a key/value dictionary. More...
 
virtual void set_params (const Dict &new_params)
 Set the processor parameters using a key/value dictionary. More...
 

Static Public Member Functions

static ProcessorNEW ()
 
- Static Public Member Functions inherited from EMAN::TestImageProcessor
static string get_group_desc ()
 
- Static Public Member Functions inherited from EMAN::Processor
static string get_group_desc ()
 Get the description of this group of processors. More...
 
static void EMFourierFilterInPlace (EMData *fimage, Dict params)
 Compute a Fourier-filter processed image in place. More...
 
static EMDataEMFourierFilter (EMData *fimage, Dict params)
 Compute a Fourier-processor processed image without altering the original image. More...
 

Static Public Attributes

static const string NAME = "testimage.sinewave.circular"
 

Additional Inherited Members

- Public Types inherited from EMAN::Processor
enum  fourier_filter_types {
  TOP_HAT_LOW_PASS , TOP_HAT_HIGH_PASS , TOP_HAT_BAND_PASS , TOP_HOMOMORPHIC ,
  GAUSS_LOW_PASS , GAUSS_HIGH_PASS , GAUSS_BAND_PASS , GAUSS_INVERSE ,
  GAUSS_HOMOMORPHIC , BUTTERWORTH_LOW_PASS , BUTTERWORTH_HIGH_PASS , BUTTERWORTH_HOMOMORPHIC ,
  KAISER_I0 , KAISER_SINH , KAISER_I0_INVERSE , KAISER_SINH_INVERSE ,
  SHIFT , TANH_LOW_PASS , TANH_HIGH_PASS , TANH_HOMOMORPHIC ,
  TANH_BAND_PASS , RADIAL_TABLE , CTF_
}
 Fourier filter Processor type enum. More...
 
- Protected Member Functions inherited from EMAN::TestImageProcessor
void preprocess (EMData *image)
 
- Protected Attributes inherited from EMAN::TestImageProcessor
int nx
 
int ny
 
int nz
 
- Protected Attributes inherited from EMAN::Processor
Dict params
 

Detailed Description

Replace a source image as a circular sine wave in specified wave length.

Parameters
wavelengthfloat this value is the d in function |sin(x/d)|
axischar (optional) specify a major axis for asymmetric features
cdistance (optional) float between focus and the center of an ellipse
phasedegree (optional) phase for sine wave, default is 0

Definition at line 8565 of file processor.h.

Member Function Documentation

◆ get_desc()

virtual string EMAN::TestImageSinewaveCircular::get_desc ( ) const
inlinevirtual

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 8575 of file processor.h.

8576 {
8577 return "Replace a source image as a circular sine wave in specified wave length";
8578 }

◆ get_name()

virtual string EMAN::TestImageSinewaveCircular::get_name ( ) const
inlinevirtual

Get the processor's name.

Each processor is identified by a unique name.

Returns
The processor's name.

Implements EMAN::Processor.

Definition at line 8570 of file processor.h.

8571 {
8572 return NAME;
8573 }
static const string NAME
Definition: processor.h:8595

References NAME.

◆ get_param_types()

virtual TypeDict EMAN::TestImageSinewaveCircular::get_param_types ( ) const
inlinevirtual

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 8585 of file processor.h.

8586 {
8587 TypeDict d;
8588 d.put("wavelength", EMObject::FLOAT, "(required)this value is the d in function |sin(x/d)|, unit: pixel");
8589 d.put("axis", EMObject::STRING, "specify a major axis for asymmetric features");
8590 d.put("c", EMObject::FLOAT, "distance between focus and the center of an ellipse");
8591 d.put("phase", EMObject::FLOAT, "(optional)phase for sine wave, default is 0");
8592 return d;
8593 }
TypeDict is a dictionary to store <string, EMObject::ObjectType> pair.
Definition: emobject.h:305
void put(const string &key, EMObject::ObjectType o, const string &desc="")
Definition: emobject.h:330

References EMAN::EMObject::FLOAT, EMAN::TypeDict::put(), and EMAN::EMObject::STRING.

◆ NEW()

static Processor * EMAN::TestImageSinewaveCircular::NEW ( )
inlinestatic

Definition at line 8580 of file processor.h.

8581 {
8582 return new TestImageSinewaveCircular();
8583 }
Replace a source image as a circular sine wave in specified wave length.
Definition: processor.h:8566

◆ process_inplace()

void TestImageSinewaveCircular::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
imageThe image to be processed.

Implements EMAN::Processor.

Definition at line 9688 of file processor.cpp.

9689{
9690 preprocess(image);
9691
9692 float wavelength = params["wavelength"];
9693 string axis = (const char*)params["axis"];
9694 float c = params["c"];
9695 float phase = params["phase"];
9696
9697 float *dat = image->get_data();
9698 float r; //this is the distance of pixel from the image center(nx/2, ny/2, nz/2)
9699 float x2, y2, z2; //this is the coordinates of this pixel from image center
9700 for (int k = 0; k < nz; ++k) {
9701 for (int j = 0; j < ny; ++j) {
9702 for (int i = 0; i < nx; ++i, ++dat) {
9703 x2 = (float)( i - nx/2 );
9704 y2 = (float)( j - ny/2 );
9705 z2 = (float)( k - nz/2 );
9706 if(axis == ""){
9707 r = (float)sqrt(x2*x2+y2*y2+z2*z2);
9708 }
9709 else if(axis == "x"){
9710 float lc = -c;
9711 float rc = c;
9712 r = ( (float)sqrt((x2-lc)*(x2-lc)+y2*y2+z2*z2) +
9713 (float)sqrt((x2-rc)*(x2-rc)+y2*y2+z2*z2) ) /2.0f - c;
9714 }
9715 else if(axis == "y"){
9716 float lc = -c;
9717 float rc = c;
9718 r = ( (float)sqrt(x2*x2+(y2-lc)*(y2-lc)+z2*z2) +
9719 (float)sqrt(x2*x2+(y2-rc)*(y2-rc)+z2*z2) ) /2.0f - c;
9720 }
9721 else if(axis == "z"){
9722 if( nz == 1 ){
9723 throw InvalidValueException(0, "This is a 2D image, no asymmetric feature for z axis");
9724 }
9725 float lc = -c;
9726 float rc = c;
9727 r = ( (float)sqrt(x2*x2+y2*y2+(z2-lc)*(z2-lc)) +
9728 (float)sqrt(x2*x2+y2*y2+(z2-rc)*(z2-rc)) ) /2.0f - c;
9729 }
9730 else{
9731 throw InvalidValueException(0, "please specify a valid axis for asymmetric features");
9732 }
9733 *dat = sin( r * (2.0f*M_PI/wavelength) - phase*180/M_PI);
9734 }
9735 }
9736 }
9737
9738 image->update();
9739}
void preprocess(EMData *image)
Definition: processor.cpp:8923
EMData * sqrt() const
return square root of current image
EMData * phase() const
return phase part of a complex image as a real image format
#define InvalidValueException(val, desc)
Definition: exception.h:285

References InvalidValueException, EMAN::TestImageProcessor::nx, EMAN::TestImageProcessor::ny, EMAN::TestImageProcessor::nz, EMAN::Processor::params, phase(), EMAN::TestImageProcessor::preprocess(), and sqrt().

Member Data Documentation

◆ NAME

const string TestImageSinewaveCircular::NAME = "testimage.sinewave.circular"
static

Definition at line 8595 of file processor.h.

Referenced by get_name().


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