#include <processor.h>
Inheritance diagram for EMAN::LowpassRandomPhaseProcessor:
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 Processor * | NEW () |
Static Public Attributes | |
static const string | NAME = "filter.lowpass.randomphase" |
Definition at line 914 of file processor.h.
void LowpassRandomPhaseProcessor::create_radial_func | ( | vector< float > & | radial_mask | ) | const [virtual] |
string EMAN::LowpassRandomPhaseProcessor::get_desc | ( | ) | const [inline, virtual] |
Get the descrition of this specific processor.
This function must be overwritten by a subclass.
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.
Implements EMAN::Processor.
Definition at line 917 of file processor.h.
References NAME.
00918 { return NAME; }
static Processor* EMAN::LowpassRandomPhaseProcessor::NEW | ( | ) | [inline, static] |
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.
image | The image to be processed. |
Reimplemented from EMAN::FourierProcessor.
Definition at line 1152 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.
01153 { 01154 float cutoff=0; 01155 preprocess(image); 01156 if( params.has_key("cutoff_abs") ) { 01157 cutoff=(float)params["cutoff_abs"]; 01158 } 01159 else { 01160 printf("A cutoff_* parameter is required by filter.lowpass.randomphase\n"); 01161 return; 01162 } 01163 01164 01165 if (image->get_zsize()==1) { 01166 int flag=0; 01167 if (!image->is_complex()) { image->do_fft_inplace(); flag=1; } 01168 image->ri2ap(); 01169 int nx=image->get_xsize(); 01170 int ny=image->get_ysize(); 01171 01172 int z=0; 01173 float *data=image->get_data(); 01174 for (int y=-ny/2; y<ny/2; y++) { 01175 for (int x=0; x<nx/2+1; x++) { 01176 if (hypot(x/float(nx),y/float(ny))>=cutoff) { 01177 size_t idx=image->get_complex_index_fast(x,y,z); // location of the amplitude 01178 data[idx+1]=Util::get_frand(0.0f,(float)(M_PI*2.0)); 01179 } 01180 } 01181 } 01182 01183 image->ap2ri(); 01184 01185 if (flag) { 01186 image->do_ift_inplace(); 01187 image->depad(); 01188 } 01189 } 01190 else { // 3D 01191 int flag=0; 01192 if (!image->is_complex()) { image->do_fft_inplace(); flag=1; } 01193 image->ri2ap(); 01194 int nx=image->get_xsize(); 01195 int ny=image->get_ysize(); 01196 int nz=image->get_zsize(); 01197 01198 float *data=image->get_data(); 01199 for (int z=-nz/2; z<nz/2; z++) { 01200 for (int y=-ny/2; y<ny/2; y++) { 01201 for (int x=0; x<nx/2+1; x++) { 01202 if (Util::hypot3(x/float(nx),y/float(ny),z/float(nz))>=cutoff) { 01203 size_t idx=image->get_complex_index_fast(x,y,z); // location of the amplitude 01204 data[idx+1]=Util::get_frand(0.0f,(float)(M_PI*2.0)); 01205 } 01206 } 01207 } 01208 } 01209 image->ap2ri(); 01210 01211 if (flag) { 01212 image->do_ift_inplace(); 01213 image->depad(); 01214 } 01215 } 01216 }
const string LowpassRandomPhaseProcessor::NAME = "filter.lowpass.randomphase" [static] |