Xmipp  v3.23.11-Nereus
angular_discrete_assign.h
Go to the documentation of this file.
1 /***************************************************************************
2  *
3  * Authors: Carlos Oscar coss@cnb.csic.es (2002)
4  *
5  * Unidad de Bioinformatica of Centro Nacional de Biotecnologia , CSIC
6  *
7  * This program is free software; you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation; either version 2 of the License, or
10  * (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program; if not, write to the Free Software
19  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
20  * 02111-1307 USA
21  *
22  * All comments concerning this program package may be sent to the
23  * e-mail address 'xmipp@cnb.csic.es'
24  ***************************************************************************/
25 #ifndef _PROG_ANGULAR_PREDICT
26 #define _PROG_ANGULAR_PREDICT
27 
29 #include "core/matrix1d.h"
30 #include "core/multidim_array.h"
31 #include "core/metadata_vec.h"
32 #include "angular_distance.h"
33 
34 template<typename T>
35 class Image;
36 
42 {
43 public:
55  double psi_step;
59  double shift_step;
62  double th_discard;
64  int smin;
66  int smax;
73  int pick;
74 #define TELL_ROT_TILT 1
75 #define TELL_PSI_SHIFT 2
76 #define TELL_OPTIONS 4
77 
78  int tell;
82  bool search5D;
83 public:
84  // Number of subbands
85  int SBNo;
86  // Subband size
88  // Selfile with the reference projections
90  // Mask disitribution of DWT coefficients.
91  // It is created when the training sets
93  // Vector with all the DWT coefficients of the
94  // library
95  std::vector<MultidimArray<double>> library;
96  // Vector with all the names of the library images
97  std::vector<FileName> library_name;
98  // Power of the library images at different
99  // subbands
101  // Vector with the rotational angles of the library
102  std::vector<double> rot;
103  // Vector with the tilting angles of the library
104  std::vector<double> tilt;
105  // Parameters for computing distances
107 public:
110 
112  void readParams();
113 
115  void show();
116 
118  void defineParams();
119 
121  void preProcess();
122 
124  void postProcess();
125 
127  void produce_library();
128 
137  bool * candidate_list, std::vector<double> &cumulative_corr,
138  std::vector<double> &sumxy);
139 
146  Matrix1D<double> &dwt, bool * candidate_list,
147  std::vector<double> &cumulative_corr,
148  Matrix1D<double> &x_power,
149  std::vector<double> &sumxy, double th = 50);
150 
154  double evaluate_candidates(const std::vector<double> &vscore,
155  const std::vector<int> &candidate_idx, std::vector<double> &candidate_rate,
156  double weight);
157 
161  void group_views(const std::vector<double> &vrot,
162  const std::vector<double> &vtilt, const std::vector<double> &vpsi,
163  const std::vector<int> &best_idx, const std::vector<int> &candidate_idx,
164  std::vector< std::vector<int> > &groups);
165 
170  int pick_view(int method,
171  std::vector< std::vector<int> > &groups,
172  std::vector<double> &vscore,
173  const std::vector<int> &candidate_idx, const std::vector<double> &candidate_rates);
174 
181  double &assigned_rot, double &assigned_tilt, int &best_ref_idx);
182 
187  void processImage(const FileName &fnImg, const FileName &fnImgOut, const MDRow &rowIn, MDRow &rowOut);
188 
191 // void postProcess();
192 };
194 #endif
void processImage(const FileName &fnImg, const FileName &fnImgOut, const MDRow &rowIn, MDRow &rowOut)
void group_views(const std::vector< double > &vrot, const std::vector< double > &vtilt, const std::vector< double > &vpsi, const std::vector< int > &best_idx, const std::vector< int > &candidate_idx, std::vector< std::vector< int > > &groups)
int pick_view(int method, std::vector< std::vector< int > > &groups, std::vector< double > &vscore, const std::vector< int > &candidate_idx, const std::vector< double > &candidate_rates)
void refine_candidate_list_with_correlation(int m, Matrix1D< double > &dwt, bool *candidate_list, std::vector< double > &cumulative_corr, Matrix1D< double > &x_power, std::vector< double > &sumxy, double th=50)
void build_ref_candidate_list(const Image< double > &I, bool *candidate_list, std::vector< double > &cumulative_corr, std::vector< double > &sumxy)
void readParams()
Read argument from command line.
std::vector< MultidimArray< double > > library
double evaluate_candidates(const std::vector< double > &vscore, const std::vector< int > &candidate_idx, std::vector< double > &candidate_rate, double weight)
ProgAngularDiscreteAssign()
Empty constructor.
int m
std::vector< FileName > library_name
double predict_rot_tilt_angles(Image< double > &I, double &assigned_rot, double &assigned_tilt, int &best_ref_idx)
MultidimArray< double > library_power