#include <processor.h>
Inheritance diagram for EMAN::AmpweightFourierProcessor:
Public Member Functions | |
string | get_name () const |
Get the processor's name. | |
void | process_inplace (EMData *image) |
To process an image in-place. | |
void | set_params (const Dict &new_params) |
Set the processor parameters using a key/value dictionary. | |
TypeDict | get_param_types () const |
Get processor parameter information in a dictionary. | |
string | get_desc () const |
Get the descrition of this specific processor. | |
Static Public Member Functions | |
Processor * | NEW () |
Static Public Attributes | |
const string | NAME = "filter.ampweight" |
Protected Attributes | |
EMData * | sum |
int | dosqrt |
sum | Adds the weights to sum for normalization | |
sqrt | Weights using sqrt of the amplitude if set |
Definition at line 468 of file processor.h.
|
Get the descrition of this specific processor. This function must be overwritten by a subclass.
Implements EMAN::Processor. Definition at line 499 of file processor.h. 00500 { 00501 return "Multiplies each Fourier pixel by its amplitude"; 00502 }
|
|
Get the processor's name. Each processor is identified by a unique name.
Implements EMAN::Processor. Definition at line 471 of file processor.h. 00472 {
00473 return NAME;
00474 }
|
|
Get processor parameter information in a dictionary. Each parameter has one record in the dictionary. Each record contains its name, data-type, and description.
Reimplemented from EMAN::Processor. Definition at line 486 of file processor.h. References EMAN::TypeDict::put(). 00487 { 00488 TypeDict d; 00489 d.put("sum", EMObject::EMDATA, "Adds the weights to sum for normalization"); 00490 d.put("sqrt", EMObject::INT, "Weights using sqrt of the amplitude if set"); 00491 return d; 00492 }
|
|
Definition at line 494 of file processor.h. 00495 { 00496 return new AmpweightFourierProcessor(); 00497 }
|
|
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.
Implements EMAN::Processor. Definition at line 718 of file processor.cpp. References EMAN::EMData::do_fft(), EMAN::EMData::do_ift(), EMAN::EMData::get_data(), EMAN::EMData::get_xsize(), EMAN::EMData::get_ysize(), EMAN::EMData::get_zsize(), EMAN::EMData::is_complex(), LOGWARN, sum, and EMAN::EMData::update(). 00719 { 00720 EMData *fft; 00721 float *fftd; 00722 int f=0; 00723 // static float sum1=0,sum1a=0; 00724 // static double sum2=0,sum2a=0; 00725 00726 if (!image) { 00727 LOGWARN("NULL Image"); 00728 return; 00729 } 00730 00731 if (!image->is_complex()) { 00732 fft = image->do_fft(); 00733 fftd = fft->get_data(); 00734 f=1; 00735 } 00736 else { 00737 fft=image; 00738 fftd=image->get_data(); 00739 } 00740 float *sumd = NULL; 00741 if (sum) sumd=sum->get_data(); 00742 //printf("%d %d %d %d\n",fft->get_xsize(),fft->get_ysize(),sum->get_xsize(),sum->get_ysize()); 00743 size_t n = (size_t)fft->get_xsize()*fft->get_ysize()*fft->get_zsize(); 00744 for (size_t i=0; i<n; i+=2) { 00745 float c; 00746 if (dosqrt) c=pow(fftd[i]*fftd[i]+fftd[i+1]*fftd[i+1],0.25f); 00747 #ifdef _WIN32 00748 else c = static_cast<float>(_hypot(fftd[i],fftd[i+1])); 00749 #else 00750 else c = static_cast<float>(hypot(fftd[i],fftd[i+1])); 00751 #endif //_WIN32 00752 if (c==0) c=1.0e-30f; // prevents divide by zero in normalization 00753 fftd[i]*=c; 00754 fftd[i+1]*=c; 00755 if (sumd) { sumd[i]+=c; sumd[i+1]+=0; } 00756 00757 // debugging 00758 /* if (i==290*1+12) { 00759 sum1+=fftd[i]; 00760 sum2+=fftd[i]; 00761 printf("%f\t%f\t%f\t%f\t%f\t%f\n",sum1,sum2,fftd[i],fftd[i+1],sumd[i],c); 00762 } 00763 if (i==290*50+60) { 00764 sum1a+=fftd[i]; 00765 sum2a+=fftd[i]; 00766 printf("%f\t%f\t%f\t%f\t%f\t%f\n",sum1a,sum2a,fftd[i],fftd[i+1],sumd[i],c); 00767 }*/ 00768 } 00769 00770 if (f) { 00771 fft->update(); 00772 EMData *ift=fft->do_ift(); 00773 memcpy(image->get_data(),ift->get_data(),n*sizeof(float)); 00774 delete fft; 00775 delete ift; 00776 } 00777 00778 sum->update(); 00779 image->update(); 00780 00781 }
|
|
Set the processor parameters using a key/value dictionary.
Reimplemented from EMAN::Processor. Definition at line 478 of file processor.h. 00479 { 00480 params = new_params; 00481 sum = params["sum"]; 00482 dosqrt = params["sqrt"]; 00483 // printf("%s %f\n",params.keys()[0].c_str(),lowpass); 00484 }
|
|
Definition at line 508 of file processor.h. |
|
Definition at line 61 of file processor.cpp. |
|
Definition at line 507 of file processor.h. Referenced by process_inplace(). |