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 
00080 
00081         class NewFourierProcessor:public Processor
00082         {
00083           public:
00084                 //virtual void process_inplace(EMData * image);
00085 
00086                 static string get_group_desc()
00087                 {
00088                         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. ";
00089                 }
00090 
00091                 TypeDict get_param_types() const
00092                 {
00093                         TypeDict d;
00094 //                      d.put("cutoff_frequency", EMObject::FLOAT, "Absolute [0,0.5] cut-off frequency.");      //use cutoff_abs
00095                         d.put("sigma", EMObject::FLOAT, "Gaussian sigma (0-.5)");                                                       //use cutoff_abs
00096                         d.put("cutoff_abs", EMObject::FLOAT, "Processor radius in terms of Nyquist (0-.5)");
00097                         d.put("cutoff_pixels", EMObject::FLOAT, "Width in Fourier pixels (0 - size()/2");
00098                         d.put("cutoff_freq", EMObject::FLOAT, "Resolution in 1/A (0 - 1 / size*apix)");
00099                         d.put("apix", EMObject::FLOAT, " Override A/pix in the image header (changes x,y and z)");
00100                         return d;
00101                 }
00102 
00103           protected:
00104                 virtual void preprocess(EMData * image) {
00105                         if(params.has_key("apix")) {
00106                                 image->set_attr("apix_x", (float)params["apix"]);
00107                                 image->set_attr("apix_y", (float)params["apix"]);
00108                                 image->set_attr("apix_z", (float)params["apix"]);
00109                         }
00110 
00111                         const Dict dict = image->get_attr_dict();
00112                         if( params.has_key("sigma")) {
00113                                 params["cutoff_abs"] = (float)params["sigma"];
00114                         }
00115                         else if( params.has_key("cutoff_abs") ) {
00116                                 params["sigma"] = (float)params["cutoff_abs"];
00117                         }
00118                         else if( params.has_key("cutoff_freq") ) {
00119                                 float val =  (float)params["cutoff_freq"] * (float)dict["apix_x"]; 
00120                                 params["cutoff_abs"] = val;
00121                                 params["sigma"] = val;
00122                         }
00123                         else if( params.has_key("cutoff_pixels") ) {
00124                                 float val = (0.5f*(float)params["cutoff_pixels"] / (float)dict["nx"]);
00125                                 params["cutoff_abs"] = val;
00126                                 params["sigma"] = val;
00127                         }
00128                 }
00129                 virtual void preprocessandconvertpars(EMData * image)
00130                 {
00131                         if(params.has_key("apix")) {
00132                                 image->set_attr("apix_x", (float)params["apix"]);
00133                                 image->set_attr("apix_y", (float)params["apix"]);
00134                                 image->set_attr("apix_z", (float)params["apix"]);
00135                         }
00136 
00137                         const Dict dict = image->get_attr_dict();
00138                         if( params.has_key("sigma")) {
00139                                 params["cutoff_abs"] = (float)params["sigma"];
00140                         }
00141                         else if( params.has_key("cutoff_abs") ) {
00142                                 // Here I have added a patch 1/sqrt(2) to compensate for the different Gaussian used in EMAN1 vs EMAN2 (John Flanagan)
00143                                 float val = (float)params["cutoff_abs"] / sqrt(2.0f);
00144                                 params["cutoff_abs"] = val;
00145                                 params["sigma"] = val;
00146                                 
00147                         }
00148                         else if( params.has_key("cutoff_freq") ) {
00149                                 // Here I have added a patch 1/sqrt(2) to compensate for the different Gaussian used in EMAN1 vs EMAN2 (John Flanagan)
00150                                 float val =  (float)params["cutoff_freq"] * (float)dict["apix_x"] / sqrt(2.0f); 
00151                                 params["cutoff_abs"] = val;
00152                                 params["sigma"] = val;
00153                         }
00154                         else if( params.has_key("cutoff_pixels") ) {
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 = (0.5f*(float)params["cutoff_pixels"] / (float)dict["nx"]) / sqrt(2.0f);
00157                                 params["cutoff_abs"] = val;
00158                                 params["sigma"] = val;
00159                         }
00160                 }
00161                 virtual void setbutterworthdefaults(EMData * image)
00162                 {
00163                         float highlowratio = 0.15f;
00164                         const Dict dict = image->get_attr_dict();
00165                         
00166                         if(params.has_key("cutoff_abs") && !params.has_key("low_cutoff_frequency"))
00167                         {
00168                                 params["low_cutoff_frequency"] = (float)params["cutoff_abs"];
00169                                 
00170                                 float val = (float)params["low_cutoff_frequency"];
00171                                 params["high_cutoff_frequency"] = highlowratio*log10(1.0f/val) + val;
00172                         }
00173                         
00174                         else if(params.has_key("cutoff_freq") && !params.has_key("low_cutoff_frequency"))
00175                         {
00176                                 params["low_cutoff_frequency"] = (float)params["cutoff_freq"] * (float)dict["apix_x"];
00177                                 
00178                                 float val = (float)params["low_cutoff_frequency"];
00179                                 params["high_cutoff_frequency"] = highlowratio*log10(1.0f/val) + val;  
00180                         }
00181                         
00182                         else if(params.has_key("cutoff_pixels") && !params.has_key("low_cutoff_frequency"))
00183                         {
00184                                 params["low_cutoff_frequency"] = (0.5f*(float)params["cutoff_pixels"] / (float)dict["nx"]);
00185                                 
00186                                 float val = (float)params["low_cutoff_frequency"];
00187                                 params["high_cutoff_frequency"] = highlowratio*log10(1.0f/val) + val;  
00188                         }
00189                         
00190                 }
00191         };
00192 
00196         class NewLowpassTopHatProcessor:public NewFourierProcessor
00197         {
00198           public:
00199                 string get_name() const
00200                 { return NAME; }
00201                 static Processor *NEW()
00202                 { return new NewLowpassTopHatProcessor(); }
00203                 string get_desc() const
00204                 {
00205                         return "Lowpass top-hat filter processor applied in Fourier space.";
00206                 }
00207                 void process_inplace(EMData* image) {
00208                         params["filter_type"] = TOP_HAT_LOW_PASS;
00209                         preprocess(image);
00210                         EMFourierFilterInPlace(image, params);
00211                 }
00212                 
00213                 static const string NAME;
00214         };
00215 
00219         class NewHighpassTopHatProcessor:public NewFourierProcessor
00220         {
00221           public:
00222                 string get_name() const
00223                 { return NAME; }
00224                 static Processor *NEW()
00225                 { return new NewHighpassTopHatProcessor(); }
00226                 string get_desc() const
00227                 {
00228                         return "Highpass top-hat filter applied in Fourier space.";
00229                 }
00230                 void process_inplace(EMData* image) {
00231                         params["filter_type"] = TOP_HAT_HIGH_PASS;
00232                         preprocess(image);
00233                         EMFourierFilterInPlace(image, params);
00234                 }
00235                 
00236                 static const string NAME;
00237         };
00238 
00243         class NewBandpassTopHatProcessor:public NewFourierProcessor
00244         {
00245           public:
00246                 string get_name() const
00247                 { return NAME; }
00248                 static Processor *NEW()
00249                 { return new NewBandpassTopHatProcessor(); }
00250                 string get_desc() const
00251                 {
00252                         return "Bandpass top-hat filter processor applied in Fourier space.";
00253                 }
00254                 void process_inplace(EMData* image) {
00255                         params["filter_type"] = TOP_HAT_BAND_PASS;
00256                         EMFourierFilterInPlace(image, params);
00257                 }
00258                 TypeDict get_param_types() const
00259                 {
00260                         TypeDict d = NewFourierProcessor::get_param_types();
00261                         d.put("low_cutoff_frequency", EMObject::FLOAT, "Absolute [0,0.5] low cut-off frequency.");
00262                         d.put("high_cutoff_frequency", EMObject::FLOAT, "Absolute [0,0.5] high cut-off frequency.");
00263                         return d;
00264                 }
00265                 
00266                 static const string NAME;
00267         };
00268 
00274         class NewHomomorphicTopHatProcessor:public NewFourierProcessor
00275         {
00276           public:
00277                 string get_name() const
00278                 { return NAME; }
00279                 static Processor *NEW()
00280                 { return new NewHomomorphicTopHatProcessor(); }
00281                 string get_desc() const
00282                 {
00283                         return "Homomorphic top-hat filter processor applied in Fourier space.";
00284                 }
00285                 void process_inplace(EMData* image) {
00286                         params["filter_type"] = TOP_HOMOMORPHIC;
00287                         EMFourierFilterInPlace(image, params);
00288                 }
00289                 TypeDict get_param_types() const
00290                 {
00291                         TypeDict d = NewFourierProcessor::get_param_types();
00292                         d.put("low_cutoff_frequency", EMObject::FLOAT, "Absolute [0,0.5] low cut-off frequency.");
00293                         d.put("high_cutoff_frequency", EMObject::FLOAT, "Absolute [0,0.5] high cut-off frequency.");
00294                         d.put("value_at_zero_frequency", EMObject::FLOAT, "Value at zero frequency.");
00295                         return d;
00296                 }
00297                 
00298                 static const string NAME;
00299         };
00300 
00304         class NewLowpassGaussProcessor:public NewFourierProcessor
00305         {
00306           public:
00307                 string get_name() const
00308                 { return NAME; }
00309                 static Processor *NEW()
00310                 { return new NewLowpassGaussProcessor(); }
00311                 string get_desc() const
00312                 {
00313                         return "Lowpass Gauss filter processor applied in Fourier space.";
00314                 }
00315                 void process_inplace(EMData* image) {
00316                         params["filter_type"] = GAUSS_LOW_PASS;
00317                         preprocessandconvertpars(image);
00318                         
00319                         if(params.has_key("cutoff_resolv")){
00320                           
00321                                 const Dict dict = image->get_attr_dict();
00322                         
00323                                 // here I have added a little function to filter to a resolvability (John Flanagan 20/09/2010)
00324                                 float R = 1/((float)params["cutoff_resolv"]*(float)dict["apix_x"]);    // convert to pixels
00325                                 float rsigma = sqrt((-4*log(0.36f))/(pow(M_PI,2)*pow(R,2)));        // find optimal sigma
00326                                 params["cutoff_abs"] = rsigma / sqrt(2.0f);                               // patch to fix the 2s^2 problem
00327                                 params["sigma"] = rsigma / sqrt(2.0f);                                    // patch to fix the 2s^2 problem
00328                         }
00329                         
00330                         EMFourierFilterInPlace(image, params);
00331                 }
00332                 TypeDict get_param_types() const
00333                 {
00334                         TypeDict d = NewFourierProcessor::get_param_types();
00335                         d.put("cutoff_resolv", EMObject::FLOAT, "Resolvibility in 1/A, applied using filter.lowpass.gauss where cutoff_freq = sqrt(-4ln(0.36)/pi^2R^2) & R = 1/cf*apix");
00336                         return d;
00337                 }
00338                 
00339                 static const string NAME;
00340         };
00341 
00345         class NewHighpassGaussProcessor:public NewFourierProcessor
00346         {
00347           public:
00348                 string get_name() const
00349                 { return NAME; }
00350                 static Processor *NEW()
00351                 { return new NewHighpassGaussProcessor(); }
00352                 string get_desc() const
00353                 {
00354                         return "Highpass Gauss filter processor applied in Fourier space.";
00355                 }
00356                 void process_inplace(EMData* image) {
00357                         params["filter_type"] = GAUSS_HIGH_PASS;
00358                         preprocessandconvertpars(image);
00359                         EMFourierFilterInPlace(image, params);
00360                 }
00361                 
00362                 static const string NAME;
00363         };
00364 
00369         class NewBandpassGaussProcessor:public NewFourierProcessor
00370         {
00371           public:
00372                 string get_name() const
00373                 { return NAME; }
00374                 static Processor *NEW()
00375                 { return new NewBandpassGaussProcessor(); }
00376                 string get_desc() const
00377                 {
00378                         return "Bandpass Gauss filter processor applied in Fourier space.";
00379                 }
00380                 void process_inplace(EMData* image) {
00381                         params["filter_type"] = GAUSS_BAND_PASS;
00382                         preprocess(image);
00383                         EMFourierFilterInPlace(image, params);
00384                 }
00385                 TypeDict get_param_types() const
00386                 {
00387                         TypeDict d = NewFourierProcessor::get_param_types();
00388                         d.put("center", EMObject::FLOAT, "Gaussian center.");
00389                         return d;
00390                 }
00391                 
00392                 static const string NAME;
00393         };
00394 
00399         class NewHomomorphicGaussProcessor:public NewFourierProcessor
00400         {
00401           public:
00402                 string get_name() const
00403                 { return NAME; }
00404                 static Processor *NEW()
00405                 { return new NewHomomorphicGaussProcessor(); }
00406                 string get_desc() const
00407                 {
00408                         return "Homomorphic Gauss filter processor applied in Fourier space.";
00409                 }
00410                 void process_inplace(EMData* image) {
00411                         params["filter_type"] = GAUSS_HOMOMORPHIC;
00412                         preprocess(image);
00413                         EMFourierFilterInPlace(image, params);
00414                 }
00415                 TypeDict get_param_types() const
00416                 {
00417                         TypeDict d = NewFourierProcessor::get_param_types();
00418                         d.put("value_at_zero_frequency", EMObject::FLOAT, "Value at zero frequency.");
00419                         return d;
00420                 }
00421                 
00422                 static const string NAME;
00423         };
00424 
00428         class NewInverseGaussProcessor:public NewFourierProcessor
00429         {
00430           public:
00431                 string get_name() const
00432                 { return NAME; }
00433                 static Processor *NEW()
00434                 { return new NewInverseGaussProcessor(); }
00435                 string get_desc() const
00436                 {
00437                         return "Divide by a Gaussian in Fourier space.";
00438                 }
00439                 void process_inplace(EMData* image) {
00440                         params["filter_type"] = GAUSS_INVERSE;
00441                         preprocess(image);
00442                         EMFourierFilterInPlace(image, params);
00443                 }
00444                 
00445                 static const string NAME;
00446         };
00447 
00450         class SHIFTProcessor:public NewFourierProcessor
00451         {
00452           public:
00453                 string get_name() const
00454                 { return NAME; }
00455                 static Processor *NEW()
00456                 { return new SHIFTProcessor(); }
00457                 string get_desc() const
00458                 {
00459                         return "Shift by phase multiplication in Fourier space.";
00460                 }
00461                 void process_inplace(EMData* image) {
00462                         params["filter_type"] = SHIFT;
00463                         EMFourierFilterInPlace(image, params);
00464                 }
00465                 TypeDict get_param_types() const
00466                 {
00467                         TypeDict d = NewFourierProcessor::get_param_types();
00468                         d.put("x_shift", EMObject::FLOAT, "Shift x");
00469                         d.put("y_shift", EMObject::FLOAT, "Shift y");
00470                         d.put("z_shift", EMObject::FLOAT, "Shift z");
00471                         return d;
00472                 }
00473                 
00474                 static const string NAME;
00475         };
00476 
00479         class InverseKaiserI0Processor:public NewFourierProcessor
00480         {
00481           public:
00482                 string get_name() const
00483                 { return NAME; }
00484                 static Processor *NEW()
00485                 { return new InverseKaiserI0Processor(); }
00486                 string get_desc() const
00487                 {
00488                         return "Divide by a Kaiser-Bessel I0 func in Fourier space.";
00489                 }
00490                 void process_inplace(EMData* image) {
00491                         params["filter_type"] = KAISER_I0_INVERSE;
00492                         EMFourierFilterInPlace(image, params);
00493                 }
00494                 TypeDict get_param_types() const
00495                 {
00496                         TypeDict d = NewFourierProcessor::get_param_types();
00497                         return d;
00498                 }
00499                 
00500                 static const string NAME;
00501         };
00502 
00505         class InverseKaiserSinhProcessor:public NewFourierProcessor
00506         {
00507           public:
00508                 string get_name() const
00509                 { return NAME; }
00510                 static Processor *NEW()
00511                 { return new InverseKaiserSinhProcessor(); }
00512                 string get_desc() const
00513                 {
00514                         return "Divide by a Kaiser-Bessel Sinh func in Fourier space.";
00515                 }
00516                 void process_inplace(EMData* image) {
00517                         params["filter_type"] = KAISER_SINH_INVERSE;
00518                         EMFourierFilterInPlace(image, params);
00519                 }
00520                 TypeDict get_param_types() const
00521                 {
00522                         TypeDict d = NewFourierProcessor::get_param_types();
00523                         return d;
00524                 }
00525                 
00526                 static const string NAME;
00527         };
00528 
00532         class NewRadialTableProcessor:public NewFourierProcessor
00533         {
00534           public:
00535                 string get_name() const
00536                 { return NAME; }
00537                 
00538                 static Processor *NEW()
00539                 { return new NewRadialTableProcessor(); }
00540                 
00541                 string get_desc() const
00542                 {
00543                         return "Filter with tabulated data in EMFourierFilterFuncFourier space. 1 value per Fourier pixel, extending to corners. Missing value assumed to be 0.";
00544                 }
00545                 void process_inplace(EMData* image) {
00546                         params["filter_type"] = RADIAL_TABLE;
00547                         EMFourierFilterInPlace(image, params);
00548                 }
00549                 TypeDict get_param_types() const
00550                 {
00551 //                      TypeDict d = NewFourierProcessor::get_param_types();
00552                         TypeDict d;
00553                         d.put("table", EMObject::FLOATARRAY, "Radial data array. 1 value per Fourier image pixel.");
00554                         return d;
00555                 }
00556                 
00557                 static const string NAME;
00558         };
00559 
00564         class NewLowpassButterworthProcessor:public NewFourierProcessor
00565         {
00566           public:
00567                 string get_name() const
00568                 { return NAME; }
00569                 static Processor *NEW()
00570                 { return new NewLowpassButterworthProcessor(); }
00571                 string get_desc() const
00572                 {
00573                         return "Lowpass Butterworth filter processor applied in Fourier space.";
00574                 }
00575                 void process_inplace(EMData* image) {
00576                         setbutterworthdefaults(image);
00577                         params["filter_type"] = BUTTERWORTH_LOW_PASS;
00578                         EMFourierFilterInPlace(image, params);
00579                 }
00580                 TypeDict get_param_types() const
00581                 {
00582                         TypeDict d = NewFourierProcessor::get_param_types();
00583                         d.put("low_cutoff_frequency", EMObject::FLOAT, "Absolute [0,0.5] low cut-off frequency.");
00584                         d.put("high_cutoff_frequency", EMObject::FLOAT, "Absolute [0,0.5] high cut-off frequency.");
00585                         return d;
00586                 }
00587                 
00588                 static const string NAME;
00589         };
00590 
00595         class NewHighpassButterworthProcessor:public NewFourierProcessor
00596         {
00597           public:
00598                 string get_name() const
00599                 { return NAME; }
00600                 static Processor *NEW()
00601                 { return new NewHighpassButterworthProcessor(); }
00602                 string get_desc() const
00603                 {
00604                         return "Highpass Butterworth filter processor applied in Fourier space.";
00605                 }
00606                 void process_inplace(EMData* image) {
00607                         params["filter_type"] = BUTTERWORTH_HIGH_PASS;
00608                         setbutterworthdefaults(image);
00609                         EMFourierFilterInPlace(image, params);
00610                 }
00611                 TypeDict get_param_types() const
00612                 {
00613                         TypeDict d = NewFourierProcessor::get_param_types();
00614                         d.put("low_cutoff_frequency", EMObject::FLOAT, "Absolute [0,0.5] low cut-off frequency.");
00615                         d.put("high_cutoff_frequency", EMObject::FLOAT, "Absolute [0,0.5] high cut-off frequency.");
00616                         return d;
00617                 }
00618                 
00619                 static const string NAME;
00620         };
00621 
00627         class NewHomomorphicButterworthProcessor:public NewFourierProcessor
00628         {
00629           public:
00630                 string get_name() const
00631                 { return NAME; }
00632                 static Processor *NEW()
00633                 { return new NewHomomorphicButterworthProcessor(); }
00634                 string get_desc() const
00635                 {
00636                         return "Homomorphic Butterworth filter processor applied in Fourier space.";
00637                 }
00638                 void process_inplace(EMData* image) {
00639                         params["filter_type"] = BUTTERWORTH_HOMOMORPHIC;
00640                         EMFourierFilterInPlace(image, params);
00641                 }
00642                 TypeDict get_param_types() const
00643                 {
00644                         TypeDict d = NewFourierProcessor::get_param_types();
00645                         d.put("low_cutoff_frequency", EMObject::FLOAT, "Absolute [0,0.5] low cut-off frequency.");
00646                         d.put("high_cutoff_frequency", EMObject::FLOAT, "Absolute [0,0.5] high cut-off frequency.");
00647                         d.put("value_at_zero_frequency", EMObject::FLOAT, "Value at zero frequency.");
00648                         return d;
00649                 }
00650                 
00651                 static const string NAME;
00652         };
00653 
00658         class NewLowpassTanhProcessor:public NewFourierProcessor
00659         {
00660           public:
00661                 string get_name() const
00662                 { return NAME; }
00663                 static Processor *NEW()
00664                 { return new NewLowpassTanhProcessor(); }
00665                 string get_desc() const
00666                 {
00667                         return "Lowpass tanh filter processor applied in Fourier space.";
00668                 }
00669                 void process_inplace(EMData* image) {
00670                         params["filter_type"] = TANH_LOW_PASS;
00671                         preprocess(image);
00672                         params.set_default("fall_off",.5f); // Only sets it if is not already set
00673                         EMFourierFilterInPlace(image, params);
00674                 }
00675                 TypeDict get_param_types() const
00676                 {
00677                         TypeDict d = NewFourierProcessor::get_param_types();
00678                         d.put("fall_off", EMObject::FLOAT, "Tanh decay rate.");
00679                         return d;
00680                 }
00681                 
00682                 static const string NAME;
00683         };
00684 
00689         class NewHighpassTanhProcessor:public NewFourierProcessor
00690         {
00691           public:
00692                 string get_name() const
00693                 { return NAME; }
00694                 static Processor *NEW()
00695                 { return new NewHighpassTanhProcessor(); }
00696                 string get_desc() const
00697                 {
00698                         return "Highpass tanh filter processor applied in Fourier space.";
00699                 }
00700                 void process_inplace(EMData* image) {
00701                         params["filter_type"] = TANH_HIGH_PASS;
00702                         params.set_default("fall_off",.5f); // Only sets it if is not already set
00703                         preprocess(image);
00704                         EMFourierFilterInPlace(image, params);
00705                 }
00706                 TypeDict get_param_types() const
00707                 {
00708                         TypeDict d = NewFourierProcessor::get_param_types();
00709                         d.put("fall_off", EMObject::FLOAT, "Tanh decay rate.");
00710                         return d;
00711                 }
00712                 
00713                 static const string NAME;
00714         };
00715 
00721         class NewHomomorphicTanhProcessor:public NewFourierProcessor
00722         {
00723           public:
00724                 string get_name() const
00725                 { return NAME; }
00726                 static Processor *NEW()
00727                 { return new NewHomomorphicTanhProcessor(); }
00728                 string get_desc() const
00729                 {
00730                         return "Homomorphic Tanh processor applied in Fourier space";
00731                 }
00732                 void process_inplace(EMData* image) {
00733                         params["filter_type"] = TANH_HOMOMORPHIC;
00734                         params.set_default("fall_off",.5f); // Only sets it if is not already set
00735                         preprocess(image);
00736                         EMFourierFilterInPlace(image, params);
00737                 }
00738                 TypeDict get_param_types() const
00739                 {
00740                         TypeDict d = NewFourierProcessor::get_param_types();
00741                         d.put("fall_off", EMObject::FLOAT, "Tanh decay rate.");
00742                         d.put("value_at_zero_frequency", EMObject::FLOAT, "Value at zero frequency.");
00743                         return d;
00744                 }
00745                 
00746                 static const string NAME;
00747         };
00748 
00756         class NewBandpassTanhProcessor:public NewFourierProcessor
00757         {
00758           public:
00759                 string get_name() const
00760                 { return NAME; }
00761                 static Processor *NEW()
00762                 { return new NewBandpassTanhProcessor(); }
00763                 string get_desc() const
00764                 {
00765                         return "Bandpass tanh processor applied in Fourier space.";
00766                 }
00767                 void process_inplace(EMData* image) {
00768                         params["filter_type"] = TANH_BAND_PASS;
00769                         EMFourierFilterInPlace(image, params);
00770                 }
00771                 TypeDict get_param_types() const
00772                 {
00773                         TypeDict d = NewFourierProcessor::get_param_types();
00774                         d.put("low_cutoff_frequency", EMObject::FLOAT, "Absolute [0,0.5] low cut-off frequency.");
00775                         d.put("Low_fall_off", EMObject::FLOAT, "Tanh low decay rate.");
00776                         d.put("high_cutoff_frequency", EMObject::FLOAT, "Absolute [0,0.5] high cut-off frequency.");
00777                         d.put("high_fall_off", EMObject::FLOAT, "Tanh high decay rate.");
00778                         d.put("fall_off", EMObject::FLOAT, "Tanh decay rate.");
00779                         return d;
00780                 }
00781                 
00782                 static const string NAME;
00783         };
00784 
00785         class CTF_Processor:public NewFourierProcessor
00786         {
00787           public:
00788                 string get_name() const
00789                 { return NAME; }
00790                 static Processor *NEW()
00791                 { return new CTF_Processor(); }
00792                 string get_desc() const
00793                 {
00794                         return "CTF_ is applied in Fourier image.";
00795                 }
00796                 void process_inplace(EMData* image) {
00797                         params["filter_type"] = CTF_;
00798                         EMFourierFilterInPlace(image, params);
00799                 }
00800                 TypeDict get_param_types() const
00801                 {
00802                         TypeDict d = NewFourierProcessor::get_param_types();
00803                         d.put("defocus", EMObject::FLOAT, "defocus value in Angstrom.");
00804                         d.put("cs", EMObject::FLOAT, "cs in CM.");
00805                         d.put("voltage", EMObject::FLOAT, "voltage in Kv.");
00806                         d.put("ps", EMObject::FLOAT, "pixel size.");
00807                         d.put("b_factor", EMObject::FLOAT, "Gaussian like evelope function (b_factor).");
00808                         d.put("wgh", EMObject::FLOAT, "Amplitude contrast ratio.");
00809                         d.put("sign", EMObject::FLOAT, "Sign of Contrast transfer function,and use -1 to compensate.");
00810                         d.put("npow", EMObject::FLOAT, "power of transfer function.");
00811                         return d;
00812                 }
00813                 
00814                 static const string NAME;
00815         };
00816 }
00817 
00818 #endif  //eman_processor_sparx_h__

Generated on Tue Jul 12 13:45:51 2011 for EMAN2 by  doxygen 1.4.7