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

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

#include <processor.h>

Inheritance diagram for EMAN::TestImageSphericalWave:
Inheritance graph
[legend]
Collaboration diagram for EMAN::TestImageSphericalWave:
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.sphericalwave"
 

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 sine wave in specified wave length.

Parameters
wavelengthcos(2*pi*r/wavelength+phase)
phasein radians
xcenter of the spherical wave
ycenter of the spherical wave
zcenter of the spherical wave

Definition at line 8480 of file processor.h.

Member Function Documentation

◆ get_desc()

virtual string EMAN::TestImageSphericalWave::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 8490 of file processor.h.

8491 {
8492 return "Replace a source image in 2d or 3d with a spherical wave cos(2*pi*r/wavelength+phase) also 1/r (2d) or 1/r^2 (3d)";
8493 }

◆ get_name()

virtual string EMAN::TestImageSphericalWave::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 8485 of file processor.h.

8486 {
8487 return NAME;
8488 }
static const string NAME
Definition: processor.h:8511

References NAME.

Referenced by process_inplace().

◆ get_param_types()

virtual TypeDict EMAN::TestImageSphericalWave::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 8500 of file processor.h.

8501 {
8502 TypeDict d;
8503 d.put("wavelength", EMObject::FLOAT, "cos(2*pi*r/wavelength+phase)");
8504 d.put("phase", EMObject::FLOAT, "in radians");
8505 d.put("x", EMObject::FLOAT, "center of the spherical wave");
8506 d.put("y", EMObject::FLOAT, "center of the spherical wave");
8507 d.put("z", EMObject::FLOAT, "center of the spherical wave");
8508 return d;
8509 }
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, and EMAN::TypeDict::put().

◆ NEW()

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

Definition at line 8495 of file processor.h.

8496 {
8497 return new TestImageSphericalWave();
8498 }
Replace a source image as a sine wave in specified wave length.
Definition: processor.h:8481

◆ process_inplace()

void TestImageSphericalWave::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 9552 of file processor.cpp.

9553{
9554 preprocess(image);
9555
9556 if(!params.has_key("wavelength")) {
9557 LOGERR("%s wavelength is required parameter", get_name().c_str());
9558 throw InvalidParameterException("wavelength parameter is required.");
9559 }
9560 float wavelength = params["wavelength"];
9561
9562 float phase = 0;
9563 if(params.has_key("phase")) {
9564 phase = params["phase"];
9565 }
9566
9567 float x = (float)(nx/2);
9568 if (params.has_key("x")) x=params["x"];
9569 float y = (float)(ny/2);
9570 if (params.has_key("y")) y=params["y"];
9571 float z = (float)(nz/2);
9572 if (params.has_key("z")) z=params["z"];
9573
9574 int ndim = image->get_ndim();
9575
9576 if(ndim==2) { //2D
9577 for(int j=0; j<ny; ++j) {
9578 for(int i=0; i<nx; ++i) {
9579 float r=hypot(x-(float)i,y-(float)j);
9580 if (r<.5) continue;
9581 image->set_value_at(i,j,cos(2*(float)pi*r/wavelength+phase)/r);
9582 }
9583 }
9584 }
9585 else { //3D
9586 for(int k=0; k<nz; ++k) {
9587 for(int j=0; j<ny; ++j) {
9588 for(int i=0; i<nx; ++i) {
9589 float r=Util::hypot3(x-(float)i,y-(float)j,z-(float)k);
9590 if (r<.5) continue;
9591 image->set_value_at(i,j,k,cos(2*(float)pi*r/wavelength+phase)/(r*r));
9592 }
9593 }
9594 }
9595 }
9596
9597 image->update();
9598}
bool has_key(const string &key) const
Ask the Dictionary if it as a particular key.
Definition: emobject.h:511
void preprocess(EMData *image)
Definition: processor.cpp:8923
virtual string get_name() const
Get the processor's name.
Definition: processor.h:8485
static float hypot3(int x, int y, int z)
Euclidean distance function in 3D: f(x,y,z) = sqrt(x*x + y*y + z*z);.
Definition: util.h:827
EMData * phase() const
return phase part of a complex image as a real image format
#define InvalidParameterException(desc)
Definition: exception.h:361
#define LOGERR
Definition: log.h:51
#define y(i, j)
Definition: projector.cpp:1516
#define x(i)
Definition: projector.cpp:1517

References get_name(), EMAN::Dict::has_key(), EMAN::Util::hypot3(), InvalidParameterException, LOGERR, EMAN::TestImageProcessor::nx, EMAN::TestImageProcessor::ny, EMAN::TestImageProcessor::nz, EMAN::Processor::params, phase(), EMAN::TestImageProcessor::preprocess(), x, and y.

Member Data Documentation

◆ NAME

const string TestImageSphericalWave::NAME = "testimage.sphericalwave"
static

Definition at line 8511 of file processor.h.

Referenced by get_name().


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