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:
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
00156 void nn_SSNR(EMData* wptr, EMData* wptr2, EMData* myfft, const Transform& tf, int mult=1);
00157
00169
00170 void nn_SSNR_ctf(EMData* wptr, EMData* wptr2, EMData* wptr3, EMData* myfft, const Transform& tf, int mult=1);
00171
00177
00184 void symplane0(EMData* norm);
00185
00192 void symplane1(EMData* norm, EMData* norm2);
00193
00201 void symplane2(EMData* norm, EMData* norm2, EMData* norm3);
00202
00213 void onelinenn_ctf(int j, int n, int n2, EMData* w, EMData* bi, const Transform& tf, int mult);
00214
00223 void nn_ctf(EMData* w, EMData* myfft, const Transform& tf, int mult);
00224
00236 void onelinenn_ctf_applied(int j, int n, int n2, EMData* w, EMData* bi, const Transform& tf, int mult);
00237
00247 void nn_ctf_applied(EMData* w, EMData* myfft, const Transform& tf, int mult );
00248
00254 void symplane0_ctf(EMData* w);
00255
00256
00263 EMData* symvol(string symmetry);
00264
00265
00279 EMData* rot_scale_trans2D(float ang, float delx = 0.0f, float dely = 0.0f, float scale = 1.0f);
00280
00297 EMData* rot_scale_trans2D_background(float ang, float delx = 0.0f, float dely = 0.0f, float scale = 1.0f);
00298
00308 EMData* rot_scale_trans(const Transform &RA);
00309
00322 EMData* rot_scale_trans_background(const Transform &RA);
00323
00324
00325
00326
00327 static inline float restrict1(float x, int nx) {
00328 while ( x < 0.0f ) x += nx;
00329 while ( x >= (float)(nx) ) x -= nx;
00330 return x;
00331 }
00332
00333
00334
00335
00336 static inline float restrict2(float x, int nx) {
00337 while ( x >= (float)(nx) ) x -= nx;
00338 while ( x <= -(float)(nx) ) x += nx;
00339 return x;
00340 }
00341
00342
00343
00349
00350 float cm_euc(EMData* sinoj, int n1, int n2);
00351
00366 EMData* rot_scale_conv(float ang, float delx, float dely, Util::KaiserBessel& kb, float scale = 1.0);
00367
00368 EMData* downsample(Util::sincBlackman& kb, float scale = 1.0);
00369
00370 EMData* rot_scale_conv7(float ang, float delx, float dely, Util::KaiserBessel& kb, float scale_input);
00371
00372 EMData* rot_scale_conv_new(float ang, float delx, float dely, Util::KaiserBessel& kb, float scale = 1.0);
00373
00374 EMData* rot_scale_conv_new_background(float ang, float delx, float dely, Util::KaiserBessel& kb, float scale = 1.0);
00375
00388 float get_pixel_conv(float delx, float dely, float delz, Util::KaiserBessel& kb);
00389 float get_pixel_filtered(float delx, float dely, float delz, Util::sincBlackman& kb);
00390
00391 float get_pixel_conv7(float delx, float dely, float delz, Util::KaiserBessel& kb);
00392
00393
00406
00407
00408 float getconvpt2d_kbi0(float x, float y, Util::KaiserBessel::kbi0_win win, int size = 7);
00409
00410
00426 #if 0 // broken
00427
00428
00429
00430
00431
00432
00433 EMData* rotconvtrunc2d_kbi0(float ang, float alpha, int size);
00434
00435
00448
00449
00450
00451
00452
00453
00454 EMData* gridrot2d_kbi0(float ang, float alpha = 1., int size = 7) {
00455 EMData* rot = rotconvtrunc2d_kbi0(ang, alpha, size);
00456 Dict params;
00457 params["dopad"] = 1;
00458 params["alpha"] = alpha;
00459 rot->process_inplace("filter.kaisersinhinverse", params);
00460 return rot;
00461 }
00462 #endif // 0
00463
00464
00475 void fft_shuffle();
00476
00477 void pad_corner(float *pad_image);
00478
00479 void shuffle_pad_corner(float *pad_image);
00480
00495 std::complex<float> extractpoint(float xin, float yin, Util::KaiserBessel& kb);
00496
00497
00512 EMData* extract_plane(const Transform& tf, Util::KaiserBessel& kb);
00513
00514 EMData* fouriergridrot2d(float ang, float scale, Util::KaiserBessel& kb);
00515
00516 EMData* fouriergridrot_shift2d(float ang, float sx, float sy, Util::KaiserBessel& kb);
00517
00518
00528 void divkbsinh(const Util::KaiserBessel& kb);
00529
00530
00542
00543
00544
00559 vector<float> max_search();
00560 vector<float> peak_search(int ml, float invert);
00561
00566 vector<float> phase_cog();
00567
00568 float find_3d_threshold(float mass, float pixel_size);
00569
00570
00574 vector<float> peak_ccf(float hf_p);
00575
00576
00577 EMData* get_pow(float n_pow);
00578
00579
00580 EMData* conjg();
00581
00582 private:
00583
00584 static bool peakcmp(const Pixel& p1, const Pixel& p2);
00585 public:
00586 EMData* extractline(Util::KaiserBessel& kb,float nuxnew,float nuynew);
00587
00598 EMData* delete_disconnected_regions(int ix=0, int iy=0, int iz=0);
00599
00611 EMData* helicise(float pixel_size, float dp, float dphi, float section_use = 1.0f, float radius = -1.0f, float minrad = -1.0f);
00612
00613
00614
00615
00625 void depad();
00626
00636 void depad_corner();
00637
00652 EMData* norm_pad(bool do_norm, int npad = 1, int valtype=0);
00653
00654 void center_origin();
00655
00656 void center_origin_yz();
00657
00661 void center_origin_fft();
00662
00663
00664 EMData* FourInterpol(int nxni, int nyni=0, int nzni=0, bool RetReal = true);
00665
00675 EMData* FourTruncate(int nxni, int nyni=0, int nzni=0, bool RetReal = true);
00676
00677 EMData* Four_ds(int nxni, int nyni=0, int nzni=0, bool RetReal = true);
00678 EMData* Four_shuf_ds_cen_us(int nxni, int nyni=0, int nzni=0, bool RetReal = true);
00679
00680
00681 EMData* filter_by_image(EMData* image, bool RetReal = true);
00682
00683 EMData* replace_amplitudes(EMData* image, bool RetReal = true);
00684
00685 #endif //emdata__sparx_h__