EMAN2
Public Member Functions | Static Public Member Functions | Static Public Attributes
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]

List of all members.

Public Member Functions

string get_name () const
 Get the processor's name.
string get_desc () const
 Get the descrition of this specific processor.
void process_inplace (EMData *image)
 To process an image in-place.
void create_radial_func (vector< float > &radial_mask) const

Static Public Member Functions

static ProcessorNEW ()

Static Public Attributes

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

Detailed Description

Lowpass Phase Randomization processor applied in Fourier space.

Definition at line 965 of file processor.h.


Member Function Documentation

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

Implements EMAN::FourierProcessor.

Definition at line 1313 of file processor.cpp.

{ };
string EMAN::LowpassRandomPhaseProcessor::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 971 of file processor.h.

                {
                        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.";
                }
string EMAN::LowpassRandomPhaseProcessor::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 968 of file processor.h.

References NAME.

                { return NAME; }
static Processor* EMAN::LowpassRandomPhaseProcessor::NEW ( ) [inline, static]

Definition at line 970 of file processor.h.

{ return new LowpassRandomPhaseProcessor(); }
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 1315 of file processor.cpp.

References EMAN::EMData::ap2ri(), data, EMAN::EMData::depad(), EMAN::EMData::do_fft_inplace(), EMAN::EMData::do_ift_inplace(), EMAN::EMData::get_complex_index_fast(), EMAN::EMData::get_data(), EMAN::Util::get_frand(), EMAN::EMData::get_xsize(), EMAN::EMData::get_ysize(), EMAN::EMData::get_zsize(), EMAN::Dict::has_key(), EMAN::Util::hypot3(), EMAN::EMData::is_complex(), nx, ny, EMAN::Processor::params, EMAN::FourierProcessor::preprocess(), EMAN::EMData::ri2ap(), x, and y.

{
        float cutoff=0;
        preprocess(image);
        if( params.has_key("cutoff_abs") ) {
                cutoff=(float)params["cutoff_abs"];
        }
        else {
                printf("A cutoff_* parameter is required by filter.lowpass.randomphase\n");
                return;
        }


        if (image->get_zsize()==1) {
                int flag=0;
                if (!image->is_complex()) { image->do_fft_inplace(); flag=1; }
                image->ri2ap();
                int nx=image->get_xsize();
                int ny=image->get_ysize();

                int z=0;
                float *data=image->get_data();
                for (int y=-ny/2; y<ny/2; y++) {
                        for (int x=0; x<nx/2+1; x++) {
                                if (hypot(x/float(nx),y/float(ny))>=cutoff) {
                                        size_t idx=image->get_complex_index_fast(x,y,z);                // location of the amplitude
                                        data[idx+1]=Util::get_frand(0.0f,(float)(M_PI*2.0));
                                }
                        }
                }

                image->ap2ri();

                if (flag) {
                        image->do_ift_inplace();
                        image->depad();
                }
        }
        else {          // 3D
                int flag=0;
                if (!image->is_complex()) { image->do_fft_inplace(); flag=1; }
                image->ri2ap();
                int nx=image->get_xsize();
                int ny=image->get_ysize();
                int nz=image->get_zsize();

                float *data=image->get_data();
                for (int z=-nz/2; z<nz/2; z++) {
                        for (int y=-ny/2; y<ny/2; y++) {
                                for (int x=0; x<nx/2; x++) {
                                        if (Util::hypot3(x/float(nx),y/float(ny),z/float(nz))>=cutoff) {
                                                size_t idx=image->get_complex_index_fast(x,y,z);                // location of the amplitude
                                                data[idx+1]=Util::get_frand(0.0f,(float)(M_PI*2.0));
                                        }
                                }
                        }
                }
                image->ap2ri();

                if (flag) {
                        image->do_ift_inplace();
                        image->depad();
                }
        }
}

Member Data Documentation

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

Definition at line 978 of file processor.h.

Referenced by get_name().


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