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.");
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");
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.");
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");
107 <<
"Output directory: " <<
fnOutDir << std::endl
108 <<
"PDB: " <<
fnPDB << std::endl
109 <<
"Resume: " <<
resume << std::endl
113 <<
"Mask: " <<
fnmask << std::endl
118 <<
"Projection matching: " <<
projMatch << std::endl
135 global_nma_prog =
this;
151 const char * randStr = fnRandom.c_str();
153 program =
"xmipp_pdb_nma_deform";
155 "--pdb %s -o %s_deformedPDB.pdb --nma %s --deformations ",
161 program =
"xmipp_volume_from_pdb";
163 "-i %s_deformedPDB.pdb --size %i --sampling %f -v 0", randStr,
167 arguments.append(
" --centerPDB ");
170 arguments.append(
" --intensityColumn Bfactor --fixed_Gaussian ");
181 program =
"xmipp_transform_filter";
183 "-i %s_deformedPDB.vol --sampling %f --fourier low_pass %f -v 0",
188 if (pyramidLevel != 0) {
200 int pyramidLevel)
const {
203 const char * randStr = fnRandom.c_str();
207 if (pyramidLevel != 0) {
215 mkdir((fnRandom+
"_ref").c_str(), S_IRWXU);
217 double angSampling=2*
RAD2DEG(atan(1.0/((
double)
imgSize / pow(2.0, (
double) pyramidLevel+1))));
219 program =
"xmipp_angular_project_library";
221 "-i %s_deformedPDB.vol -o %s_ref/ref.stk --sampling_rate %f -v 0",
222 randStr, randStr, angSampling);
225 " --compute_neighbors --angular_distance -1 --experimental_images %s_downimg.xmp", randStr);
232 program =
"xmipp_transform_mask";
233 arguments =
formatString(
"-i %s --mask binary_file %s", refSelStr.c_str(),
241 program =
"xmipp_angular_discrete_assign";
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))));
247 program =
"xmipp_angular_projection_matching";
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))));
264 double shiftX, rot, tilt,
psi, newrot, newtilt, newpsi;
284 int pyramidLevel)
const {
286 const char * randStr = fnRandom.c_str();
288 bool costSource=
true;
289 String program =
"xmipp_angular_continuous_assign";
292 "-i %s_angledisc.xmd --ref %s_deformedPDB.vol -o %s --gaussian_Fourier %f --gaussian_Real %f --zerofreq_weight %f -v 0",
328 for (
int i = 0;
i < dim;
i++) {
329 global_nma_prog->
trial(
i) = X[
i];
332 int pyramidLevelDisc = 1;
333 int pyramidLevelCont = (global_nma_prog->
currentStage == 1) ? 1 : 0;
336 const char * randStr = fnRandom.c_str();
341 double rot, tilt,
psi, xshift, yshift;
382 static size_t imageCounter = 0;
396 sprintf(
nameTemplate,
"_node%d_img%lu_XXXXXX",
rangen, (
long unsigned int)imageCounter);
406 std::cerr << std::endl <<
"DEBUG: ===== Node: " <<
rangen 407 <<
" processing image " << fnImg <<
"(" << objId <<
")" 413 for (
int i = 0;
i < dim;
i++)
421 CONDOR(rhoStart, rhoEnd, niter, of);
435 std::cerr << std::endl <<
"DEBUG: ===== Node: " <<
rangen 436 <<
" processing image " << fnImg <<
"(" << objId <<
")" 445 for (
int i = 0;
i < dim;
i++)
453 CONDOR(rhoStart, rhoEnd, niter, of);
462 std::cout <<
"Best fitness = " <<
fitness << std::endl;
463 for (
int i=0;
i<dim;
i++)
465 std::cout <<
"Best deformations = " << dd[
i] << std::endl;
471 for (
int i = dim;
i < dim + 5;
i++) {
475 for (
int i = 0;
i < dim;
i++) {
498 std::vector<double> vectortemp;
500 for (
int j = 5;
j < 5 + dim;
j++) {
void readParams()
Read arguments from command line.
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)
double sigmaGaussian
Gaussian standard deviation for pseudo-atoms.
double cutoff_LPfilter
Low-pass cut-off frequency.
void copyImage(const FileName &source, const FileName &target)
double gaussian_Real_sigma
Sigma of Gaussian weigthing in real space for spline interpolation in Fourier space (parameter of cen...
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)
void defineParams()
Define params.
Matrix1D< double > parameters
bool do_centerPDB
Center the PDB structure.
void abs(Image< double > &op)
double discrAngStep
Angular sampling step for computing the reference projections for global matching.
double gaussian_DFT_sigma
Sigma of Gaussian weigthing in Fourier space (parameter of central-slice method)
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...
void runSystem(const String &program, const String &arguments, bool useSystem)
String floatToString(float F, int _width, int _prec)
virtual void createWorkFiles()
FileName createDeformedPDB(int pyramidLevel) const
bool do_FilterPDBVol
Low-pass filter the volume from PDB.
T & getValue(MDLabel label)
double sampling_rate
Pixel size in Angstroms.
ProgPdbConverter * progVolumeFromPDB
void setSaveFile(char *b=NULL)
const FileName & getFileName() const
const char * getParam(const char *param, int arg=0)
Matrix1D< double > bestStage1
ProgNmaAlignment()
Empty constructor.
void resize(size_t Xdim, bool copy=true)
virtual void processImage(const FileName &fnImg, const FileName &fnImgOut, const MDRow &rowIn, MDRow &rowOut)
void max(Image< double > &op1, const Image< double > &op2)
void addExampleLine(const char *example, bool verbatim=true)
FileName fnOutDir
Output directory.
double performContinuousAssignment(const FileName &fnRandom, int pyramidLevel) const
virtual void preProcess()
double weight_zero_freq
Zero-frequency weight (parameter of central-slice method)
double eval(Vector v, int *nerror=nullptr)
virtual void writeImageParameters(const FileName &fnImg)
FileName fnmask
Mask file for 2D masking of the projections of the deformed volume.
double psi(const double x)
String formatString(const char *format,...)
double trustradius_scale
Positive scaling factor to scale the initial trust region radius.
Matrix1D< double > fitness_min
FileName fnPDB
Reference atomic or pseudo-atomic structure in PDB format.
bool checkParam(const char *param)
bool useFixedGaussian
Use pseudo-atoms instead of atoms.
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)
void addUsageLine(const char *line, bool verbatim=false)
FileName fnModeList
File with a list of mode filenames.
ProgNmaAlignment * global_nma_prog
void CONDOR(double rhoStart, double rhoEnd, int niter, ObjectiveFunction *of, int nnode)
ObjFunc_nma_alignment(int _t, int _n=0)
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