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

Lowpass Phase Randomization processor applied in Fourier space. More...

#include <processor.h>

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

Public Member Functions

string get_name () const
 Get the processor's name. More...
 
string get_desc () const
 Get the descrition of this specific processor. More...
 
void process_inplace (EMData *image)
 To process an image in-place. More...
 
void create_radial_func (vector< float > &radial_mask) const
 
- Public Member Functions inherited from EMAN::FourierProcessor
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::FourierProcessor
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 = "filter.lowpass.randomphase"
 

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::FourierProcessor
virtual void preprocess (EMData *image)
 
- Protected Attributes inherited from EMAN::Processor
Dict params
 

Detailed Description

Lowpass Phase Randomization processor applied in Fourier space.

Definition at line 1924 of file processor.h.

Member Function Documentation

◆ create_radial_func()

void LowpassRandomPhaseProcessor::create_radial_func ( vector< float > &  radial_mask) const
virtual

Implements EMAN::FourierProcessor.

Definition at line 2059 of file processor.cpp.

2059{ };

◆ get_desc()

string EMAN::LowpassRandomPhaseProcessor::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 1930 of file processor.h.

1931 {
1932 return "Above the cutoff frequency, phases will be completely randomized, but amplitudes will be unchanged. Used for testing for noise bias. If you can reconstruct information that isn't there, then you have noise bias problems.";
1933 }

◆ get_name()

string EMAN::LowpassRandomPhaseProcessor::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 1927 of file processor.h.

1928 { return NAME; }

References NAME.

◆ NEW()

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

Definition at line 1929 of file processor.h.

1929{ return new LowpassRandomPhaseProcessor(); }
Lowpass Phase Randomization processor applied in Fourier space.
Definition: processor.h:1925

◆ process_inplace()

void LowpassRandomPhaseProcessor::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.

Reimplemented from EMAN::FourierProcessor.

Definition at line 2061 of file processor.cpp.

2062{
2063 float cutoff=0;
2064 preprocess(image);
2065 if( params.has_key("cutoff_abs") ) {
2066 cutoff=(float)params["cutoff_abs"];
2067 }
2068 else {
2069 printf("A cutoff_* parameter is required by filter.lowpass.randomphase\n");
2070 return;
2071 }
2072
2073
2074 if (image->get_zsize()==1) {
2075 int flag=0;
2076 if (!image->is_complex()) { image->do_fft_inplace(); flag=1; }
2077 image->ri2ap();
2078 int nx=image->get_xsize();
2079 int ny=image->get_ysize();
2080
2081 int z=0;
2082 float *data=image->get_data();
2083 for (int y=-ny/2; y<ny/2; y++) {
2084 for (int x=0; x<nx/2+1; x++) {
2085 if (hypot(x/float(nx),y/float(ny))>=cutoff) {
2086 size_t idx=image->get_complex_index_fast(x,y,z); // location of the amplitude
2087 data[idx+1]=Util::get_frand(0.0f,(float)(M_PI*2.0));
2088 }
2089 }
2090 }
2091
2092 image->ap2ri();
2093
2094 if (flag) {
2095 image->do_ift_inplace();
2096 image->depad();
2097 }
2098 }
2099 else { // 3D
2100 int flag=0;
2101 if (!image->is_complex()) { image->do_fft_inplace(); flag=1; }
2102 image->ri2ap();
2103 int nx=image->get_xsize();
2104 int ny=image->get_ysize();
2105 int nz=image->get_zsize();
2106
2107 float *data=image->get_data();
2108 for (int z=-nz/2; z<nz/2; z++) {
2109 for (int y=-ny/2; y<ny/2; y++) {
2110 for (int x=0; x<nx/2; x++) {
2111 if (Util::hypot3(x/float(nx),y/float(ny),z/float(nz))>=cutoff) {
2112 size_t idx=image->get_complex_index_fast(x,y,z); // location of the amplitude
2113 data[idx+1]=Util::get_frand(0.0f,(float)(M_PI*2.0));
2114 }
2115 }
2116 }
2117 }
2118 image->ap2ri();
2119
2120 if (flag) {
2121 image->do_ift_inplace();
2122 image->depad();
2123 }
2124 }
2125}
bool has_key(const string &key) const
Ask the Dictionary if it as a particular key.
Definition: emobject.h:511
virtual void preprocess(EMData *image)
Definition: processor.h:354
static float get_frand(int low, int high)
Get a float random number between low and high, [low, high)
Definition: util.cpp:725
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
#define y(i, j)
Definition: projector.cpp:1516
#define x(i)
Definition: projector.cpp:1517

References EMAN::Util::get_frand(), EMAN::Dict::has_key(), EMAN::Util::hypot3(), EMAN::Processor::params, EMAN::FourierProcessor::preprocess(), x, and y.

Member Data Documentation

◆ NAME

const string LowpassRandomPhaseProcessor::NAME = "filter.lowpass.randomphase"
static

Definition at line 1937 of file processor.h.

Referenced by get_name().


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