Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File 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]
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

ProcessorNEW ()

Static Public Attributes

const string NAME = "filter.lowpass.randomphase"

Detailed Description

Lowpass Phase Randomization processor applied in Fourier space.

Definition at line 914 of file processor.h.


Member Function Documentation

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

Implements EMAN::FourierProcessor.

Definition at line 1152 of file processor.cpp.

01152 { };

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

00921                 {
00922                         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.";
00923                 }

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

00918                 { return NAME; }

Processor* EMAN::LowpassRandomPhaseProcessor::NEW  )  [inline, static]
 

Definition at line 919 of file processor.h.

00919 { 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:
image The image to be processed.

Reimplemented from EMAN::FourierProcessor.

Definition at line 1154 of file processor.cpp.

References EMAN::EMData::ap2ri(), data, EMAN::EMData::depad(), EMAN::EMData::do_fft_inplace(), EMAN::EMData::do_ift_inplace(), flag, 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::FourierProcessor::preprocess(), EMAN::EMData::ri2ap(), x, and y.

01155 {
01156         float cutoff=0;
01157         preprocess(image);
01158         if( params.has_key("cutoff_abs") ) {
01159                 cutoff=(float)params["cutoff_abs"];
01160         }
01161         else {
01162                 printf("A cutoff_* parameter is required by filter.lowpass.randomphase\n");
01163                 return;
01164         }
01165         
01166         
01167         if (image->get_zsize()==1) {
01168                 int flag=0;
01169                 if (!image->is_complex()) { image->do_fft_inplace(); flag=1; }
01170                 image->ri2ap();
01171                 int nx=image->get_xsize();
01172                 int ny=image->get_ysize();
01173                 
01174                 int z=0;
01175                 float *data=image->get_data();
01176                 for (int y=-ny/2; y<ny/2; y++) {
01177                         for (int x=0; x<nx/2+1; x++) {
01178                                 if (hypot(x/float(nx),y/float(ny))>=cutoff) {
01179                                         size_t idx=image->get_complex_index_fast(x,y,z);                // location of the amplitude
01180                                         data[idx+1]=Util::get_frand(0.0f,(float)(M_PI*2.0));
01181                                 }
01182                         }
01183                 }
01184 
01185                 image->ap2ri();
01186 
01187                 if (flag) {
01188                         image->do_ift_inplace();
01189                         image->depad();
01190                 }
01191         }
01192         else {          // 3D
01193                 int flag=0;
01194                 if (!image->is_complex()) { image->do_fft_inplace(); flag=1; }
01195                 image->ri2ap();
01196                 int nx=image->get_xsize();
01197                 int ny=image->get_ysize();
01198                 int nz=image->get_zsize();
01199                 
01200                 float *data=image->get_data();
01201                 for (int z=-nz/2; z<nz/2; z++) {
01202                         for (int y=-ny/2; y<ny/2; y++) {
01203                                 for (int x=0; x<nx/2+1; x++) {
01204                                         if (Util::hypot3(x/float(nx),y/float(ny),z/float(nz))>=cutoff) {
01205                                                 size_t idx=image->get_complex_index_fast(x,y,z);                // location of the amplitude
01206                                                 data[idx+1]=Util::get_frand(0.0f,(float)(M_PI*2.0));
01207                                         }
01208                                 }
01209                         }
01210                 }
01211                 image->ap2ri();
01212 
01213                 if (flag) {
01214                         image->do_ift_inplace();
01215                         image->depad();
01216                 }
01217         }
01218 }


Member Data Documentation

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

Definition at line 236 of file processor.cpp.


The documentation for this class was generated from the following files:
Generated on Tue Jun 11 13:48:21 2013 for EMAN2 by  doxygen 1.3.9.1