Xmipp  v3.23.11-Nereus
nma_alignment.cpp
Go to the documentation of this file.
1 /***************************************************************************
2  *
3  * Authors: Slavica Jonic slavica.jonic@impmc.upmc.fr
4  * Carlos Oscar Sanchez Sorzano coss.eps@ceu.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 #include "nma_alignment.h"
26 #include "volume_from_pdb.h"
27 #include "core/transformations.h"
28 #include "program_extension.h"
29 #include "condor/Solver.h"
30 #include <sys/stat.h>
31 
32 // Empty constructor =======================================================
34  rangen = 0;
35  resume = false;
36  currentImgName = "";
38  produces_an_output = true;
40  projMatch = false;
41 }
42 
44  delete progVolumeFromPDB;
45 }
46 
47 // Params definition ============================================================
49  addUsageLine("Align images with an atomic or pseudo-atomic (from EM volume) structure by computing deformation amplitudes along normal modes, three Euler angles, and two in-plane shifts");
50  addUsageLine("+See [[http://xmipp.cnb.csic.es/twiki/bin/view/Xmipp/Nma_alignment_v3][here]] for further information about the parameters of this program.");
51  defaultComments["-i"].clear();
52  defaultComments["-i"].addComment("Metadata with image filenames");
53  defaultComments["-o"].clear();
54  defaultComments["-o"].addComment("Metadata with output Euler angles, shifts, and deformation amplitudes");
56  addParamsLine(" --pdb <PDB_filename> : Reference atomic or pseudo-atomic structure in PDB format");
57  addParamsLine(" [--odir <outputDir=\".\">] : Output directory");
58  addParamsLine(" [--resume] : Resume processing");
59  addParamsLine("==Generation of the deformed reference volumes==");
60  addParamsLine(" --modes <filename> : File with a list of mode filenames");
61  addParamsLine(" [--sampling_rate <Ts=1>] : Pixel size in Angstroms");
62  addParamsLine(" [--filterVol <cutoff=15.>] : Filter the volume after deforming. If this option is used, the default cut-off is 15 A.");
63  addParamsLine(" [--centerPDB] : Center the PDB structure");
64  addParamsLine(" [--fixed_Gaussian <std=-1>] : For pseudo-atoms fixed_Gaussian must be used.");
65  addParamsLine(" : Default standard deviation <std> is read from the PDB file.");
66  addParamsLine("==Combined elastic and rigid-body alignment==");
67  addParamsLine(" [--trustradius_scale <s=1>] : Positive scaling factor to scale the initial trust region radius");
68  addParamsLine(" [--mask <m=\"\">] : 2D masking of the projections of the deformed volume");
69  addParamsLine(" [--projMatch] : Real-space instead of wavelet-space (default) projection matching (global matching) that is refined by local (Fourier central slice) projection matching");
70  addParamsLine(" :+Note that wavelet-based method needs the image size to be power of 2");
71  addParamsLine(" [--discrAngStep <ang=10>] : Angular sampling step for computing the reference projections for global matching");
72  addParamsLine(" [--gaussian_Fourier <s=0.5>] : Sigma of Gaussian weigthing in Fourier space (parameter of central-slice method)");
73  addParamsLine(" [--gaussian_Real <s=0.5>] : Sigma of Gaussian weigthing in real space for spline interpolation in Fourier space (parameter of central-slice method)");
74  addParamsLine(" [--zerofreq_weight <s=0.>] : Zero-frequency weight (parameter of central-slice method)");
75  addExampleLine("xmipp_nma_alignment -i images.sel --pdb 2tbv.pdb --modes modelist.xmd --trustradius_scale 1.2 --sampling_rate 3.2 -o output.xmd --resume");
76 }
77 
78 // Read arguments ==========================================================
81  fnPDB = getParam("--pdb");
82  fnOutDir = getParam("--odir");
83  Rerunable::setFileName(fnOutDir + "/nmaDone.xmd");
84  fnModeList = getParam("--modes");
85  resume = checkParam("--resume");
86  trustradius_scale = std::abs(getDoubleParam("--trustradius_scale"));
87  sampling_rate = getDoubleParam("--sampling_rate");
88  fnmask = getParam("--mask");
89  gaussian_DFT_sigma = getDoubleParam("--gaussian_Fourier");
90  gaussian_Real_sigma = getDoubleParam("--gaussian_Real");
91  weight_zero_freq = getDoubleParam("--zerofreq_weight");
92  do_centerPDB = checkParam("--centerPDB");
93  do_FilterPDBVol = checkParam("--filterVol");
94  if (do_FilterPDBVol)
95  cutoff_LPfilter = getDoubleParam("--filterVol");
96  useFixedGaussian = checkParam("--fixed_Gaussian");
97  if (useFixedGaussian)
98  sigmaGaussian = getDoubleParam("--fixed_Gaussian");
99  projMatch = checkParam("--projMatch");
100  discrAngStep = getDoubleParam("--discrAngStep");
101 }
102 
103 // Show ====================================================================
106  std::cout
107  << "Output directory: " << fnOutDir << std::endl
108  << "PDB: " << fnPDB << std::endl
109  << "Resume: " << resume << std::endl
110  << "Mode list: " << fnModeList << std::endl
111  << "Trust-region scale: " << trustradius_scale << std::endl
112  << "Pixel size: " << sampling_rate << std::endl
113  << "Mask: " << fnmask << std::endl
114  << "Center PDB: " << do_centerPDB << std::endl
115  << "Filter PDB volume: " << do_FilterPDBVol << std::endl
116  << "Use pseudo-atoms: " << useFixedGaussian << std::endl
117  << "Pseudo-atom sigma: " << sigmaGaussian << std::endl
118  << "Projection matching: " << projMatch << std::endl
119  << "AngularSamplingStep: " << discrAngStep << std::endl
120  << "Gaussian Fourier: " << gaussian_DFT_sigma << std::endl
121  << "Gaussian Real: " << gaussian_Real_sigma << std::endl
122  << "Zero-frequency weight:" << weight_zero_freq << std::endl;
123 }
124 
125 // Produce side information ================================================
127 
130  SF.removeDisabled();
131  numberOfModes = SF.size();
132  // Get the size of the images in the selfile
133  imgSize = xdimOut;
134  // Set the pointer of the program to this object
135  global_nma_prog = this;
136  //create some neededs files
137  createWorkFiles();
138 }
139 
142  rename(Rerunable::getFileName().c_str(), fn_out.c_str());
143 }
144 
145 // Create deformed PDB =====================================================
147  String program;
148  String arguments;
149  FileName fnRandom;
151  const char * randStr = fnRandom.c_str();
152 
153  program = "xmipp_pdb_nma_deform";
154  arguments = formatString(
155  "--pdb %s -o %s_deformedPDB.pdb --nma %s --deformations ",
156  fnPDB.c_str(), randStr, fnModeList.c_str());
157  for (size_t i = 0; i < VEC_XSIZE(trial) - 5; ++i)
158  arguments += floatToString(trial(i)) + " ";
159  runSystem(program, arguments, false);
160 
161  program = "xmipp_volume_from_pdb";
162  arguments = formatString(
163  "-i %s_deformedPDB.pdb --size %i --sampling %f -v 0", randStr,
165 
166  if (do_centerPDB)
167  arguments.append(" --centerPDB ");
168 
169  if (useFixedGaussian) {
170  arguments.append(" --intensityColumn Bfactor --fixed_Gaussian ");
171  if (sigmaGaussian >= 0)
172  arguments += formatString("%f",sigmaGaussian);
173  }
174  //else
175  //arguments +=" --poor_Gaussian"; // Otherwise, a detailed conversion of the atoms takes too long in this context
176 
177  progVolumeFromPDB->read(arguments);
179 
180  if (do_FilterPDBVol) {
181  program = "xmipp_transform_filter";
182  arguments = formatString(
183  "-i %s_deformedPDB.vol --sampling %f --fourier low_pass %f -v 0",
184  randStr, sampling_rate, cutoff_LPfilter);
185  runSystem(program, arguments, false);
186  }
187 
188  if (pyramidLevel != 0) {
189  Image<double> I;
190  FileName fnDeformed = formatString("%s_deformedPDB.vol",randStr);
191  I.read(fnDeformed);
193  I.write(fnDeformed);
194  }
195  return fnRandom;
196 }
197 
198 // Perform complete search =================================================
200  int pyramidLevel) const {
201  String program;
202  String arguments;
203  const char * randStr = fnRandom.c_str();
204 
205  // Reduce the image
206  FileName fnDown = formatString("%s_downimg.xmp", fnRandom.c_str());
207  if (pyramidLevel != 0) {
208  Image<double> I;
209  I.read(currentImgName);
211  I.write(fnDown);
212  } else
213  copyImage(currentImgName.c_str(), fnDown.c_str());
214 
215  mkdir((fnRandom+"_ref").c_str(), S_IRWXU);
216 
217  double angSampling=2*RAD2DEG(atan(1.0/((double) imgSize / pow(2.0, (double) pyramidLevel+1))));
218  angSampling=std::max(angSampling,discrAngStep);
219  program = "xmipp_angular_project_library";
220  arguments = formatString(
221  "-i %s_deformedPDB.vol -o %s_ref/ref.stk --sampling_rate %f -v 0",
222  randStr, randStr, angSampling);
223  if (projMatch)
224  arguments +=formatString(
225  " --compute_neighbors --angular_distance -1 --experimental_images %s_downimg.xmp", randStr);
226 
227  runSystem(program, arguments, false);
228 
229  String refSelStr = formatString("%s_ref/ref.doc", randStr);
230 
231  if (fnmask != "") {
232  program = "xmipp_transform_mask";
233  arguments = formatString("-i %s --mask binary_file %s", refSelStr.c_str(),
234  fnmask.c_str());
235  runSystem(program, arguments, false);
236  }
237 
238  // Perform alignment
239  String fnOut=formatString("%s_angledisc.xmd",randStr);
240  if (!projMatch) {
241  program = "xmipp_angular_discrete_assign";
242  arguments = formatString(
243  "-i %s_downimg.xmp --ref %s -o %s --psi_step 5 --max_shift_change %d --search5D -v 0",
244  randStr, refSelStr.c_str(), fnOut.c_str(), (int)round((double) imgSize / (10.0 * pow(2.0, (double) pyramidLevel))));
245  } else {
246  String refStkStr = formatString("%s_ref/ref.stk", randStr);
247  program = "xmipp_angular_projection_matching";
248  arguments = formatString(
249  "-i %s_downimg.xmp --ref %s -o %s --search5d_step 1 --search5d_shift %d -v 0",
250  randStr, refStkStr.c_str(), fnOut.c_str(), (int)round((double) imgSize / (10.0 * pow(2.0, (double) pyramidLevel))));
251  }
252  runSystem(program, arguments, false);
253  if (projMatch)
254  {
255  MetaDataVec MD;
256  MD.read(fnOut);
257  bool flip;
258  size_t id=MD.firstRowId();
259  MD.getValue(MDL_FLIP,flip,id);
260  if (flip)
261  {
262  // This is because continuous assignment does not understand flips
263 
264  double shiftX, rot, tilt, psi, newrot, newtilt, newpsi;
265  // Change sign in shiftX
266  MD.getValue(MDL_SHIFT_X,shiftX,id);
267  MD.setValue(MDL_SHIFT_X,-shiftX,id);
268 
269  // Change Euler angles
270  MD.getValue(MDL_ANGLE_ROT,rot,id);
271  MD.getValue(MDL_ANGLE_TILT,tilt,id);
272  MD.getValue(MDL_ANGLE_PSI,psi,id);
273  Euler_mirrorY(rot,tilt,psi,newrot,newtilt,newpsi);
274  MD.setValue(MDL_ANGLE_ROT,newrot,id);
275  MD.setValue(MDL_ANGLE_TILT,newtilt,id);
276  MD.setValue(MDL_ANGLE_PSI,newpsi,id);
277  MD.write(fnOut);
278  }
279  }
280 }
281 
282 // Continuous assignment ===================================================
284  int pyramidLevel) const {
285  // Perform alignment
286  const char * randStr = fnRandom.c_str();
287  String fnResults=formatString("%s_anglecont.xmd", randStr);
288  bool costSource=true;
289  String program = "xmipp_angular_continuous_assign";
290  String arguments =
291  formatString(
292  "-i %s_angledisc.xmd --ref %s_deformedPDB.vol -o %s --gaussian_Fourier %f --gaussian_Real %f --zerofreq_weight %f -v 0",
293  randStr, randStr, fnResults.c_str(), gaussian_DFT_sigma,
295  runSystem(program, arguments, false);
296 
297  // Pick up results
298  MetaDataVec DF(fnResults);
299  MDRowVec row;
300  DF.getRow(row, DF.firstRowId());
305  trial(VEC_XSIZE(trial) - 2) *= pow(2.0, (double) pyramidLevel);
307  trial(VEC_XSIZE(trial) - 1) *= pow(2.0, (double) pyramidLevel);
308  double tempvar;
309  if (!costSource) {
310  row.getValue(MDL_MAXCC, tempvar);
311  tempvar = -tempvar;
312  } else
313  row.getValue(MDL_COST, tempvar);
314  return tempvar;
315 }
316 
318  if (fitness < fitness_min(0)) {
319  fitness_min(0) = fitness;
320  trial_best = trial;
321  }
322 }
323 
324 // Compute fitness =========================================================
325 double ObjFunc_nma_alignment::eval(Vector X, int *nerror) {
326  int dim = global_nma_prog->numberOfModes;
327 
328  for (int i = 0; i < dim; i++) {
329  global_nma_prog->trial(i) = X[i];
330  }
331 
332  int pyramidLevelDisc = 1;
333  int pyramidLevelCont = (global_nma_prog->currentStage == 1) ? 1 : 0;
334 
335  FileName fnRandom = global_nma_prog->createDeformedPDB(pyramidLevelCont);
336  const char * randStr = fnRandom.c_str();
337 
338  if (global_nma_prog->currentStage == 1) {
339  global_nma_prog->performCompleteSearch(fnRandom, pyramidLevelDisc);
340  } else {
341  double rot, tilt, psi, xshift, yshift;
342  MetaDataVec DF;
343 
344  rot = global_nma_prog->bestStage1(
345  VEC_XSIZE(global_nma_prog->bestStage1) - 5);
346  tilt = global_nma_prog->bestStage1(
347  VEC_XSIZE(global_nma_prog->bestStage1) - 4);
348  psi = global_nma_prog->bestStage1(
349  VEC_XSIZE(global_nma_prog->bestStage1) - 3);
350  xshift = global_nma_prog->bestStage1(
351  VEC_XSIZE(global_nma_prog->bestStage1) - 2);
352  yshift = global_nma_prog->bestStage1(
353  VEC_XSIZE(global_nma_prog->bestStage1) - 1);
354 
355  size_t objId = DF.addObject();
356  FileName fnDown = formatString("%s_downimg.xmp", randStr);
357  DF.setValue(MDL_IMAGE, fnDown, objId);
358  DF.setValue(MDL_ENABLED, 1, objId);
359  DF.setValue(MDL_ANGLE_ROT, rot, objId);
360  DF.setValue(MDL_ANGLE_TILT, tilt, objId);
361  DF.setValue(MDL_ANGLE_PSI, psi, objId);
362  DF.setValue(MDL_SHIFT_X, xshift, objId);
363  DF.setValue(MDL_SHIFT_Y, yshift, objId);
364 
365  DF.write(formatString("%s_angledisc.xmd", randStr));
366  copyImage(global_nma_prog->currentImgName.c_str(), fnDown.c_str());
367  }
368  double fitness = global_nma_prog->performContinuousAssignment(fnRandom,
369  pyramidLevelCont);
370 
371  runSystem("rm", formatString("-rf %s* &", randStr));
372 
373  global_nma_prog->updateBestFit(fitness);
374  return fitness;
375 }
376 
378 }
379 
381  const FileName &fnImgOut, const MDRow &rowIn, MDRow &rowOut) {
382  static size_t imageCounter = 0;
383  ++imageCounter;
384 
385  double rhoStart=trustradius_scale*250.;
386  double rhoEnd=trustradius_scale*50.;
387 
388  int niter=10000;
389 
390  ObjectiveFunction *of;
391 
392  int dim = numberOfModes;
393 
394  parameters.initZeros(dim + 5);
395  currentImgName = fnImg;
396  sprintf(nameTemplate, "_node%d_img%lu_XXXXXX", rangen, (long unsigned int)imageCounter);
397 
398  trial.initZeros(dim + 5);
399  trial_best.initZeros(dim + 5);
400 
402  fitness_min(0) = 1000000.0;
403 
404  currentStage = 1;
405 #ifdef DEBUG
406  std::cerr << std::endl << "DEBUG: ===== Node: " << rangen
407  <<" processing image " << fnImg <<"(" << objId << ")"
408  << " at stage: " << currentStage << std::endl;
409 #endif
410  of = new ObjFunc_nma_alignment(1, dim);
411 
412  of->xStart.setSize(dim);
413  for (int i = 0; i < dim; i++)
414  of->xStart[i] = 0.;
415 
416 #ifdef DEBUG
417  strcpy(of->name,("OF1_"+integerToString(rangen)).c_str());
418  of->setSaveFile();
419 #endif
420 
421  CONDOR(rhoStart, rhoEnd, niter, of);
422 #ifdef DEBUG
423  of->printStats();
424  FILE *ff = fopen(("res1_"+integerToString(rangen)+".xmd").c_str(),"w");
425  fprintf(ff,"%s & %i & %i & (%i) & %e \\\\\n", of->name, of->dim(), of->getNFE(), of->getNFE2(), of->valueBest);
426  fclose(ff);
427 #endif
428 
430 
431  delete of;
432 
433  currentStage = 2;
434 #ifdef DEBUG
435  std::cerr << std::endl << "DEBUG: ===== Node: " << rangen
436  <<" processing image " << fnImg <<"(" << objId << ")"
437  << " at stage: " << currentStage << std::endl;
438 #endif
439 
440  fitness_min(0) = 1000000.0;
441 
442  of = new ObjFunc_nma_alignment(1, dim);
443 
444  of->xStart.setSize(dim);
445  for (int i = 0; i < dim; i++)
446  of->xStart[i] = parameters(i);
447 #ifdef DEBUG
448  strcpy(of->name,("OF2_"+integerToString(rangen)).c_str());
449  of->setSaveFile();
450 #endif
451 
452  rhoStart=trustradius_scale*50.-1., rhoEnd=0.5;
453  CONDOR(rhoStart, rhoEnd, niter, of);
454 #ifdef DEBUG
455  of->printStats();
456  ff=fopen(("res2_"+integerToString(rangen)+".xmd").c_str(),"w");
457  fprintf(ff,"%s & %i & %i & (%i) & %e \\\\\n", of->name, of->dim(), of->getNFE(), of->getNFE2(), of->valueBest);
458  fclose(ff);
459 #endif
460 
461 #ifdef DEBUG
462  std::cout << "Best fitness = " << fitness << std::endl;
463  for (int i=0; i<dim; i++)
464  {
465  std::cout << "Best deformations = " << dd[i] << std::endl;
466  }
467 #endif
468 
469  trial = trial_best;
470 
471  for (int i = dim; i < dim + 5; i++) {
472  parameters(i - dim) = trial_best(i);
473  }
474 
475  for (int i = 0; i < dim; i++) {
476  parameters(5 + i) = trial_best(i);
477  }
478 
481 
482  writeImageParameters(fnImg);
483  delete of;
484 }
485 
487  MetaDataVec md;
488  size_t objId = md.addObject();
489  md.setValue(MDL_IMAGE, fnImg, objId);
490  md.setValue(MDL_ENABLED, 1, objId);
491  md.setValue(MDL_ANGLE_ROT, parameters(0), objId);
492  md.setValue(MDL_ANGLE_TILT, parameters(1), objId);
493  md.setValue(MDL_ANGLE_PSI, parameters(2), objId);
494  md.setValue(MDL_SHIFT_X, parameters(3), objId);
495  md.setValue(MDL_SHIFT_Y, parameters(4), objId);
496 
497  int dim = numberOfModes;
498  std::vector<double> vectortemp;
499 
500  for (int j = 5; j < 5 + dim; j++) {
501  vectortemp.push_back(parameters(j));
502  }
503 
504  md.setValue(MDL_NMA, vectortemp, objId);
505  md.setValue(MDL_COST, parameters(5 + dim), objId);
506 
508 }
virtual int getNFE()
void readParams()
Read arguments from command line.
Rotation angle of an image (double,degrees)
Matrix1D< double > trial_best
~ProgNmaAlignment()
Destructor.
double getDoubleParam(const char *param, int arg=0)
virtual void read(int argc, const char **argv, bool reportErrors=true)
void read(const FileName &inFile, const std::vector< MDLabel > *desiredLabels=nullptr, bool decomposeStack=true) override
double sigmaGaussian
Gaussian standard deviation for pseudo-atoms.
Definition: nma_alignment.h:95
#define VEC_XSIZE(m)
Definition: matrix1d.h:77
virtual int tryRun()
double cutoff_LPfilter
Low-pass cut-off frequency.
Definition: nma_alignment.h:89
void copyImage(const FileName &source, const FileName &target)
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 write(const FileName &name="", size_t select_img=ALL_IMAGES, bool isStack=false, int mode=WRITE_OVERWRITE, CastWriteMode castMode=CW_CAST, int _swapWrite=0)
void Euler_mirrorY(double rot, double tilt, double psi, double &newrot, double &newtilt, double &newpsi)
Definition: geometry.cpp:1011
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
void abs(Image< double > &op)
void write(const FileName &outFile, WriteModeMetaData mode=MD_OVERWRITE) const
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
String integerToString(int I, int _width, char fill_with)
void setFileName(const FileName &fn)
void initUniqueName(const char *templateStr="xmippTemp_XXXXXX", const String &fnDir="")
bool projMatch
Real-space instead of wavelet-space (default) projection matching (global matching) that is refined b...
Definition: nma_alignment.h:71
void runSystem(const String &program, const String &arguments, bool useSystem)
String floatToString(float F, int _width, int _prec)
std::unique_ptr< MDRow > getRow(size_t id) override
virtual void createWorkFiles()
FileName createDeformedPDB(int pyramidLevel) const
size_t size() const override
#define i
Is this image enabled? (int [-1 or 1])
bool do_FilterPDBVol
Low-pass filter the volume from PDB.
Definition: nma_alignment.h:86
T & getValue(MDLabel label)
void setSize(int _n)
Definition: Vector.cpp:112
double sampling_rate
Pixel size in Angstroms.
Definition: nma_alignment.h:62
#define DEBUG
ProgPdbConverter * progVolumeFromPDB
char nameTemplate[256]
void setSaveFile(char *b=NULL)
const FileName & getFileName() const
Matrix1D< double > trial
const char * getParam(const char *param, int arg=0)
Matrix1D< double > bestStage1
bool setValue(const MDObject &mdValueIn, size_t id)
size_t addObject() override
Cost for the image (double)
size_t firstRowId() const override
FileName fnOut
Flip the image? (bool)
ProgNmaAlignment()
Empty constructor.
void resize(size_t Xdim, bool copy=true)
Definition: matrix1d.h:410
virtual void processImage(const FileName &fnImg, const FileName &fnImgOut, const MDRow &rowIn, MDRow &rowOut)
void max(Image< double > &op1, const Image< double > &op2)
Normal mode displacements (vector double)
bool produces_an_output
Indicate that a unique final output is produced.
void addExampleLine(const char *example, bool verbatim=true)
FileName fnOutDir
Output directory.
Definition: nma_alignment.h:53
Maximum cross-correlation for the image (double)
double performContinuousAssignment(const FileName &fnRandom, int pyramidLevel) const
void initZeros()
Definition: matrix1d.h:592
virtual void preProcess()
virtual int getNFE2()
#define j
double weight_zero_freq
Zero-frequency weight (parameter of central-slice method)
Definition: nma_alignment.h:83
bool getValue(MDObject &mdValueOut, size_t id) const override
void show()
Show.
double eval(Vector v, int *nerror=nullptr)
void show() const override
int round(double x)
Definition: ap.cpp:7245
virtual void removeDisabled()
#define RAD2DEG(r)
Definition: xmipp_macros.h:320
void append(const FileName &outFile) const
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
std::string String
Definition: xmipp_strings.h:34
double psi(const double x)
FileName currentImgName
String formatString(const char *format,...)
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 checkParam(const char *param)
bool useFixedGaussian
Use pseudo-atoms instead of atoms.
Definition: nma_alignment.h:92
fprintf(glob_prnt.io, "\)
int read(const FileName &name, DataMode datamode=DATA, size_t select_img=ALL_IMAGES, bool mapData=false, int mode=WRITE_READONLY)
void updateBestFit(double fitness)
bool each_image_produces_an_output
Indicate that an output is produced for each image in the input.
Shift for the image in the Y axis (double)
void addUsageLine(const char *line, bool verbatim=false)
FileName fnModeList
File with a list of mode filenames.
Definition: nma_alignment.h:56
void selfPyramidReduce(int SplineDegree, MultidimArrayGeneric &V1, int levels)
ProgNmaAlignment * global_nma_prog
void CONDOR(double rhoStart, double rhoEnd, int niter, ObjectiveFunction *of, int nnode)
Definition: CNLSolver.cpp:75
ObjFunc_nma_alignment(int _t, int _n=0)
Name of an image (std::string)
double fitness(double *p)
virtual void finishProcessing()
void addParamsLine(const String &line)
void performCompleteSearch(const FileName &fnRandom, int pyramidLevel) const
virtual void printStats(char cc=1)
std::map< String, CommentList > defaultComments
Definition: xmipp_program.h:83