Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members

emdata_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 emdata__sparx_h__
00037 #define emdata__sparx_h__
00038 
00039 public:
00046 EMData *real2FH(float OverSamplekB);
00047 
00056 EMData *FH2F(int Size, float OverSamplekB, int IntensityFlag =0);
00057 
00066 EMData *FH2Real(int Size, float OverSamplekB, int IntensityFlag =0);
00067 
00068 
00073 EMData* rotavg();
00074 
00079 EMData* rotavg_i();
00080 
00086 EMData* mult_radial(EMData* radial);
00087 
00093  vector<float> cog();
00094 
00095 
00114                 vector <float> calc_fourier_shell_correlation(EMData * with, float w = 1.0f);
00115 
00120                 EMData* average_circ_sub() const;
00121 
00122 
00132                 void onelinenn(int j, int n, int n2, EMData* wptr, EMData* bi, const Transform& tf);
00133 
00134                 void onelinenn_mult(int j, int n, int n2, EMData* wptr, EMData* bi, const Transform& tf, int mult);
00135 
00144                 void nn(EMData* wptr, EMData* myfft, const Transform& tf, int mult=1);
00145                 void insert_rect_slice( EMData* w, EMData* myfft,const Transform& trans, int sizeofprojection, float xratio, float yratio, int npad, int mult);
00146 
00157                 void nn_SSNR(EMData* wptr, EMData* wptr2, EMData* myfft, const Transform& tf, int mult=1);
00158 
00170 /*      void nn_SSNR_ctf(EMData* wptr, EMData* wptr2, EMData* wptr3, EMData* wptr4, EMData* wptr5, EMData* myfft, EMData* m_wvolume, const Transform3D& tf, int mult=1); */
00171                 void nn_SSNR_ctf(EMData* wptr, EMData* wptr2, EMData* wptr3, EMData* myfft, const Transform& tf, int mult=1);
00172 
00178 /*               void nn_wiener(EMData* wptr, EMData* wptr3, EMData* myfft, const Transform3D& tf, int mult); */
00185                 void symplane0(EMData* norm);
00186 
00193                 void symplane1(EMData* norm, EMData* norm2);
00194 
00202                 void symplane2(EMData* norm, EMData* norm2, EMData* norm3);
00203 
00214                 void onelinenn_ctf(int j, int n, int n2, EMData* w, EMData* bi, const Transform& tf, int mult);
00215 
00224                 void nn_ctf(EMData* w, EMData* myfft, const Transform& tf, int mult);
00228                 void insert_rect_slice_ctf( EMData* w, EMData* myfft,const Transform& trans, int sizeofprojection, float xratio, float yratio, int npad, int mult);
00229                 void insert_rect_slice_ctf_applied(EMData* w, EMData* myfft, const Transform& trans, int sizeofprojection, float xratio, float yratio, int npad,int mult);
00230         
00231 
00243                 void onelinenn_ctf_applied(int j, int n, int n2, EMData* w, EMData* bi, const Transform& tf, int mult);
00244 
00254                 void nn_ctf_applied(EMData* w, EMData* myfft, const Transform& tf, int mult );
00255 
00261                 void symplane0_ctf(EMData* w);
00262                 void symplane0_rect(EMData* w);
00263 
00264 
00271                 EMData* symvol(string symmetry);
00272 
00273 
00287                 EMData* rot_scale_trans2D(float ang, float delx = 0.0f, float dely = 0.0f, float scale = 1.0f);
00288 
00305         EMData* rot_scale_trans2D_background(float ang, float delx = 0.0f, float dely = 0.0f, float scale = 1.0f);
00306 
00316         EMData* rot_scale_trans(const Transform &RA);
00317 
00330         EMData* rot_scale_trans_background(const Transform &RA);
00331 
00332                 /*
00333                                 To restrict the value to [0, nx)
00334                 */
00335                 static inline float restrict1(float x, int nx) {
00336                         while ( x < 0.0f )          x += nx;
00337                         while ( x >= (float)(nx) )  x -= nx;
00338                         return x;
00339                 }
00340 
00341                 /*
00342                                 To restrict the value to (-nx, nx)
00343                 */
00344                 static inline float restrict2(float x, int nx) {
00345                         while ( x >=  (float)(nx) )  x -= nx;
00346                         while ( x <= -(float)(nx) )  x += nx;
00347                         return x;
00348                 }
00349 
00350 
00351 
00357                 //float cm_euc(EMData* sinoj, int n1, int n2, float alpha1, float alpha2);
00358                 float cm_euc(EMData* sinoj, int n1, int n2);
00359 
00374                 EMData* rot_scale_conv(float ang, float delx, float dely, Util::KaiserBessel& kb, float scale = 1.0);
00375 
00376                 EMData* downsample(Util::sincBlackman& kb, float scale = 1.0);
00377 
00378                 EMData* rot_scale_conv7(float ang, float delx, float dely, Util::KaiserBessel& kb, float scale_input);
00379 
00380                 EMData* rot_scale_conv_new(float ang, float delx, float dely, Util::KaiserBessel& kb, float scale = 1.0);
00381 
00382         EMData* rot_scale_conv_new_background(float ang, float delx, float dely, Util::KaiserBessel& kb, float scale = 1.0);
00383 
00384                 EMData* rot_scale_conv_new_3D(float phi, float theta, float psi, float delx, float dely, float delz, Util::KaiserBessel& kb, float scale = 1.0);
00385 
00386         EMData* rot_scale_conv_new_background_3D(float phi, float theta, float psi, float delx, float dely, float delz, Util::KaiserBessel& kb, float scale = 1.0);
00387 
00400                 float  get_pixel_conv(float delx, float dely, float delz, Util::KaiserBessel& kb);
00401                 float  get_pixel_filtered(float delx, float dely, float delz, Util::sincBlackman& kb);
00402 
00403                 float  get_pixel_conv7(float delx, float dely, float delz, Util::KaiserBessel& kb);
00404 
00405 
00418                 /*template<class Win>
00419                 float getconvpt2d(float x, float y, Win win, int size = 7);*/
00420                 float getconvpt2d_kbi0(float x, float y, Util::KaiserBessel::kbi0_win win, int size = 7);
00421 
00422 
00438 #if 0 // broken
00439                 //template<class Win>
00440                 //EMData* rotconvtrunc2d(float ang, Win win, int size = 7);
00441                 //EMData* rotconvtrunc2d_kbi0(float ang, float alpha, int size) {
00442                 //      Util::KaiserBessel kb(alpha, size-1);
00443                 //      return rotconvtrunc2d(ang, kb.get_kbi0_win(), size);
00444                 //}
00445                 EMData* rotconvtrunc2d_kbi0(float ang, float alpha, int size);
00446 
00447 
00460                 //template<class Win>
00461                 //EMData* rotconvtrunc2d(float ang, Win win, int size = 7);
00462                 //EMData* rotconvtrunc2d_kbi0(float ang, float alpha, int size) {
00463                 //      Util::KaiserBessel kb(alpha, size-1);
00464                 //      return rotconvtrunc2d(ang, kb.get_kbi0_win(), size);
00465                 //}
00466                 EMData* gridrot2d_kbi0(float ang, float alpha = 1., int size = 7) {
00467                         EMData* rot = rotconvtrunc2d_kbi0(ang, alpha, size);
00468                         Dict params;
00469                         params["dopad"] = 1;
00470                         params["alpha"] = alpha;
00471                         rot->process_inplace("filter.kaisersinhinverse", params);
00472                         return rot;
00473                 }
00474 #endif // 0
00475 
00476 
00487                 void fft_shuffle();
00488 
00489                 void pad_corner(float *pad_image);
00490 
00491                 void shuffle_pad_corner(float *pad_image);
00492 
00507                 std::complex<float> extractpoint(float xin, float yin, Util::KaiserBessel& kb);
00508 
00509 
00524                 EMData* extract_plane(const Transform& tf, Util::KaiserBessel& kb);
00525                 EMData* extract_plane_rect(const Transform& tf, Util::KaiserBessel& kbx, Util::KaiserBessel& kby, Util::KaiserBessel& kbz);
00526                 EMData* extract_plane_rect_fast(const Transform& tf, Util::KaiserBessel& kbx, Util::KaiserBessel& kby, Util::KaiserBessel& kbz);
00527 
00528                 EMData* fouriergridrot2d(float ang, float scale, Util::KaiserBessel& kb);
00529 
00530                 EMData* fouriergridrot_shift2d(float ang, float sx, float sy, Util::KaiserBessel& kb);
00531 
00532 
00542                 void divkbsinh(const Util::KaiserBessel& kb);
00543                 void divkbsinh_rect(const Util::KaiserBessel& kbx, const Util::KaiserBessel& kby, const Util::KaiserBessel& kbz);
00544 
00545 
00557                 //  OBSOLETED  Dict masked_stats(const EMData* mask);
00558 
00559 
00574                 vector<float> peak_search(int ml, float invert);
00575 
00580                 vector<float> phase_cog();
00581 
00582                 float find_3d_threshold(float mass, float pixel_size);
00583 
00584 
00588                 vector<float> peak_ccf(float hf_p);
00589 
00590                 /* pixel power operation function */
00591                 EMData* get_pow(float n_pow);
00592 
00593                 /* pixel conjugate operation function */
00594                 EMData* conjg();
00595 
00596                 private:
00597                 //utility function for peak_search()
00598                 static bool peakcmp(const Pixel& p1, const Pixel& p2);
00599                 public:
00600                 EMData* extractline(Util::KaiserBessel& kb,float nuxnew,float nuynew);
00601 
00612                 EMData* delete_disconnected_regions(int ix=0, int iy=0, int iz=0);
00613 
00625                 EMData* helicise(float pixel_size, float dp, float dphi, float section_use = 1.0f, float radius = -1.0f, float minrad = -1.0f);
00626                 EMData* helicise_rect(float pixel_size, float dp, float dphi, float section_use = 1.0f, float radius = -1.0f, float minrad = -1.0f);
00627 
00628 
00629 
00630 
00640         void depad();
00641 
00651         void depad_corner();
00652 
00667         EMData* norm_pad(bool do_norm, int npad = 1, int valtype=0);
00668 
00669         void center_origin();
00670 
00671         void center_origin_yz();
00672 
00676         void center_origin_fft();
00677 
00678 
00679         EMData* FourInterpol(int nxni, int nyni=0, int nzni=0, bool RetReal = true);
00680 
00690         EMData* FourTruncate(int nxni, int nyni=0, int nzni=0, bool RetReal = true);
00691         //EMData* FourInterpol_i(int nxni, int nyni=0, int nzni=0, bool RetReal = true);
00692         EMData* Four_ds(int nxni, int nyni=0, int nzni=0, bool RetReal = true);
00693         EMData* Four_shuf_ds_cen_us(int nxni, int nyni=0, int nzni=0, bool RetReal = true);
00694 
00695 
00696         EMData* filter_by_image(EMData* image, bool RetReal = true);
00697 
00698         EMData* replace_amplitudes(EMData* image, bool RetReal = true);
00699 
00700 #endif  //emdata__sparx_h__

Generated on Thu Dec 9 13:45:45 2010 for EMAN2 by  doxygen 1.3.9.1