#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 443 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 474 of file processor.h. 00475 {
00476 return "Multiplies each Fourier pixel by its amplitude";
00477 }
|
|
|
Get the processor's name. Each processor is identified by a unique name.
Implements EMAN::Processor. Definition at line 446 of file processor.h. 00447 {
00448 return NAME;
00449 }
|
|
|
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 461 of file processor.h. References EMAN::TypeDict::put(). 00462 {
00463 TypeDict d;
00464 d.put("sum", EMObject::EMDATA, "Adds the weights to sum for normalization");
00465 d.put("sqrt", EMObject::INT, "Weights using sqrt of the amplitude if set");
00466 return d;
00467 }
|
|
|
Definition at line 469 of file processor.h. 00470 {
00471 return new AmpweightFourierProcessor();
00472 }
|
|
|
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 711 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(). 00712 {
00713 EMData *fft;
00714 float *fftd;
00715 int f=0;
00716 // static float sum1=0,sum1a=0;
00717 // static double sum2=0,sum2a=0;
00718
00719 if (!image) {
00720 LOGWARN("NULL Image");
00721 return;
00722 }
00723
00724 if (!image->is_complex()) {
00725 fft = image->do_fft();
00726 fftd = fft->get_data();
00727 f=1;
00728 }
00729 else {
00730 fft=image;
00731 fftd=image->get_data();
00732 }
00733 float *sumd = NULL;
00734 if (sum) sumd=sum->get_data();
00735 //printf("%d %d %d %d\n",fft->get_xsize(),fft->get_ysize(),sum->get_xsize(),sum->get_ysize());
00736 size_t n = (size_t)fft->get_xsize()*fft->get_ysize()*fft->get_zsize();
00737 for (size_t i=0; i<n; i+=2) {
00738 float c;
00739 if (dosqrt) c=pow(fftd[i]*fftd[i]+fftd[i+1]*fftd[i+1],0.25f);
00740 #ifdef _WIN32
00741 else c = static_cast<float>(_hypot(fftd[i],fftd[i+1]));
00742 #else
00743 else c = static_cast<float>(hypot(fftd[i],fftd[i+1]));
00744 #endif //_WIN32
00745 if (c==0) c=1.0e-30f; // prevents divide by zero in normalization
00746 fftd[i]*=c;
00747 fftd[i+1]*=c;
00748 if (sumd) { sumd[i]+=c; sumd[i+1]+=0; }
00749
00750 // debugging
00751 /* if (i==290*1+12) {
00752 sum1+=fftd[i];
00753 sum2+=fftd[i];
00754 printf("%f\t%f\t%f\t%f\t%f\t%f\n",sum1,sum2,fftd[i],fftd[i+1],sumd[i],c);
00755 }
00756 if (i==290*50+60) {
00757 sum1a+=fftd[i];
00758 sum2a+=fftd[i];
00759 printf("%f\t%f\t%f\t%f\t%f\t%f\n",sum1a,sum2a,fftd[i],fftd[i+1],sumd[i],c);
00760 }*/
00761 }
00762
00763 if (f) {
00764 fft->update();
00765 EMData *ift=fft->do_ift();
00766 memcpy(image->get_data(),ift->get_data(),n*sizeof(float));
00767 delete fft;
00768 delete ift;
00769 }
00770
00771 sum->update();
00772 image->update();
00773
00774 }
|
|
|
Set the processor parameters using a key/value dictionary.
Reimplemented from EMAN::Processor. Definition at line 453 of file processor.h. 00454 {
00455 params = new_params;
00456 sum = params["sum"];
00457 dosqrt = params["sqrt"];
00458 // printf("%s %f\n",params.keys()[0].c_str(),lowpass);
00459 }
|
|
|
Definition at line 483 of file processor.h. |
|
|
Definition at line 63 of file processor.cpp. |
|
|
Definition at line 482 of file processor.h. Referenced by process_inplace(). |
1.3.9.1