00001
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036 #ifndef emdata__sparx_h__
00037 #define emdata__sparx_h__
00038
00039 public:
00047 EMData *real2FH(float OverSamplekB);
00051 EMData *copy_empty_head() const;
00060 EMData *FH2F(int Size, float OverSamplekB, int IntensityFlag =0);
00061
00070 EMData *FH2Real(int Size, float OverSamplekB, int IntensityFlag =0);
00071
00072
00077 EMData* rotavg();
00078
00083 EMData* rotavg_i();
00084
00090 EMData* mult_radial(EMData* radial);
00091
00097 vector<float> cog();
00098
00099
00118 vector <float> calc_fourier_shell_correlation(EMData * with, float w = 1.0f);
00119
00124 EMData* average_circ_sub() const;
00125
00126
00136 void onelinenn(int j, int n, int n2, EMData* wptr, EMData* bi, const Transform& tf);
00137
00138 void onelinenn_mult(int j, int n, int n2, EMData* wptr, EMData* bi, const Transform& tf, int mult);
00139
00148 void nn(EMData* wptr, EMData* myfft, const Transform& tf, int mult=1);
00149 void insert_rect_slice( EMData* w, EMData* myfft,const Transform& trans, int sizeofprojection, float xratio, float yratio, float zratio, int npad, int mult);
00150
00161 void nn_SSNR(EMData* wptr, EMData* wptr2, EMData* myfft, const Transform& tf, int mult=1);
00162
00174
00175 void nn_SSNR_ctf(EMData* wptr, EMData* wptr2, EMData* wptr3, EMData* myfft, const Transform& tf, int mult=1);
00176
00182
00189 void symplane0(EMData* norm);
00190
00197 void symplane1(EMData* norm, EMData* norm2);
00198
00206 void symplane2(EMData* norm, EMData* norm2, EMData* norm3);
00207
00218 void onelinenn_ctf(int j, int n, int n2, EMData* w, EMData* bi, const Transform& tf, int mult);
00219
00228 void nn_ctf(EMData* w, EMData* myfft, const Transform& tf, int mult);
00232 void insert_rect_slice_ctf( EMData* w, EMData* myfft,const Transform& trans, int sizeofprojection, float xratio, float yratio, float zratio, int npad, int mult);
00233 void insert_rect_slice_ctf_applied(EMData* w, EMData* myfft, const Transform& trans, int sizeofprojection, float xratio, float yratio, float zratio, int npad,int mult);
00234
00235
00247 void onelinenn_ctf_applied(int j, int n, int n2, EMData* w, EMData* bi, const Transform& tf, int mult);
00248
00258 void nn_ctf_applied(EMData* w, EMData* myfft, const Transform& tf, int mult );
00259
00265 void symplane0_ctf(EMData* w);
00266 void symplane0_rect(EMData* w);
00267
00268
00275 EMData* symvol(string symmetry);
00276
00277
00291 EMData* rot_scale_trans2D(float ang, float delx = 0.0f, float dely = 0.0f, float scale = 1.0f);
00292
00309 EMData* rot_scale_trans2D_background(float ang, float delx = 0.0f, float dely = 0.0f, float scale = 1.0f);
00310
00320 EMData* rot_scale_trans(const Transform &RA);
00321
00334 EMData* rot_scale_trans_background(const Transform &RA);
00335
00336
00337
00338
00339 static inline float restrict1(float x, int nx) {
00340 while ( x < 0.0f ) x += nx;
00341 while ( x >= (float)(nx) ) x -= nx;
00342 return x;
00343 }
00344
00345
00346
00347
00348 static inline float restrict2(float x, int nx) {
00349 while ( x >= (float)(nx) ) x -= nx;
00350 while ( x <= -(float)(nx) ) x += nx;
00351 return x;
00352 }
00353
00354
00355
00361
00362 float cm_euc(EMData* sinoj, int n1, int n2);
00363
00378 EMData* rot_scale_conv(float ang, float delx, float dely, Util::KaiserBessel& kb, float scale = 1.0);
00379
00380 EMData* downsample(Util::sincBlackman& kb, float scale = 1.0);
00381
00382 EMData* rot_scale_conv7(float ang, float delx, float dely, Util::KaiserBessel& kb, float scale_input);
00383
00384 EMData* rot_scale_conv_new(float ang, float delx, float dely, Util::KaiserBessel& kb, float scale = 1.0);
00385
00386 EMData* rot_scale_conv_new_background(float ang, float delx, float dely, Util::KaiserBessel& kb, float scale = 1.0);
00387
00388 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, bool wrap = false);
00389
00390 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, bool wrap = false);
00391
00404 float get_pixel_conv(float delx, float dely, float delz, Util::KaiserBessel& kb);
00405 float get_pixel_filtered(float delx, float dely, float delz, Util::sincBlackman& kb);
00406
00407 float get_pixel_conv7(float delx, float dely, float delz, Util::KaiserBessel& kb);
00408
00409
00422
00423
00424 float getconvpt2d_kbi0(float x, float y, Util::KaiserBessel::kbi0_win win, int size = 7);
00425
00426
00442 #if 0 // broken
00443
00444
00445
00446
00447
00448
00449 EMData* rotconvtrunc2d_kbi0(float ang, float alpha, int size);
00450
00451
00464
00465
00466
00467
00468
00469
00470 EMData* gridrot2d_kbi0(float ang, float alpha = 1., int size = 7) {
00471 EMData* rot = rotconvtrunc2d_kbi0(ang, alpha, size);
00472 Dict params;
00473 params["dopad"] = 1;
00474 params["alpha"] = alpha;
00475 rot->process_inplace("filter.kaisersinhinverse", params);
00476 return rot;
00477 }
00478 #endif // 0
00479
00480
00491 void fft_shuffle();
00492
00493 void pad_corner(float *pad_image);
00494
00495 void shuffle_pad_corner(float *pad_image);
00496
00511 std::complex<float> extractpoint(float xin, float yin, Util::KaiserBessel& kb);
00512
00513
00528 EMData* extract_plane(const Transform& tf, Util::KaiserBessel& kb);
00529 EMData* extract_plane_rect(const Transform& tf, Util::KaiserBessel& kbx, Util::KaiserBessel& kby, Util::KaiserBessel& kbz);
00530 EMData* extract_plane_rect_fast(const Transform& tf, Util::KaiserBessel& kbx, Util::KaiserBessel& kby, Util::KaiserBessel& kbz);
00531
00532 EMData* fouriergridrot2d(float ang, float scale, Util::KaiserBessel& kb);
00533
00534 EMData* fouriergridrot_shift2d(float ang, float sx, float sy, Util::KaiserBessel& kb);
00535
00536
00546 void divkbsinh(const Util::KaiserBessel& kb);
00547 void divkbsinh_rect(const Util::KaiserBessel& kbx, const Util::KaiserBessel& kby, const Util::KaiserBessel& kbz);
00548
00549
00561
00562
00563
00578 vector<float> peak_search(int ml, float invert);
00579
00584 vector<float> phase_cog();
00585
00586 float find_3d_threshold(float mass, float pixel_size);
00587
00588
00592 vector<float> peak_ccf(float hf_p);
00593
00594
00595 EMData* get_pow(float n_pow);
00596
00597
00598 EMData* conjg();
00599
00600 private:
00601
00602 static bool peakcmp(const Pixel& p1, const Pixel& p2);
00603 public:
00604 EMData* extractline(Util::KaiserBessel& kb,float nuxnew,float nuynew);
00605
00616 EMData* delete_disconnected_regions(int ix=0, int iy=0, int iz=0);
00617
00629 EMData* helicise(float pixel_size, float dp, float dphi, float section_use = 1.0f, float radius = -1.0f, float minrad = -1.0f);
00630 EMData* helicise_grid(float pixel_size, float dp, float dphi, Util::KaiserBessel& kb, float section_use = 1.0f, float radius = -1.0f, float minrad = -1.0f);
00631
00641 void depad();
00642
00652 void depad_corner();
00653
00668 EMData* norm_pad(bool do_norm, int npad = 1, int valtype=0);
00669
00670 void center_origin();
00671
00672 void center_origin_yz();
00673
00677 void center_origin_fft();
00678
00679
00680 EMData* FourInterpol(int nxni, int nyni=0, int nzni=0, bool RetReal = true);
00681
00691 EMData* FourTruncate(int nxni, int nyni=0, int nzni=0, bool RetReal = true);
00692
00693 EMData* Four_ds(int nxni, int nyni=0, int nzni=0, bool RetReal = true);
00694 EMData* Four_shuf_ds_cen_us(int nxni, int nyni=0, int nzni=0, bool RetReal = true);
00695
00696
00697 EMData* filter_by_image(EMData* image, bool RetReal = true);
00698
00699 EMData* replace_amplitudes(EMData* image, bool RetReal = true);
00700
00701 #endif //emdata__sparx_h__