EMAN2
processor_sparx.h
Go to the documentation of this file.
00001 
00005 /*
00006  * Author: Pawel A.Penczek, 09/09/2006 (Pawel.A.Penczek@uth.tmc.edu)
00007  * Copyright (c) 2000-2006 The University of Texas - Houston Medical School
00008  *
00009  * This software is issued under a joint BSD/GNU license. You may use the
00010  * source code in this file under either license. However, note that the
00011  * complete EMAN2 and SPARX software packages have some GPL dependencies,
00012  * so you are responsible for compliance with the licenses of these packages
00013  * if you opt to use BSD licensing. The warranty disclaimer below holds
00014  * in either instance.
00015  *
00016  * This complete copyright notice must be included in any revised version of the
00017  * source code. Additional authorship citations may be added, but existing
00018  * author citations must be preserved.
00019  *
00020  * This program is free software; you can redistribute it and/or modify
00021  * it under the terms of the GNU General Public License as published by
00022  * the Free Software Foundation; either version 2 of the License, or
00023  * (at your option) any later version.
00024  *
00025  * This program is distributed in the hope that it will be useful,
00026  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00027  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
00028  * GNU General Public License for more details.
00029  *
00030  * You should have received a copy of the GNU General Public License
00031  * along with this program; if not, write to the Free Software
00032  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
00033  *
00034  */
00035 
00036 #ifndef eman_processor_sparx_h__
00037 #define eman_processor_sparx_h__ 1
00038 
00039 #include "emdata.h"
00040 
00041 namespace EMAN
00042 {
00043 
00044 
00048         class MirrorProcessor:public Processor
00049         {
00050 
00051           public:
00052                 void process_inplace(EMData * image);
00053 
00054                 string get_name() const
00055                 {
00056                         return NAME;
00057                 }
00058 
00059                 static Processor *NEW()
00060                 {
00061                         return new MirrorProcessor();
00062                 }
00063 
00064                 TypeDict get_param_types() const
00065                 {
00066                         TypeDict d;
00067                         d.put("axis", EMObject::STRING, "'x', 'y', or 'z' axis");
00068                         return d;
00069                 }
00070 
00071                 string get_desc() const
00072                 {
00073                         return "Mirrors an image along the specified axis. This will shift the image center for even box sizes. Use the 'xform.flip' processor to preserve center.";
00074                 }
00075                 
00076                 static const string NAME;
00077         };
00078 
00079 
00087         class NewFourierProcessor:public Processor
00088         {
00089           public:
00090                 //virtual void process_inplace(EMData * image);
00091 
00092                 static string get_group_desc()
00093                 {
00094                         return "Fourier Filter Processors are frequency domain processors. The input image can be either real or Fourier, and the output processed image format corresponds to that of the input file. FourierFilter class is the base class of fourier space processors. The processors can be either low-pass, high-pass, band-pass, or homomorphic. The processor parameters are in absolute frequency units, valid range is ]0,0.5], where 0.5 is Nyquist freqeuncy. ";
00095                 }
00096 
00097                 TypeDict get_param_types() const
00098                 {
00099                         TypeDict d;
00100 //                      d.put("cutoff_frequency", EMObject::FLOAT, "Absolute [0,0.5] cut-off frequency.");      //use cutoff_abs
00101                         d.put("sigma", EMObject::FLOAT, "Gaussian sigma (0-.5)");                                                       //use cutoff_abs
00102                         d.put("cutoff_abs", EMObject::FLOAT, "Processor radius in terms of Nyquist (0-.5)");
00103                         d.put("cutoff_pixels", EMObject::FLOAT, "Width in Fourier pixels (0 - size()/2");
00104                         d.put("cutoff_freq", EMObject::FLOAT, "Resolution in 1/A (0 - 1 / size*apix)");
00105                         d.put("apix", EMObject::FLOAT, " Override A/pix in the image header (changes x,y and z)");
00106                         return d;
00107                 }
00108 
00109           protected:
00110                 virtual void preprocess(EMData * image) {
00111                         if(params.has_key("apix")) {
00112                                 image->set_attr("apix_x", (float)params["apix"]);
00113                                 image->set_attr("apix_y", (float)params["apix"]);
00114                                 image->set_attr("apix_z", (float)params["apix"]);
00115                         }
00116 
00117                         const Dict dict = image->get_attr_dict();
00118                         if( params.has_key("sigma")) {
00119                                 params["cutoff_abs"] = (float)params["sigma"];
00120                         }
00121                         else if( params.has_key("cutoff_abs") ) {
00122                                 params["sigma"] = (float)params["cutoff_abs"];
00123                         }
00124                         else if( params.has_key("cutoff_freq") ) {
00125                                 float val =  (float)params["cutoff_freq"] * (float)dict["apix_x"]; 
00126                                 params["cutoff_abs"] = val;
00127                                 params["sigma"] = val;
00128                         }
00129                         else if( params.has_key("cutoff_pixels") ) {
00130                                 float val = (0.5f*(float)params["cutoff_pixels"] / (float)dict["nx"]);
00131                                 params["cutoff_abs"] = val;
00132                                 params["sigma"] = val;
00133                         }
00134                 }
00135                 virtual void preprocessandconvertpars(EMData * image)
00136                 {
00137                         if(params.has_key("apix")) {
00138                                 image->set_attr("apix_x", (float)params["apix"]);
00139                                 image->set_attr("apix_y", (float)params["apix"]);
00140                                 image->set_attr("apix_z", (float)params["apix"]);
00141                         }
00142 
00143                         const Dict dict = image->get_attr_dict();
00144                         if( params.has_key("sigma")) {
00145                                 params["cutoff_abs"] = (float)params["sigma"];
00146                         }
00147                         else if( params.has_key("cutoff_abs") ) {
00148                                 // Here I have added a patch 1/sqrt(2) to compensate for the different Gaussian used in EMAN1 vs EMAN2 (John Flanagan)
00149                                 float val = (float)params["cutoff_abs"] / sqrt(2.0f);
00150                                 params["cutoff_abs"] = val;
00151                                 params["sigma"] = val;
00152                                 
00153                         }
00154                         else if( params.has_key("cutoff_freq") ) {
00155                                 // Here I have added a patch 1/sqrt(2) to compensate for the different Gaussian used in EMAN1 vs EMAN2 (John Flanagan)
00156                                 float val =  (float)params["cutoff_freq"] * (float)dict["apix_x"] / sqrt(2.0f); 
00157                                 params["cutoff_abs"] = val;
00158                                 params["sigma"] = val;
00159                         }
00160                         else if( params.has_key("cutoff_pixels") ) {
00161                                 // Here I have added a patch 1/sqrt(2) to compensate for the different Gaussian used in EMAN1 vs EMAN2 (John Flanagan)
00162                                 float val = (0.5f*(float)params["cutoff_pixels"] / (float)dict["nx"]) / sqrt(2.0f);
00163                                 params["cutoff_abs"] = val;
00164                                 params["sigma"] = val;
00165                         }
00166                 }
00167                 virtual void setbutterworthdefaults(EMData * image)
00168                 {
00169                         float highlowratio = 0.15f;
00170                         const Dict dict = image->get_attr_dict();
00171                         
00172                         if(params.has_key("cutoff_abs") && !params.has_key("low_cutoff_frequency"))
00173                         {
00174                                 params["low_cutoff_frequency"] = (float)params["cutoff_abs"];
00175                                 
00176                                 float val = (float)params["low_cutoff_frequency"];
00177                                 params["high_cutoff_frequency"] = highlowratio*log10(1.0f/val) + val;
00178                         }
00179                         
00180                         else if(params.has_key("cutoff_freq") && !params.has_key("low_cutoff_frequency"))
00181                         {
00182                                 params["low_cutoff_frequency"] = (float)params["cutoff_freq"] * (float)dict["apix_x"];
00183                                 
00184                                 float val = (float)params["low_cutoff_frequency"];
00185                                 params["high_cutoff_frequency"] = highlowratio*log10(1.0f/val) + val;  
00186                         }
00187                         
00188                         else if(params.has_key("cutoff_pixels") && !params.has_key("low_cutoff_frequency"))
00189                         {
00190                                 params["low_cutoff_frequency"] = (0.5f*(float)params["cutoff_pixels"] / (float)dict["nx"]);
00191                                 
00192                                 float val = (float)params["low_cutoff_frequency"];
00193                                 params["high_cutoff_frequency"] = highlowratio*log10(1.0f/val) + val;  
00194                         }
00195                         
00196                 }
00197         };
00198 
00202         class NewLowpassTopHatProcessor:public NewFourierProcessor
00203         {
00204           public:
00205                 string get_name() const
00206                 { return NAME; }
00207                 static Processor *NEW()
00208                 { return new NewLowpassTopHatProcessor(); }
00209                 string get_desc() const
00210                 {
00211                         return "Lowpass top-hat filter processor applied in Fourier space.";
00212                 }
00213                 void process_inplace(EMData* image) {
00214                         params["filter_type"] = TOP_HAT_LOW_PASS;
00215                         preprocess(image);
00216                         EMFourierFilterInPlace(image, params);
00217                 }
00218                 
00219                 static const string NAME;
00220         };
00221 
00225         class NewHighpassTopHatProcessor:public NewFourierProcessor
00226         {
00227           public:
00228                 string get_name() const
00229                 { return NAME; }
00230                 static Processor *NEW()
00231                 { return new NewHighpassTopHatProcessor(); }
00232                 string get_desc() const
00233                 {
00234                         return "Highpass top-hat filter applied in Fourier space.";
00235                 }
00236                 void process_inplace(EMData* image) {
00237                         params["filter_type"] = TOP_HAT_HIGH_PASS;
00238                         preprocess(image);
00239                         EMFourierFilterInPlace(image, params);
00240                 }
00241                 
00242                 static const string NAME;
00243         };
00244 
00249         class NewBandpassTopHatProcessor:public NewFourierProcessor
00250         {
00251           public:
00252                 string get_name() const
00253                 { return NAME; }
00254                 static Processor *NEW()
00255                 { return new NewBandpassTopHatProcessor(); }
00256                 string get_desc() const
00257                 {
00258                         return "Bandpass top-hat filter processor applied in Fourier space.";
00259                 }
00260                 void process_inplace(EMData* image) {
00261                         params["filter_type"] = TOP_HAT_BAND_PASS;
00262                         EMFourierFilterInPlace(image, params);
00263                 }
00264                 TypeDict get_param_types() const
00265                 {
00266                         TypeDict d = NewFourierProcessor::get_param_types();
00267                         d.put("low_cutoff_frequency", EMObject::FLOAT, "Absolute [0,0.5] low cut-off frequency.");
00268                         d.put("high_cutoff_frequency", EMObject::FLOAT, "Absolute [0,0.5] high cut-off frequency.");
00269                         return d;
00270                 }
00271                 
00272                 static const string NAME;
00273         };
00274 
00280         class NewHomomorphicTopHatProcessor:public NewFourierProcessor
00281         {
00282           public:
00283                 string get_name() const
00284                 { return NAME; }
00285                 static Processor *NEW()
00286                 { return new NewHomomorphicTopHatProcessor(); }
00287                 string get_desc() const
00288                 {
00289                         return "Homomorphic top-hat filter processor applied in Fourier space.";
00290                 }
00291                 void process_inplace(EMData* image) {
00292                         params["filter_type"] = TOP_HOMOMORPHIC;
00293                         EMFourierFilterInPlace(image, params);
00294                 }
00295                 TypeDict get_param_types() const
00296                 {
00297                         TypeDict d = NewFourierProcessor::get_param_types();
00298                         d.put("low_cutoff_frequency", EMObject::FLOAT, "Absolute [0,0.5] low cut-off frequency.");
00299                         d.put("high_cutoff_frequency", EMObject::FLOAT, "Absolute [0,0.5] high cut-off frequency.");
00300                         d.put("value_at_zero_frequency", EMObject::FLOAT, "Value at zero frequency.");
00301                         return d;
00302                 }
00303                 
00304                 static const string NAME;
00305         };
00306 
00310         class NewLowpassGaussProcessor:public NewFourierProcessor
00311         {
00312           public:
00313                 string get_name() const
00314                 { return NAME; }
00315                 static Processor *NEW()
00316                 { return new NewLowpassGaussProcessor(); }
00317                 string get_desc() const
00318                 {
00319                         return "Lowpass Gauss filter processor applied in Fourier space.";
00320                 }
00321                 void process_inplace(EMData* image) {
00322                         params["filter_type"] = GAUSS_LOW_PASS;
00323                         preprocessandconvertpars(image);
00324                         
00325                         if(params.has_key("cutoff_resolv")){
00326                           
00327                                 const Dict dict = image->get_attr_dict();
00328                         
00329                                 // here I have added a little function to filter to a resolvability (John Flanagan 20/09/2010)
00330                                 float R = 1/((float)params["cutoff_resolv"]*(float)dict["apix_x"]);    // convert to pixels
00331                                 float rsigma = sqrt(-4*log(0.36))/(M_PI*R);        // find optimal sigma
00332                                 params["cutoff_abs"] = rsigma / sqrt(2.0f);                               // patch to fix the 2s^2 problem
00333                                 params["sigma"] = rsigma / sqrt(2.0f);                                    // patch to fix the 2s^2 problem
00334                         }
00335                         
00336                         EMFourierFilterInPlace(image, params);
00337                 }
00338                 TypeDict get_param_types() const
00339                 {
00340                         TypeDict d = NewFourierProcessor::get_param_types();
00341                         d.put("cutoff_resolv", EMObject::FLOAT, "Resolvibility in 1/A, applied using filter.lowpass.gauss where cutoff_freq = 2/(pi*R) & R = 1/cutoff_resolv*apix");
00342                         return d;
00343                 }
00344                 
00345                 static const string NAME;
00346         };
00347 
00351         class NewHighpassGaussProcessor:public NewFourierProcessor
00352         {
00353           public:
00354                 string get_name() const
00355                 { return NAME; }
00356                 static Processor *NEW()
00357                 { return new NewHighpassGaussProcessor(); }
00358                 string get_desc() const
00359                 {
00360                         return "Highpass Gauss filter processor applied in Fourier space.";
00361                 }
00362                 void process_inplace(EMData* image) {
00363                         params["filter_type"] = GAUSS_HIGH_PASS;
00364                         preprocessandconvertpars(image);
00365                         EMFourierFilterInPlace(image, params);
00366                 }
00367                 
00368                 static const string NAME;
00369         };
00370 
00375         class NewBandpassGaussProcessor:public NewFourierProcessor
00376         {
00377           public:
00378                 string get_name() const
00379                 { return NAME; }
00380                 static Processor *NEW()
00381                 { return new NewBandpassGaussProcessor(); }
00382                 string get_desc() const
00383                 {
00384                         return "Bandpass Gauss filter processor applied in Fourier space.";
00385                 }
00386                 void process_inplace(EMData* image) {
00387                         params["filter_type"] = GAUSS_BAND_PASS;
00388                         preprocess(image);
00389                         EMFourierFilterInPlace(image, params);
00390                 }
00391                 TypeDict get_param_types() const
00392                 {
00393                         TypeDict d = NewFourierProcessor::get_param_types();
00394                         d.put("center", EMObject::FLOAT, "Gaussian center.");
00395                         return d;
00396                 }
00397                 
00398                 static const string NAME;
00399         };
00400 
00405         class NewHomomorphicGaussProcessor:public NewFourierProcessor
00406         {
00407           public:
00408                 string get_name() const
00409                 { return NAME; }
00410                 static Processor *NEW()
00411                 { return new NewHomomorphicGaussProcessor(); }
00412                 string get_desc() const
00413                 {
00414                         return "Homomorphic Gauss filter processor applied in Fourier space.";
00415                 }
00416                 void process_inplace(EMData* image) {
00417                         params["filter_type"] = GAUSS_HOMOMORPHIC;
00418                         preprocess(image);
00419                         EMFourierFilterInPlace(image, params);
00420                 }
00421                 TypeDict get_param_types() const
00422                 {
00423                         TypeDict d = NewFourierProcessor::get_param_types();
00424                         d.put("value_at_zero_frequency", EMObject::FLOAT, "Value at zero frequency.");
00425                         return d;
00426                 }
00427                 
00428                 static const string NAME;
00429         };
00430 
00434         class NewInverseGaussProcessor:public NewFourierProcessor
00435         {
00436           public:
00437                 string get_name() const
00438                 { return NAME; }
00439                 static Processor *NEW()
00440                 { return new NewInverseGaussProcessor(); }
00441                 string get_desc() const
00442                 {
00443                         return "Divide by a Gaussian in Fourier space.";
00444                 }
00445                 void process_inplace(EMData* image) {
00446                         params["filter_type"] = GAUSS_INVERSE;
00447                         preprocess(image);
00448                         EMFourierFilterInPlace(image, params);
00449                 }
00450                 
00451                 static const string NAME;
00452         };
00453 
00456         class SHIFTProcessor:public NewFourierProcessor
00457         {
00458           public:
00459                 string get_name() const
00460                 { return NAME; }
00461                 static Processor *NEW()
00462                 { return new SHIFTProcessor(); }
00463                 string get_desc() const
00464                 {
00465                         return "Shift by phase multiplication in Fourier space.";
00466                 }
00467                 void process_inplace(EMData* image) {
00468                         params["filter_type"] = SHIFT;
00469                         EMFourierFilterInPlace(image, params);
00470                 }
00471                 TypeDict get_param_types() const
00472                 {
00473                         TypeDict d = NewFourierProcessor::get_param_types();
00474                         d.put("x_shift", EMObject::FLOAT, "Shift x");
00475                         d.put("y_shift", EMObject::FLOAT, "Shift y");
00476                         d.put("z_shift", EMObject::FLOAT, "Shift z");
00477                         return d;
00478                 }
00479                 
00480                 static const string NAME;
00481         };
00482 
00485         class InverseKaiserI0Processor:public NewFourierProcessor
00486         {
00487           public:
00488                 string get_name() const
00489                 { return NAME; }
00490                 static Processor *NEW()
00491                 { return new InverseKaiserI0Processor(); }
00492                 string get_desc() const
00493                 {
00494                         return "Divide by a Kaiser-Bessel I0 func in Fourier space.";
00495                 }
00496                 void process_inplace(EMData* image) {
00497                         params["filter_type"] = KAISER_I0_INVERSE;
00498                         EMFourierFilterInPlace(image, params);
00499                 }
00500                 TypeDict get_param_types() const
00501                 {
00502                         TypeDict d = NewFourierProcessor::get_param_types();
00503                         return d;
00504                 }
00505                 
00506                 static const string NAME;
00507         };
00508 
00511         class InverseKaiserSinhProcessor:public NewFourierProcessor
00512         {
00513           public:
00514                 string get_name() const
00515                 { return NAME; }
00516                 static Processor *NEW()
00517                 { return new InverseKaiserSinhProcessor(); }
00518                 string get_desc() const
00519                 {
00520                         return "Divide by a Kaiser-Bessel Sinh func in Fourier space.";
00521                 }
00522                 void process_inplace(EMData* image) {
00523                         params["filter_type"] = KAISER_SINH_INVERSE;
00524                         EMFourierFilterInPlace(image, params);
00525                 }
00526                 TypeDict get_param_types() const
00527                 {
00528                         TypeDict d = NewFourierProcessor::get_param_types();
00529                         return d;
00530                 }
00531                 
00532                 static const string NAME;
00533         };
00534 
00538         class NewRadialTableProcessor:public NewFourierProcessor
00539         {
00540           public:
00541                 string get_name() const
00542                 { return NAME; }
00543                 
00544                 static Processor *NEW()
00545                 { return new NewRadialTableProcessor(); }
00546                 
00547                 string get_desc() const
00548                 {
00549                         return "Filter with tabulated data in EMFourierFilterFuncFourier space. 1 value per Fourier pixel, extending to corners. Missing value assumed to be 0.";
00550                 }
00551                 void process_inplace(EMData* image) {
00552                         params["filter_type"] = RADIAL_TABLE;
00553                         EMFourierFilterInPlace(image, params);
00554                 }
00555                 TypeDict get_param_types() const
00556                 {
00557 //                      TypeDict d = NewFourierProcessor::get_param_types();
00558                         TypeDict d;
00559                         d.put("table", EMObject::FLOATARRAY, "Radial data array. 1 value per Fourier image pixel.");
00560                         return d;
00561                 }
00562                 
00563                 static const string NAME;
00564         };
00565 
00570         class NewLowpassButterworthProcessor:public NewFourierProcessor
00571         {
00572           public:
00573                 string get_name() const
00574                 { return NAME; }
00575                 static Processor *NEW()
00576                 { return new NewLowpassButterworthProcessor(); }
00577                 string get_desc() const
00578                 {
00579                         return "Lowpass Butterworth filter processor applied in Fourier space.";
00580                 }
00581                 void process_inplace(EMData* image) {
00582                         setbutterworthdefaults(image);
00583                         params["filter_type"] = BUTTERWORTH_LOW_PASS;
00584                         EMFourierFilterInPlace(image, params);
00585                 }
00586                 TypeDict get_param_types() const
00587                 {
00588                         TypeDict d = NewFourierProcessor::get_param_types();
00589                         d.put("low_cutoff_frequency", EMObject::FLOAT, "Absolute [0,0.5] low cut-off frequency.");
00590                         d.put("high_cutoff_frequency", EMObject::FLOAT, "Absolute [0,0.5] high cut-off frequency.");
00591                         return d;
00592                 }
00593                 
00594                 static const string NAME;
00595         };
00596 
00601         class NewHighpassButterworthProcessor:public NewFourierProcessor
00602         {
00603           public:
00604                 string get_name() const
00605                 { return NAME; }
00606                 static Processor *NEW()
00607                 { return new NewHighpassButterworthProcessor(); }
00608                 string get_desc() const
00609                 {
00610                         return "Highpass Butterworth filter processor applied in Fourier space.";
00611                 }
00612                 void process_inplace(EMData* image) {
00613                         params["filter_type"] = BUTTERWORTH_HIGH_PASS;
00614                         setbutterworthdefaults(image);
00615                         EMFourierFilterInPlace(image, params);
00616                 }
00617                 TypeDict get_param_types() const
00618                 {
00619                         TypeDict d = NewFourierProcessor::get_param_types();
00620                         d.put("low_cutoff_frequency", EMObject::FLOAT, "Absolute [0,0.5] low cut-off frequency.");
00621                         d.put("high_cutoff_frequency", EMObject::FLOAT, "Absolute [0,0.5] high cut-off frequency.");
00622                         return d;
00623                 }
00624                 
00625                 static const string NAME;
00626         };
00627 
00633         class NewHomomorphicButterworthProcessor:public NewFourierProcessor
00634         {
00635           public:
00636                 string get_name() const
00637                 { return NAME; }
00638                 static Processor *NEW()
00639                 { return new NewHomomorphicButterworthProcessor(); }
00640                 string get_desc() const
00641                 {
00642                         return "Homomorphic Butterworth filter processor applied in Fourier space.";
00643                 }
00644                 void process_inplace(EMData* image) {
00645                         params["filter_type"] = BUTTERWORTH_HOMOMORPHIC;
00646                         EMFourierFilterInPlace(image, params);
00647                 }
00648                 TypeDict get_param_types() const
00649                 {
00650                         TypeDict d = NewFourierProcessor::get_param_types();
00651                         d.put("low_cutoff_frequency", EMObject::FLOAT, "Absolute [0,0.5] low cut-off frequency.");
00652                         d.put("high_cutoff_frequency", EMObject::FLOAT, "Absolute [0,0.5] high cut-off frequency.");
00653                         d.put("value_at_zero_frequency", EMObject::FLOAT, "Value at zero frequency.");
00654                         return d;
00655                 }
00656                 
00657                 static const string NAME;
00658         };
00659 
00664         class NewLowpassTanhProcessor:public NewFourierProcessor
00665         {
00666           public:
00667                 string get_name() const
00668                 { return NAME; }
00669                 static Processor *NEW()
00670                 { return new NewLowpassTanhProcessor(); }
00671                 string get_desc() const
00672                 {
00673                         return "Lowpass tanh filter processor applied in Fourier space. 0.5*(tanh(cnst*(S+omega))-tanh(cnst*(S-omega))). omega==cutoff_abs. cnst==pi/(2*fall_off*omega). S in terms of Nyquist=0.5.";
00674                 }
00675                 void process_inplace(EMData* image) {
00676                         params["filter_type"] = TANH_LOW_PASS;
00677                         preprocess(image);
00678                         params.set_default("fall_off",.5f); // Only sets it if is not already set
00679                         EMFourierFilterInPlace(image, params);
00680                 }
00681                 TypeDict get_param_types() const
00682                 {
00683                         TypeDict d = NewFourierProcessor::get_param_types();
00684                         d.put("fall_off", EMObject::FLOAT, "Tanh decay rate. ~0 -> step function. 1 -> smooth, gaussian-like falloff. ");
00685                         return d;
00686                 }
00687                 
00688                 static const string NAME;
00689         };
00690 
00695         class NewHighpassTanhProcessor:public NewFourierProcessor
00696         {
00697           public:
00698                 string get_name() const
00699                 { return NAME; }
00700                 static Processor *NEW()
00701                 { return new NewHighpassTanhProcessor(); }
00702                 string get_desc() const
00703                 {
00704                         return "Highpass tanh filter processor applied in Fourier space.";
00705                 }
00706                 void process_inplace(EMData* image) {
00707                         params["filter_type"] = TANH_HIGH_PASS;
00708                         params.set_default("fall_off",.5f); // Only sets it if is not already set
00709                         preprocess(image);
00710                         EMFourierFilterInPlace(image, params);
00711                 }
00712                 TypeDict get_param_types() const
00713                 {
00714                         TypeDict d = NewFourierProcessor::get_param_types();
00715                         d.put("fall_off", EMObject::FLOAT, "Tanh decay rate.");
00716                         return d;
00717                 }
00718                 
00719                 static const string NAME;
00720         };
00721 
00727         class NewHomomorphicTanhProcessor:public NewFourierProcessor
00728         {
00729           public:
00730                 string get_name() const
00731                 { return NAME; }
00732                 static Processor *NEW()
00733                 { return new NewHomomorphicTanhProcessor(); }
00734                 string get_desc() const
00735                 {
00736                         return "Homomorphic Tanh processor applied in Fourier space";
00737                 }
00738                 void process_inplace(EMData* image) {
00739                         params["filter_type"] = TANH_HOMOMORPHIC;
00740                         params.set_default("fall_off",.5f); // Only sets it if is not already set
00741                         preprocess(image);
00742                         EMFourierFilterInPlace(image, params);
00743                 }
00744                 TypeDict get_param_types() const
00745                 {
00746                         TypeDict d = NewFourierProcessor::get_param_types();
00747                         d.put("fall_off", EMObject::FLOAT, "Tanh decay rate.");
00748                         d.put("value_at_zero_frequency", EMObject::FLOAT, "Value at zero frequency.");
00749                         return d;
00750                 }
00751                 
00752                 static const string NAME;
00753         };
00754 
00762         class NewBandpassTanhProcessor:public NewFourierProcessor
00763         {
00764           public:
00765                 string get_name() const
00766                 { return NAME; }
00767                 static Processor *NEW()
00768                 { return new NewBandpassTanhProcessor(); }
00769                 string get_desc() const
00770                 {
00771                         return "Bandpass tanh processor applied in Fourier space.";
00772                 }
00773                 void process_inplace(EMData* image) {
00774                         params["filter_type"] = TANH_BAND_PASS;
00775                         EMFourierFilterInPlace(image, params);
00776                 }
00777                 TypeDict get_param_types() const
00778                 {
00779                         TypeDict d = NewFourierProcessor::get_param_types();
00780                         d.put("low_cutoff_frequency", EMObject::FLOAT, "Absolute [0,0.5] low cut-off frequency.");
00781                         d.put("Low_fall_off", EMObject::FLOAT, "Tanh low decay rate.");
00782                         d.put("high_cutoff_frequency", EMObject::FLOAT, "Absolute [0,0.5] high cut-off frequency.");
00783                         d.put("high_fall_off", EMObject::FLOAT, "Tanh high decay rate.");
00784                         d.put("fall_off", EMObject::FLOAT, "Tanh decay rate.");
00785                         return d;
00786                 }
00787                 
00788                 static const string NAME;
00789         };
00790 
00791         class CTF_Processor:public NewFourierProcessor
00792         {
00793           public:
00794                 string get_name() const
00795                 { return NAME; }
00796                 static Processor *NEW()
00797                 { return new CTF_Processor(); }
00798                 string get_desc() const
00799                 {
00800                         return "CTF_ is applied in Fourier image.";
00801                 }
00802                 void process_inplace(EMData* image) {
00803                         params["filter_type"] = CTF_;
00804                         EMFourierFilterInPlace(image, params);
00805                 }
00806                 TypeDict get_param_types() const
00807                 {
00808                         TypeDict d = NewFourierProcessor::get_param_types();
00809                         d.put("defocus", EMObject::FLOAT, "defocus value in Angstrom.");
00810                         d.put("cs", EMObject::FLOAT, "cs in CM.");
00811                         d.put("voltage", EMObject::FLOAT, "voltage in Kv.");
00812                         d.put("ps", EMObject::FLOAT, "pixel size.");
00813                         d.put("b_factor", EMObject::FLOAT, "Gaussian like evelope function (b_factor).");
00814                         d.put("wgh", EMObject::FLOAT, "Amplitude contrast ratio.");
00815                         d.put("sign", EMObject::FLOAT, "Sign of Contrast transfer function,and use -1 to compensate.");
00816                         d.put("npow", EMObject::FLOAT, "power of transfer function.");
00817                         return d;
00818                 }
00819                 
00820                 static const string NAME;
00821         };
00822 }
00823 
00824 #endif  //eman_processor_sparx_h__