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

Replace a source image with a Gaussian band in Fourier space with a given center and width. More...

#include <processor.h>

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

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 with a Gaussian band in Fourier space with a given center and width.

Parameters
centercenter of the Fourier band in pixels
width1/e half-width for the Gaussian band

Definition at line 8146 of file processor.h.

Member Function Documentation

◆ get_desc()

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

8157 {
8158 return "Replace a source image with a single radial Fourier band with a (truncated) Gaussian profile. f(s)=exp(-(s-c/w)^2). width=sqrt(2) is the minimum width to produce a flat sum with a spacing of 1 pixel.";
8159 }

◆ get_name()

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

8152 {
8153 return NAME;
8154 }

References NAME.

◆ get_param_types()

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

8167 {
8168 TypeDict d;
8169 d.put("center", EMObject::FLOAT, "center of the band in Fourier pixels. required");
8170 d.put("width", EMObject::FLOAT, "1/2e width of Gaussian in Fourier pixels. default = sqrt(2)");
8171 return d;
8172 }
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::TestImageFourierGaussianBand::NEW ( )
inlinestatic

Definition at line 8161 of file processor.h.

8162 {
8163 return new TestImageFourierGaussianBand();
8164 }
Replace a source image with a Gaussian band in Fourier space with a given center and width.
Definition: processor.h:8147

◆ process_inplace()

void TestImageFourierGaussianBand::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 8935 of file processor.cpp.

8936{
8937 if (!image->is_complex()) {
8938 int nx = image->get_xsize();
8939 int offset = 2 - nx%2;
8940
8941 image->set_size(nx+offset,image->get_ysize(),image->get_zsize());
8942 image->set_complex(true);
8943 if (1 == offset) image->set_fftodd(true);
8944 else image->set_fftodd(false);
8945 image->set_fftpad(true);
8946 }
8947 image->set_ri(true);
8948 image->to_zero();
8949
8950 float center = params.set_default("center",ny/4);
8951 float width = params.set_default("width",sqrt(2.0f));
8952
8953 int nx = image->get_xsize();
8954 int ny = image->get_ysize();
8955 int nz = image->get_zsize();
8956 int w3 = floor(width*3);
8957 float l0 = pow(center-w3,2.0f);
8958 float l1 = pow(center+w3,2.0f);
8959
8960 if (nz==1) {
8961 // 1D
8962 if (ny==1) {
8963 for (int x=0; x<nx/2; x++) {
8964 if (abs(x-center)>w3) continue;
8965 image->set_complex_at(x,0,exp(-pow((x-center)/width,2.0f)));
8966 }
8967 }
8968 // 2D
8969 else {
8970 for (int y=-ny/2; y<ny/2; y++) {
8971 for (int x=0; x<nx/2; x++) {
8972 float r=Util::hypot_fast(x,y);
8973 if (r<center-w3 || r>center+w3) continue;
8974 image->set_complex_at(x,y,exp(-pow((r-center)/width,2.0f)));
8975 }
8976 }
8977 }
8978 }
8979 else {
8980 // 3D
8981 for (int z=-nz/2; z<nz/2; z++) {
8982 for (int y=-ny/2; y<ny/2; y++) {
8983 for (int x=0; x<nx/2; x++) {
8984 float r=Util::hypot3(x,y,z);
8985 if (r<center-w3 || r>center+w3) continue;
8986 image->set_complex_at(x,y,z,exp(-pow((r-center)/width,2.0f)));
8987 }
8988 }
8989 }
8990 }
8991}
type set_default(const string &key, type val)
Default setting behavior This can be achieved using a template - d.woolford Jan 2008 (before there wa...
Definition: emobject.h:569
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
static float hypot_fast(int x, int y)
Euclidean distance in 2D for integers computed fast using a cached lookup table.
Definition: util.cpp:742
EMData * sqrt() const
return square root of current image
#define y(i, j)
Definition: projector.cpp:1516
#define x(i)
Definition: projector.cpp:1517

References EMAN::Util::hypot3(), EMAN::Util::hypot_fast(), EMAN::TestImageProcessor::nx, EMAN::TestImageProcessor::ny, EMAN::TestImageProcessor::nz, EMAN::Processor::params, EMAN::Dict::set_default(), sqrt(), x, and y.

Member Data Documentation

◆ NAME

const string TestImageFourierGaussianBand::NAME = "testimage.fourier.gaussianband"
static

Definition at line 8174 of file processor.h.

Referenced by get_name().


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