Xmipp  v3.23.11-Nereus
nma_alignment_vol.h
Go to the documentation of this file.
1 /***************************************************************************
2  *
3  * Authors: Carlos Oscar coss@cnb.csic.es
4  *
5  * This program is free software; you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License as published by
7  * the Free Software Foundation; either version 2 of the License, or
8  * (at your option) any later version.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with this program; if not, write to the Free Software
17  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
18  * 02111-1307 USA
19  *
20  * All comments concerning this program package may be sent to the
21  * e-mail address 'xmipp@cnb.uam.es'
22  ***************************************************************************/
23 
24 #ifndef _PROG_NMA_ALIGNMENT
25 #define _PROG_NMA_ALIGNMENT
26 
28 #include "core/matrix1d.h"
29 #include "core/xmipp_image.h"
31 #include "core/rerunable_program.h"
32 
33 class ProgPdbConverter;
34 
40 {
41 public:
43  bool MPIversion;
44 
46  bool resume;
47 
50 
53 
56 
59 
61  double sampling_rate;
62 
65 
68 
71 
74 
77 
79  double sigmaGaussian;
80 
83 
86  double rhoStartBase;
87  double rhoEndBase;
88  int niter;
89 
90  // starting and ending tilt angles for compensating for a single tilt wedge mask for tomography data
91  int tilt0, tiltF;
92 
93  // maximum search frequency and shift while rigid body alignment
94  double frm_freq;
95  int frm_shift;
96 
97 
98 public:
99 
100  // Random generator seed
101  int rangen;
102 
103  // All estimated parameters (with the cost)
105 
106  // Trial parameters
108 
109  // Best trial parameters
111 
112  // Best fitness
113  double fitness_min;
114 
115  // Number of modes
117 
118  // Size of the volumes in the selfile
119  int imgSize;
120 
121  // Current volume being considered
123 
124  // Template for temporal filename generation
125  char nameTemplate[256];
126 
127  // Volume from PDB
129 
130  // Volume that is being fitted
132 
133  // Mask
135 
136  // for fetching the rigid-body alignment parameters for each volume
139  float fit_value;
140 
141  // flag indicates if there is a compensation for the missing wedge (volumes are rotated by 90 degrees about y axis for this purpose)
142  bool flip = false;
143 
144 public:
147 
150 
152  void defineParams();
153 
155  void readParams();
156 
158  void show();
159 
161  FileName createDeformedPDB() const;
162 
164  double computeFitness(Matrix1D<double> &trial) const;
165 
167  bool updateBestFit(double fitness);
168 
171  virtual void preProcess();
173  virtual void processImage(const FileName &fnImg, const FileName &fnImgOut, const MDRow &rowIn, MDRow &rowOut);
174 
176  virtual void finishProcessing();
177 
179  virtual void writeVolumeParameters(const FileName &fnImg);
180 
181 
182  protected:
183  virtual void createWorkFiles() {
184  return Rerunable::createWorkFiles(resume, getInputMd());
185  }
186 
187  private:
189 
190  std::vector<MDLabel> getLabelsForEmpty() override {
191  return std::vector<MDLabel>{MDL_IMAGE, MDL_ENABLED, MDL_IMAGE,
195  MDL_ANGLE_Y};
196  }
197 };
198 
200 {
201  public:
202  ObjFunc_nma_alignment_vol(int _t, int _n=0);
204  double eval(Vector v, int *nerror=nullptr);
205 };
206 
207 #endif
void readParams()
Read arguments from command line.
Rotation angle of an image (double,degrees)
FileName fnOutPDB
Output PDB.
void defineParams()
Define params.
FileName fnOutDir
Output directory.
virtual void processImage(const FileName &fnImg, const FileName &fnImgOut, const MDRow &rowIn, MDRow &rowOut)
ProgNmaAlignmentVol()
Empty constructor.
bool do_FilterPDBVol
Low-pass filter the volume from PDB.
Definition: Vector.h:37
Tilting angle of an image (double,degrees)
double sampling_rate
Pixel size in Angstroms.
FileName fnPDB
Reference atomic or pseudo-atomic structure in PDB format.
Shift for the image in the X axis (double)
FileName fnModeList
File with a list of mode filenames.
Special label to be used when gathering MDs in MpiMetadataPrograms.
bool updateBestFit(double fitness)
FileName fnmask
Mask file for 2D masking of the projections of the deformed volume.
Is this image enabled? (int [-1 or 1])
Matrix1D< double > parameters
virtual void writeVolumeParameters(const FileName &fnImg)
double computeFitness(Matrix1D< double > &trial) const
virtual void createWorkFiles(bool resume, MetaData *md)
bool do_centerPDB
Center the PDB structure.
double trustradius_scale
Parameters required from the CONDOR optimization.
Angle between y-axis and tilt-axis (double, degrees) for untilted micrographs.
FileName createDeformedPDB() const
~ProgNmaAlignmentVol()
Destructor.
bool useFixedGaussian
Use pseudo-atoms instead of atoms.
Normal mode displacements (vector double)
Matrix1D< double > trial_best
Maximum cross-correlation for the image (double)
ProgPdbConverter * progVolumeFromPDB
bool alignVolumes
Align volumes.
double sigmaGaussian
Gaussian standard deviation for pseudo-atoms.
NMA energy contained in the NMA displacement vector.
Matrix1D< double > trial
Shift for the image in the Z axis (double)
double cutoff_LPfilter
Low-pass cut-off frequency.
Shift for the image in the Y axis (double)
virtual void finishProcessing()
MultidimArray< int > mask
virtual void createWorkFiles()
Name of an image (std::string)
double fitness(double *p)
Image< double > Vdeformed