Xmipp  v3.23.11-Nereus
nma_alignment.h
Go to the documentation of this file.
1 /***************************************************************************
2  *
3  * Authors: Slavica Jonic slavica.jonic@impmc.upmc.fr
4  * Carlos Oscar coss@cnb.uam.es
5  *
6  * This program is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; either version 2 of the License, or
9  * (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program; if not, write to the Free Software
18  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
19  * 02111-1307 USA
20  *
21  * All comments concerning this program package may be sent to the
22  * e-mail address 'xmipp@cnb.uam.es'
23  ***************************************************************************/
24 
25 #ifndef _PROG_NMA_ALIGNMENT
26 #define _PROG_NMA_ALIGNMENT
27 
29 #include "core/matrix1d.h"
30 #include "core/metadata_vec.h"
32 #include "core/rerunable_program.h"
33 
34 class ProgPdbConverter;
35 
41 {
42 public:
44  bool MPIversion;
45 
47  bool resume;
48 
51 
54 
57 
60 
62  double sampling_rate;
63 
66 
69 
71  bool projMatch;
72 
74  double discrAngStep;
75 
78 
81 
84 
87 
90 
93 
95  double sigmaGaussian;
96 
97 public:
98 
99  // Random generator seed
100  int rangen;
101 
102  // All estimated parameters (with the cost)
104 
105  // Trial parameters
107 
108  // Best trial parameters
110 
111  // Best fitness
113 
114  // Number of modes
116 
117  // Size of the images in the selfile
118  int imgSize;
119 
120  // Current image being considered
122 
123  // Current stage of optimization
125 
126  // Solution of the first stage
128 
129  // Temporary document file
131 
132  // Template for temporal filename generation
133  char nameTemplate[256];
134 
135  // Volume from PDB
137 
138 public:
141 
144 
146  void defineParams();
147 
149  void readParams();
150 
152  void show();
153 
155  FileName createDeformedPDB(int pyramidLevel) const;
156 
160  void performCompleteSearch(const FileName &fnRandom,
161  int pyramidLevel) const;
162 
166  double performContinuousAssignment(const FileName &fnRandom, int pyramidLevel) const;
167 
169  double computeFitness(Matrix1D<double> &trial) const;
170 
172  void updateBestFit(double fitness);
173 
176  virtual void preProcess();
178  virtual void processImage(const FileName &fnImg, const FileName &fnImgOut, const MDRow &rowIn, MDRow &rowOut);
179 
181  virtual void finishProcessing();
182 
184  virtual void writeImageParameters(const FileName &fnImg);
185 
186  protected:
187  virtual void createWorkFiles() {
188  return Rerunable::createWorkFiles(resume, getInputMd());
189  }
190 
191  private:
193 
194  std::vector<MDLabel> getLabelsForEmpty() override {
195  return std::vector<MDLabel>{MDL_IMAGE, MDL_ENABLED, MDL_ANGLE_ROT,
198  }
199 };
200 
202 {
203  public:
204  ObjFunc_nma_alignment(int _t, int _n=0);
206  double eval(Vector v, int *nerror=nullptr);
207 };
208 
210 #endif
void readParams()
Read arguments from command line.
Rotation angle of an image (double,degrees)
Matrix1D< double > trial_best
~ProgNmaAlignment()
Destructor.
double sigmaGaussian
Gaussian standard deviation for pseudo-atoms.
Definition: nma_alignment.h:95
double cutoff_LPfilter
Low-pass cut-off frequency.
Definition: nma_alignment.h:89
MetaDataVec DF_out
Definition: Vector.h:37
Tilting angle of an image (double,degrees)
double gaussian_Real_sigma
Sigma of Gaussian weigthing in real space for spline interpolation in Fourier space (parameter of cen...
Definition: nma_alignment.h:80
Shift for the image in the X axis (double)
void defineParams()
Define params.
Matrix1D< double > parameters
Special label to be used when gathering MDs in MpiMetadataPrograms.
bool do_centerPDB
Center the PDB structure.
Definition: nma_alignment.h:68
double discrAngStep
Angular sampling step for computing the reference projections for global matching.
Definition: nma_alignment.h:74
double gaussian_DFT_sigma
Sigma of Gaussian weigthing in Fourier space (parameter of central-slice method)
Definition: nma_alignment.h:77
bool projMatch
Real-space instead of wavelet-space (default) projection matching (global matching) that is refined b...
Definition: nma_alignment.h:71
virtual void createWorkFiles()
FileName createDeformedPDB(int pyramidLevel) const
Is this image enabled? (int [-1 or 1])
double computeFitness(Matrix1D< double > &trial) const
bool do_FilterPDBVol
Low-pass filter the volume from PDB.
Definition: nma_alignment.h:86
double sampling_rate
Pixel size in Angstroms.
Definition: nma_alignment.h:62
ProgPdbConverter * progVolumeFromPDB
char nameTemplate[256]
virtual void createWorkFiles(bool resume, MetaData *md)
Matrix1D< double > trial
Matrix1D< double > bestStage1
Cost for the image (double)
ProgNmaAlignment()
Empty constructor.
virtual void processImage(const FileName &fnImg, const FileName &fnImgOut, const MDRow &rowIn, MDRow &rowOut)
Normal mode displacements (vector double)
FileName fnOutDir
Output directory.
Definition: nma_alignment.h:53
double performContinuousAssignment(const FileName &fnRandom, int pyramidLevel) const
virtual void preProcess()
double weight_zero_freq
Zero-frequency weight (parameter of central-slice method)
Definition: nma_alignment.h:83
void show()
Show.
virtual void writeImageParameters(const FileName &fnImg)
FileName fnmask
Mask file for 2D masking of the projections of the deformed volume.
Definition: nma_alignment.h:65
FileName currentImgName
double trustradius_scale
Positive scaling factor to scale the initial trust region radius.
Definition: nma_alignment.h:59
Matrix1D< double > fitness_min
FileName fnPDB
Reference atomic or pseudo-atomic structure in PDB format.
Definition: nma_alignment.h:50
bool useFixedGaussian
Use pseudo-atoms instead of atoms.
Definition: nma_alignment.h:92
void updateBestFit(double fitness)
Shift for the image in the Y axis (double)
FileName fnModeList
File with a list of mode filenames.
Definition: nma_alignment.h:56
Name of an image (std::string)
double fitness(double *p)
virtual void finishProcessing()
void performCompleteSearch(const FileName &fnRandom, int pyramidLevel) const