Xmipp  v3.23.11-Nereus
basic_art.h
Go to the documentation of this file.
1 /***************************************************************************
2  *
3  * Authors: Carlos Oscar S. Sorzano (coss@cnb.csic.es)
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 _BASIC_ART_HH
26 #define _BASIC_ART_HH
27 
28 #include "core/symmetries.h"
29 #include "core/xmipp_filename.h"
30 #include "core/metadata_label.h"
31 #include "data/basis.h"
33 
45 
58 struct ReconsInfo
59 {
67  double rot;
69  double tilt;
71  double psi;
76  int sym;
81  int seed;
82 };
83 
84 /* ART parameters ---------------------------------------------------------- */
89 {
90 public:
91  // Type of the parallel processing
92  typedef enum {ART, pCAV, pAVSP, pSART, pBiCAV, pSIRT, pfSIRT, SIRT } ARTParallelMode;
93 
94  /* User parameters ...................................................... */
96  Basis basis;
98 
100  int no_it;
101 
104 
109  ARTParallelMode parallel_mode;
110 
113 
117  int eq_mode;
118 
121 
123  bool dont_sort;
124 
127 
129  bool WLS;
130 
133 
135  std::vector<Projection> residual_imgs;
136 
138  double sum_weight;
139 
142 
145 
152  int proj_ext;
153 
155  double R;
156 
160 
164 
168 
170  double sampling;
171 
174 
177  int sym_each;
178 
181  double max_tilt;
182 
185 
188 
190  double sparseEps;
191 
194 
197 
200 
203 
206 
209 
211  double goldmask;
212 
215 
217  FileName fn_out, fn_root;
218 
221 
223  int stop_at;
224 
226  double known_volume;
227 
230 
232  bool unmatched;
233 
240  double ray_length;
241 
244 
247 
250 
253 
256 
258  bool refine;
259 
262 
264  bool using_MPI;
265 
267  int threads;
268 
269 #define TELL_IV 0x100
270 #define TELL_ONLY_SYM 0x80
271 #define TELL_USE_INPUT_BASISVOLUME 0x40
272 #define TELL_SHOW_ERROR 0x20
273 #define TELL_MANUAL_ORDER 0x10
274 #define TELL_SAVE_AT_EACH_STEP 0x8
275 #define TELL_SAVE_INTERMIDIATE 0x4
276 #define TELL_SAVE_BASIS 0x2
277 #define TELL_STATS 0x1
278 
311  int tell;
312 
315 
317  int verbose;
318 
322 
323  /* ART Side information ................................................. */
329  SymList SL;
331 
333  size_t projXdim;
334 
336  size_t projYdim;
337 
339  std::ofstream *fh_hist=nullptr;
340 
342  ReconsInfo *IMG_Inf=nullptr;
343 
346 
348  int numIMG;
349 
351  int trueIMG;
352 
365  Matrix2D<double> *D=nullptr;
367  Matrix2D<double> *Dinv=nullptr;
368 
371  Image<double> *surface_mask=nullptr;
372 
377 
381  GridVolumeT<int> *GVNeq=nullptr;
383 public:
384  BasicARTParameters() = default;
385  BasicARTParameters(const BasicARTParameters &)=delete;
386  BasicARTParameters(const BasicARTParameters &&)=delete;
387 
389  BasicARTParameters & operator =(const BasicARTParameters &)=delete;
390  BasicARTParameters & operator =(const BasicARTParameters &&)=delete;
391 
395  void defaultValues();
396 
399  static void defineParams(XmippProgram * program, bool mpiMode = false);
400 
403  void readParams(XmippProgram * program);
404 
405 #define BASIC 0
406 #define FULL 1
407 
423  void produceSideInfo(GridVolume &vol_basis0, int level = FULL, int rank = -1);
424 
431  void computeCAVWeights(GridVolume &vol_basis0,
432  int numProjs_node, int debug_level = 0);
433 
438  double lambda(int n)
439  {
440  int imax = VEC_XSIZE(lambda_list);
441  if (imax == 0)
442  REPORT_ERROR(ERR_MULTIDIM_SIZE, "Basic_art: There are no lambdas\n");
443  if (n >= imax)
444  return lambda_list(imax -1);
445  else
446  return lambda_list(n);
447  }
448 
453  double kappa(int n)
454  {
455  int imax = VEC_XSIZE(kappa_list);
456  if (imax == 0)
457  REPORT_ERROR(ERR_MULTIDIM_SIZE, "Basic_art: There are no kappas\n");
458  if (n >= imax)
459  return kappa_list(imax -1);
460  else
461  return kappa_list(n);
462  }
463 
465  int ProjXdim();
466 
468  int ProjYdim();
469 
470 };
472 
473 #endif
bool is_crystal
Is this a crystal 0 means NO 1 YES.
Definition: basic_art.h:252
int verbose
Verbose level.
Definition: basic_art.h:317
MDRowVec row
Header information of projection.
Definition: basic_art.h:63
bool positivity
Apply positivity constraint.
Definition: basic_art.h:246
int numIMG
Total number of images to process (taking symmetries into account)
Definition: basic_art.h:348
size_t projXdim
Projection X dimension.
Definition: basic_art.h:333
double psi
Psi angle.
Definition: basic_art.h:71
bool refine
Refine experimental projection before backprojecting.
Definition: basic_art.h:258
#define REPORT_ERROR(nerr, ErrormMsg)
Definition: xmipp_error.h:211
FileName fn_start
Grid volume as initial guess.
Definition: basic_art.h:220
#define VEC_XSIZE(m)
Definition: matrix1d.h:77
#define FULL
Definition: basic_art.h:406
bool using_MPI
Only for internal purposes, MUST be set when running MPI.
Definition: basic_art.h:264
bool do_not_use_symproj
Do not use symmetrized projections.
Definition: basic_art.h:202
double grid_relative_size
Relative size for the grid.
Definition: basic_art.h:141
FileName fn_sym
File containing symmetries.
Definition: basic_art.h:173
bool shiftedTomograms
Shifted tomograms.
Definition: basic_art.h:214
Incorrect MultidimArray size.
Definition: xmipp_error.h:174
double kappa(int n)
Definition: basic_art.h:453
FileName fn_sel
Selection file with all images to process.
Definition: basic_art.h:208
bool variability_analysis
Variability analysis.
Definition: basic_art.h:255
int save_intermidiate_every
Frequency for saving intermidiate.
Definition: basic_art.h:314
size_t projYdim
Projection Y dimension.
Definition: basic_art.h:336
double sampling
Sampling rate.
Definition: basic_art.h:170
int block_size
Number of projections for each parallel block.
Definition: basic_art.h:112
bool random_sort
True if random sort of projections.
Definition: basic_art.h:120
int grid_type
CC, BCC or FCC (in grids.hh)
Definition: basic_art.h:144
int trueIMG
Number of different images (without symmetries)
Definition: basic_art.h:351
FileName fn_surface_mask
File containing surface mask.
Definition: basic_art.h:205
double known_volume
Known volume. If -1, not applied.
Definition: basic_art.h:226
bool dont_sort
True if no sort must be made.
Definition: basic_art.h:123
Matrix1D< double > kappa_list
Definition: basic_art.h:132
double sparseEps
Sparse reconstruction.
Definition: basic_art.h:190
bool print_system_matrix
Print system matrix.
Definition: basic_art.h:249
double tilt
Tilting angle.
Definition: basic_art.h:69
bool apply_shifts
Apply shifts stored in the headers of the 2D-images.
Definition: basic_art.h:243
double goldmask
Goldmask.
Definition: basic_art.h:211
Definition: basis.h:45
int stop_at
Stop after this number of images, if 0 then don&#39;t use.
Definition: basic_art.h:223
int seed
Definition: basic_art.h:81
FileName fn_ctf
CTF filename.
Definition: basic_art.h:65
ARTParallelMode parallel_mode
Definition: basic_art.h:109
FileName fn_root
Definition: basic_art.h:217
FileName fn_proj
Projection filename.
Definition: basic_art.h:61
double ref_trans_step
Refine the translation alignement after n projection presentations.
Definition: basic_art.h:187
bool noisy_reconstruction
Noisy reconstruction.
Definition: basic_art.h:261
int force_sym
Force the reconstruction to be symmetric this number of times.
Definition: basic_art.h:196
bool unmatched
Apply unmatched projectors to correct for the CTF.
Definition: basic_art.h:232
int no_it
Number of iterations.
Definition: basic_art.h:100
MultidimArray< int > ordered_list
Order in which projections will be presented to algorithm.
Definition: basic_art.h:345
double rot
Rotational angle.
Definition: basic_art.h:67
FileName fn_control
Name of file for improved control in parallel jobs.
Definition: basic_art.h:320
int ref_trans_after
Refine the translation alignement after n projection presentations.
Definition: basic_art.h:184
int sort_last_N
Sort perpendicular with the last N projections. If -1 with all previous.
Definition: basic_art.h:126
FileName fn_ctf
Selection file with all images to process.
Definition: basic_art.h:229
double lambda(int n)
Definition: basic_art.h:438
double diffusionWeight
Tomographic diffussion.
Definition: basic_art.h:193
int threads
Number of threads to use. Can not be different than 1 when using MPI.
Definition: basic_art.h:267
int * n
std::vector< Projection > residual_imgs
Definition: basic_art.h:135
Matrix1D< double > lambda_list
Relaxation parameter.
Definition: basic_art.h:103
bool do_not_generate_subgroup
Do not generate symmetry subgroup.
Definition: basic_art.h:199