Xmipp  v3.23.11-Nereus
ctf_estimate_from_psd.h
Go to the documentation of this file.
1 /***************************************************************************
2  *
3  * Authors: Javier Angel Velazquez Muriel javi@cnb.csic.es
4  * Carlos Oscar S. Sorzano (coss@cnb.csic.es)
5  *
6  * Unidad de Bioinformatica of Centro Nacional de Biotecnologia , CSIC
7  *
8  * This program is free software; you can redistribute it and/or modify
9  * it under the terms of the GNU General Public License as published by
10  * the Free Software Foundation; either version 2 of the License, or
11  * (at your option) any later version.
12  *
13  * This program is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16  * GNU General Public License for more details.
17  *
18  * You should have received a copy of the GNU General Public License
19  * along with this program; if not, write to the Free Software
20  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
21  * 02111-1307 USA
22  *
23  * All comments concerning this program package may be sent to the
24  * e-mail address 'xmipp@cnb.csic.es'
25  ***************************************************************************/
26 
27 #ifndef _CORE_ADJUST_CTF_HH
28 #define _CORE_ADJUST_CTF_HH
29 
31 #include "data/ctf.h"
32 
34 
40 {
41 public:
42 
45 
47  //Copy useful initial values in 2D taken from 1D.
49 
50 public:
51 
53  void readBasicParams(XmippProgram *program);
54 
55  void readParams();
56 
58  static void defineBasicParams(XmippProgram * program);
59 
61  void defineParams();
62 
64  void produceSideInfo();
65 
68  void generate_model_halfplane(int Ydim, int Xdim, MultidimArray<double> &model);
69 
72  void generate_model_quadrant(int Ydim, int Xdim, MultidimArray<double> &model);
73 
75  void run();
76 
77  /* Assign ctfmodel from a vector and viceversa ----------------------------- */
78  void assignCTFfromParameters(double *p, CTFDescription &ctfmodel, int ia,
79  int l, int modelSimplification);
80 
81  void assignParametersFromCTF(const CTFDescription &ctfmodel, double *p, int ia,
82  int l, int modelSimplification);
83 
84  /* Center focus ----------------------------------------------------------- */
85  void center_optimization_focus(bool adjust_freq, bool adjust_th, double margin);
86 
87  /* The model is taken from global_adjust and global_ctfmodel is modified */
88  void generateModelSoFar(Image<double> &I, bool apply_log);
89 
90  /* Compute central region -------------------------------------------------- */
91  void compute_central_region(double &w1, double &w2, double ang);
92 
93  /* Save intermediate results ----------------------------------------------- */
94  /* First call to generate model so far and then save the image, and a couple
95  of cuts along X and Y.
96  This function returns the fitting error.*/
97  void saveIntermediateResults(const FileName &fn_root, bool generate_profiles);
98 
100  double CTF_fitness_object(double *p);
101 
102  // Estimate sqrt parameters
104 
105  // Estimate first gaussian parameters ------------------------------------- */
107 
108  // Estimate second gaussian parameters ------------------------------------- */
110 
111  // Estimate envelope parameters -------------------------------------------- */
113 
114  // Estimate defoci --------------------------------------------------------- */
115  void showFirstDefoci();
116  void estimate_defoci();
117 
118  // Estimate defoci with Zernike and SPTH transform--------------------------------------------- */
119  void estimate_defoci_Zernike(const MultidimArray<double> &psdToModelFullSize, double min_freq, double max_freq, double Tm,
120  double kV, double lambdaPhase, int sizeWindowPhase,
121  double &defocusU, double &defocusV, double &ellipseAngle, int verbose);
123 };
124 
126 
130 double ROUT_Adjust_CTF(ProgCTFEstimateFromPSD &prm, CTFDescription &output_ctfmodel,
131  bool standalone = true);
133 #endif
void generate_model_quadrant(int Ydim, int Xdim, MultidimArray< double > &model)
void assignParametersFromCTF(const CTFDescription &ctfmodel, double *p, int ia, int l, int modelSimplification)
void saveIntermediateResults(const FileName &fn_root, bool generate_profiles)
int sizeWindowPhase
Size of the average window used during phase direction and unwrapping estimates (used in Zernike esti...
void assignCTFfromParameters(double *p, CTFDescription &ctfmodel, int ia, int l, int modelSimplification)
void readBasicParams(XmippProgram *program)
Read parameters.
double Tm
Sampling rate.
double evaluateIceness(const MultidimArray< double > &enhanced_ctftomodel, double Tm)
void produceSideInfo()
Produce side information.
double CTF_fitness_object(double *p)
double max_freq
Maximum frequency to adjust.
void center_optimization_focus(bool adjust_freq, bool adjust_th, double margin)
void generateModelSoFar(Image< double > &I, bool apply_log)
void compute_central_region(double &w1, double &w2, double ang)
int verbose
Verbosity level.
void generate_model_halfplane(int Ydim, int Xdim, MultidimArray< double > &model)
int modelSimplification
Model simplification.
double min_freq
Minimum frequency to adjust.
Image< double > enhanced_ctftomodel
CTF amplitude to model.
ProgClassifyCL2D * prm
double lambdaPhase
Regularization factor for the phase direction and unwrapping estimates (used in Zernike estimate) ...
void defineParams()
Define Parameters.
CTFDescription initial_ctfmodel
CTF model.
static void defineBasicParams(XmippProgram *program)
Define basic parameters.
double ROUT_Adjust_CTF(ProgCTFEstimateFromPSD &prm, CTFDescription &output_ctfmodel, bool standalone=true)