64 for (i=0, j=0; i<
Ndim; i++,j=(j+1)%3)
77 double Ncomparisons=0;
78 double worseSimilarity=2;
81 static double minval=0;
87 for (
int imgi=0; imgi<
Nimg; imgi++)
104 tilti = trial[idx++];
110 roti = (*currentSolution)(idx++);
111 tilti = (*currentSolution)(idx++);
112 psii = (*currentSolution)(idx);
116 for (
int imgj=imgi+1; imgj<
Nimg; imgj++)
133 tiltj = trial[idx++];
139 rotj = (*currentSolution)(idx++);
140 tiltj = (*currentSolution)(idx++);
141 psij = (*currentSolution)(idx);
151 retval -= similarity;
153 worseSimilarity=
XMIPP_MIN(worseSimilarity,similarity);
162 imgCorrelationN(imgi)++;
163 imgCorrelationN(imgj)++;
166 double original_rotj=
rotj;
167 double original_tiltj=
tiltj;
168 double original_psij=
psij;
170 for (
int sym=0; sym<Nsym; sym++)
173 original_rotj,original_tiltj,original_psij,
178 retval -= similarity;
180 worseSimilarity=
XMIPP_MIN(worseSimilarity,similarity);
189 imgCorrelationN(imgi)++;
190 imgCorrelationN(imgj)++;
196 retval/=Ncomparisons;
198 if (imgCorrelationN(i)!=0)
202 <<
"Average Distance = " << retval << std::endl
203 <<
"Worse Distance = " << -worseSimilarity << std::endl
212 std::cout <<
"MinEnergy=" << minval << std::endl;
233 <<
"imgi=" << imgi <<
" (rot,tilt,psi)=(" 236 <<
"imgj=" << imgj <<
" (rot,tilt,psi)=(" 240 std::cout <<
"These two images are taken from the same direction\n";
241 std::cout <<
"Press any key\n";
258 auto idxAngi = (int)
intWRAP(-((
int)angi),0,359);
259 auto idxAngj = (int)
intWRAP(-((
int)angj),0,359);
266 int retvali=
ABS(idxBesti-idxAngi);
268 retvali=
ABS(retvali-360);
269 int retvalj=
ABS(idxBestj-idxAngj);
271 retvalj=
ABS(retvalj-360);
275 const double i180=0.5*1.0/180.0;
276 double retval2=1-(retvali+retvalj)*i180;
281 <<
"imgi=" << imgi <<
" (rot,tilt,psi)=(" 284 <<
"imgj=" << imgj <<
" (rot,tilt,psi)=(" 289 <<
" (" << idxAngi <<
")\n" 291 <<
" (" << idxAngj <<
")\n" 292 <<
"Distance between lines = " << retval1 <<
" " << retval2
295 parent->
radon[imgi][idxAngi].write(
"PPPradoni1.txt");
296 parent->
radon[imgj][idxAngj].write(
"PPPradonj1.txt");
297 std::cout <<
"Press any key\n";
303 for (idxAngi=0; idxAngi<360; idxAngi++)
313 <<
" (" << idxAngi <<
")\n" 314 <<
"Distance between lines = " << retval3 << std::endl
317 parent->
radon[imgi][idxAngi].write(
"PPPradoni2.txt");
318 parent->
radon[imgj][idxAngj].write(
"PPPradonj2.txt");
319 parent->radonDerivative[imgi][idxAngi].write(
"PPPradonDerivativei2.txt");
320 parent->radonDerivative[imgj][idxAngj].write(
"PPPradonDerivativej2.txt");
321 std::cout <<
"Press any key\n";
329 return retval1*retval2;
355 std::cout <<
"Selfile: " << fnSel << std::endl
356 <<
"Output: " <<
fnOut << std::endl
357 <<
"Symmetry: " << fnSym << std::endl
358 <<
"Generations: " << NGen << std::endl
359 <<
"Groups: " << NGroup << std::endl
360 <<
"Try Initial: " << tryInitial << std::endl
366 std::cerr <<
"angular_commonline\n" 367 <<
" -i <selfile> : SelFile with input images\n" 368 <<
" -oang <docfile> : Docfile with the angular assignment\n" 369 <<
" [-NGen <g=50000>] : Number of generations\n" 370 <<
" [-NGroup <N=10>] : Number of group comparisons\n" 371 <<
" [-tryInitial] : Do not optimize\n" 372 <<
" [-sym <symfile>] : Symmetry\n" 382 initialSolution.resize(3*Nimg);
385 for (
size_t objId : SF.ids())
389 initialSolution(3*idx)=I.
rot();
390 initialSolution(3*idx+1)=I.
tilt();
391 initialSolution(3*idx+2)=I.
psi();
404 SL.readSymmetryFile(fnSym);
405 for (
int sym=0; sym<SL.symsNo(); sym++)
408 SL.getMatrices(sym,auxL,auxR);
417 const double deltaRot=1.0;
420 std::cout <<
"Preprocessing images ...\n";
425 std::vector< MultidimArray<double> > dummyList;
426 radon.push_back(dummyList);
435 radon[
n].push_back(projection);
442 bestLine.initZeros(Nimg,Nimg);
443 bestLineCorrelation.initZeros(Nimg,Nimg);
444 std::cout <<
"Computing common lines ...\n";
446 for (
int n1=0; n1<
Nimg; n1++)
448 bestLineCorrelation(n1,n1)=1;
450 for (
int n2=n1+1; n2<
Nimg; n2++)
452 int lmax=radon[n1].size();
453 for (
int l1=0; l1<lmax; l1++)
454 for (
int l2=0; l2<lmax; l2++)
458 if (corrl1l2>bestLineCorrelation(n1,n2))
460 bestLineCorrelation(n1,n2)=
461 bestLineCorrelation(n2,n1)=corrl1l2;
476 int count_repetitions = 0;
477 double current_energy = 0;
478 double previous_energy = 2;
479 double first_energy = 2;
480 int NGenStep=NGen/100;
489 maxAllowed(idx++)=360;
490 maxAllowed(idx++)=180;
491 maxAllowed(idx++)=360;
497 global_Eulersolver=solver;
505 solver->Solve(NGenStep);
506 current_energy = solver->Energy();
509 if (current_energy<0 && first_energy>0)
510 first_energy=current_energy;
513 if (first_energy<0 &&
514 (
ABS((previous_energy-current_energy)/
515 (previous_energy-first_energy)))<0.01)
522 std::cout <<
"Iteration: " << count
523 <<
" Energy: " << current_energy
524 <<
" ( " << count_repetitions <<
")\n";
528 if (count_repetitions>=10 && (count>=50 || count==100))
531 previous_energy = current_energy;
544 0.001,retval,iter,steps,show);
553 size_t Nimg = SF.size();
561 int removalCounter=0;
568 std::vector < std::vector< Matrix1D<double> > > eulerAngles;
571 correlations.clear();
574 std::vector< Matrix1D<double> > dummy1;
575 std::vector< double > dummy2;
576 eulerAngles.push_back(dummy1);
577 correlations.push_back(dummy2);
581 std::cout <<
"Aligning image pairs, " 582 << Nimg-assigned.
sum() <<
" images remaining ...\n";
586 if (assigned(
i) || tabuPenalization(
i)>0)
591 for (
int n=0;
n<NGroup;
n++)
601 double energy=optimizeGroup(imgIdx,auxSolution,
false);
602 anglesi(0)=auxSolution(0);
603 anglesi(1)=auxSolution(1);
604 anglesi(2)=auxSolution(2);
607 eulerAngles[
i].push_back(anglesi);
608 correlations[
i].push_back(-energy);
616 size_t Nsym=SL.symsNo();
617 double bestDistance=-2;
621 if (eulerAngles[
i].size()<2*topN && !assigned(
i) &&
622 tabuPenalization(
i)==0)
623 topN=(size_t)ceil(eulerAngles[
i].size()/2);
627 if (assigned(
i) || tabuPenalization(
i)>0)
633 for (
size_t n=0;
n<eulerAngles[
i].size();
n++)
634 aux(
n)=correlations[
i][
n];
678 std::cout <<
"Image " <<
i <<
" distance=" << distance <<
" " 679 <<
" Ncomparisons= " << eulerAngles[
i].size()
680 <<
" topN=" << topN << std::endl;
683 if (distance>bestDistance)
694 aux.
initZeros(eulerAngles[besti].size());
695 for (
size_t n=0;
n<eulerAngles[besti].size();
n++)
696 aux(
n)=correlations[besti][
n];
701 std::vector< Matrix1D<double> > bestEulerAngles;
702 std::vector< double > bestCorrelations;
705 bestEulerAngles.push_back(eulerAngles[besti][idx(
n)-1]);
706 bestCorrelations.push_back(correlations[besti][idx(
n)-1]);
710 std::cout <<
"Candidates for image " << besti <<
" distance=" 711 << bestDistance << std::endl;
712 for (
size_t n=0;
n<bestEulerAngles.size();
n++)
716 bestEulerAngles[
n](1),bestEulerAngles[
n](2),
718 std::cout << bestEulerAngles[
n].transpose() <<
" corr= " 719 << bestCorrelations[
n] <<
" dir= " 724 std::vector< int > clusterBestAssignment;
725 std::vector< double > clusterBestCorrelation;
728 for (
size_t j1=0; j1<topN; j1++)
730 if (!alreadyClustered(j1))
732 alreadyClustered(j1)=1;
736 bestEulerAngles[j1](1),bestEulerAngles[j1](2),
738 double bestCorrelation=bestCorrelations[j1];
739 int bestAssignment=j1;
740 for (
size_t j2=j1+1; j2<topN; j2++)
742 if (!alreadyClustered(j2))
746 bestEulerAngles[j2](1),
747 bestEulerAngles[j2](2),E2);
750 for (
size_t sym=0; sym<Nsym; sym++)
752 double otherrot, othertilt, otherpsi;
754 bestEulerAngles[j2](0), bestEulerAngles[j2](1),
755 bestEulerAngles[j2](2), otherrot, othertilt,
759 if (aux>bestCorrE1E2)
762 if (bestCorrE1E2>0.97)
764 alreadyClustered(j2)=1;
765 if (bestCorrelation<bestCorrelations[j2])
767 bestCorrelation=bestCorrelations[j2];
774 clusterBestAssignment.push_back(bestAssignment);
775 clusterBestCorrelation.push_back(bestCorrelation);
777 std::cout <<
"Cluster headed by " 778 << bestEulerAngles[bestAssignment].
transpose()
779 <<
" corr= " << bestCorrelation << std::endl;
783 if (clusterBestAssignment.size()>=5 && assigned.
sum()>5)
787 tabuPenalization(besti)+=10;
799 bestCurrentImgAvgCorrelation,
800 bestCurrentImgMinCorrelation;
802 if (clusterBestAssignment.size()>1)
806 for (
size_t n=0;
n<clusterBestAssignment.size();
n++)
808 std::cout <<
"Trying solution of cluster " <<
n << std::endl;
810 clusterBestAssignment[
n]](0);
812 clusterBestAssignment[
n]](1);
814 clusterBestAssignment[
n]](2);
815 double energy=realignCurrentSolution();
816 if (energy<bestEnergy)
821 bestCurrentImgAvgCorrelation=currentImgAvgCorrelation;
822 bestCurrentImgMinCorrelation=currentImgMinCorrelation;
823 bestCurrentCorrelationMatrix=currentCorrelationMatrix;
831 clusterBestAssignment[0]](0);
833 clusterBestAssignment[0]](1);
835 clusterBestAssignment[0]](2);
836 realignCurrentSolution();
839 bestCurrentImgAvgCorrelation=currentImgAvgCorrelation;
840 bestCurrentImgMinCorrelation=currentImgMinCorrelation;
841 bestCurrentCorrelationMatrix=currentCorrelationMatrix;
845 std::cout <<
"Cluster chosen " << bestCluster <<
" angles=" 846 << bestEulerAngles[clusterBestAssignment[
847 bestCluster]].transpose() << std::endl;
849 currentImgAvgCorrelation=bestCurrentImgAvgCorrelation;
850 currentImgMinCorrelation=bestCurrentImgMinCorrelation;
851 currentCorrelationMatrix=bestCurrentCorrelationMatrix;
852 std::cout <<
"Image Avg Correlation: " << currentImgAvgCorrelation
853 <<
"\nImage Min Correlation: " << currentImgMinCorrelation
858 auto totalAssigned=(int)assigned.
sum();
859 std::cout <<
"removal=" << removalCounter
860 <<
" totalAssigned=" << totalAssigned
862 removeViaClusters(currentCorrelationMatrix);
863 if (removalCounter!=0 && totalAssigned>3)
865 std::vector<int> imgsToRemove;
867 double worseCorrelation=2;
868 double bestCorrelation=-2;
869 if (removalCounter==0)
877 if (currentImgAvgCorrelation(
i)==1)
879 meanCorr+=currentImgAvgCorrelation(
i);
880 stdCorr+=currentImgAvgCorrelation(
i)*
881 currentImgAvgCorrelation(
i);
883 switch (removalCounter)
886 if (currentImgAvgCorrelation(
i)<worseCorrelation)
888 worseCorrelation=currentImgAvgCorrelation(
i);
893 if (currentImgAvgCorrelation(
i)>bestCorrelation)
895 bestCorrelation=currentImgAvgCorrelation(
i);
902 imgsToRemove.push_back(imin);
906 stdCorr=
sqrt(stdCorr/Ncorr-meanCorr*meanCorr);
907 std::cout <<
"Mean=" << meanCorr <<
" std=" 908 << stdCorr << std::endl;
909 if (
ABS(worseCorrelation-meanCorr)>3*stdCorr)
910 imgsToRemove.push_back(imin);
914 imgsToRemove=removeViaClusters(currentCorrelationMatrix);
916 if (imgsToRemove.size()!=0)
918 for (
size_t n=0;
n<imgsToRemove.size();
n++)
920 int imin=imgsToRemove[
n];
921 std::cout <<
"Image " << imin <<
" removed from the " 922 <<
"current assignment corr=" 923 << currentImgAvgCorrelation(imin)
929 currentImgAvgCorrelation(imin)=0;
930 currentImgMinCorrelation(imin)=2;
931 for (
size_t i=0;
i<
XSIZE(currentCorrelationMatrix);
i++)
932 currentCorrelationMatrix(
i,imin)=
933 currentCorrelationMatrix(imin,
i)=0;
934 tabuPenalization(imin)+=10;
939 removalCounter=(removalCounter+1)%3;
944 if (tabuPenalization(
i)>0)
945 tabuPenalization(
i)--;
954 int Nimg = SF.ImgNo();
961 double energy=optimizeGroup(imgIdx,solution,
true);
968 std::vector< std::vector<int> > &clusters,
974 std::vector<int> idxImgs;
977 idxImgs.push_back(
i);
978 int Noptimized=idxImgs.size();
981 worseCorrelationMatrix.
initZeros(Noptimized,Noptimized);
985 bestCorrelationMatrix=worseCorrelationMatrix;
986 for (
int i=0; i<Noptimized; i++)
988 std::vector<int> singleElement;
989 singleElement.
clear();
990 singleElement.push_back(i);
991 clusters.push_back(singleElement);
993 std::cout <<
"Correlation matrix\n" 994 << worseCorrelationMatrix << std::endl;
997 double avgDistance=0;
1000 avgDistance+=worseCorrelationMatrix(i,j);
1003 avgDistance/=Noptimized*Noptimized;
1006 while (clusters.size()>2)
1009 size_t besti=0, bestj=0;
1011 for (
size_t i=0; i<
YSIZE(worseCorrelationMatrix); i++)
1012 for (
size_t j=i+1; j<
XSIZE(worseCorrelationMatrix); j++)
1013 if (worseCorrelationMatrix(i,j)>bestCorr)
1015 bestCorr=worseCorrelationMatrix(i,j);
1025 for (
size_t n=0;
n<clusters[bestj].size();
n++)
1026 clusters[besti].push_back(clusters[bestj][
n]);
1027 clusters.erase(clusters.begin()+bestj);
1031 for (
size_t i=0; i<
YSIZE(worseCorrelationMatrix); i++)
1035 worseCorrelationMatrix(besti,i)=
1036 worseCorrelationMatrix(i,besti)=
XMIPP_MIN(
1037 worseCorrelationMatrix(i,besti),
1038 worseCorrelationMatrix(i,bestj));
1039 bestCorrelationMatrix(besti,i)=
1040 bestCorrelationMatrix(i,besti)=
XMIPP_MAX(
1041 bestCorrelationMatrix(i,besti),
1042 bestCorrelationMatrix(i,bestj));
1046 worseCorrelationMatrix(besti,besti)=
1047 worseCorrelationMatrix(bestj,bestj)=
1048 worseCorrelationMatrix(besti,bestj);
1049 bestCorrelationMatrix(besti,besti)=
1050 bestCorrelationMatrix(bestj,bestj)=
1051 bestCorrelationMatrix(besti,bestj);
1056 for (
size_t i=0; i<
YSIZE(worseCorrelationMatrix); i++)
1057 for (
size_t j=bestj; j<
XSIZE(worseCorrelationMatrix)-1; j++)
1059 worseCorrelationMatrix(i,j)=worseCorrelationMatrix(i,j+1);
1060 bestCorrelationMatrix(i,j)=bestCorrelationMatrix(i,j+1);
1064 for (
size_t i=bestj; i<
YSIZE(worseCorrelationMatrix)-1; i++)
1065 for (
size_t j=0; j<
XSIZE(worseCorrelationMatrix); j++)
1067 worseCorrelationMatrix(i,j)=worseCorrelationMatrix(i+1,j);
1068 bestCorrelationMatrix(i,j)=bestCorrelationMatrix(i+1,j);
1072 worseCorrelationMatrix.
resize(
YSIZE(worseCorrelationMatrix)-1,
1073 XSIZE(worseCorrelationMatrix)-1);
1074 bestCorrelationMatrix.
resize(
YSIZE(bestCorrelationMatrix)-1,
1075 XSIZE(bestCorrelationMatrix)-1);
1079 for (
size_t n=0;
n<2;
n++)
1080 for (
size_t i=0;i<clusters[
n].size(); i++)
1081 clusters[
n][i]=idxImgs[clusters[
n][i]];
1086 for (
size_t n=0;
n<2;
n++)
1088 for (
size_t i=0;i<clusters[
n].size(); i++)
1089 for (
size_t j=0;j<clusters[
n].size(); j++)
1092 clusters[
n][i],clusters[
n][j]);
1095 avgDistancek(
n)/=clusters[
n].
size()*clusters[
n].size();
1097 double mergeDistance1=avgDistance/(0.5*(avgDistancek(0)+avgDistancek(1)));
1098 double mergeDistance2;
1099 if (worseCorrelationMatrix(0,0)>0 && worseCorrelationMatrix(1,1)>0)
1100 mergeDistance2=worseCorrelationMatrix(0,1)/
1101 (0.5*(avgDistancek(0)+avgDistancek(1)));
1107 for (
int n=0;
n<2;
n++)
1109 std::cout <<
"Cluster " <<
n <<
": ";
1110 for (
size_t i=0;i<clusters[
n].size(); i++)
1111 std::cout << clusters[n][i] <<
" ";
1112 std::cout << std::endl;
1114 std::cout <<
"Merge distance=" << mergeDistance1 <<
" =" 1115 << avgDistance <<
"/(0.5*(" << avgDistancek(0) <<
"+" 1116 << avgDistancek(1) <<
")\n";
1117 std::cout <<
"Merge distance=" << mergeDistance2 <<
" =" 1118 << worseCorrelationMatrix(0,1) <<
"/(0.5*(" 1119 << avgDistancek(0) <<
"+" 1120 << avgDistancek(1) <<
")\n";
1121 std::cout <<
"Worse Correlation matrix\n" << worseCorrelationMatrix << std::endl;
1122 std::cout <<
"Best Correlation matrix\n" << bestCorrelationMatrix << std::endl;
1124 return mergeDistance2;
1131 std::vector<int> retval;
1132 std::vector< std::vector<int> > clusters;
1135 computeClusters(correlationMatrix,clusters,
1136 worseCorrelationMatrix, bestCorrelationMatrix,
true);
1137 if (clusters[0].size()+clusters[1].size()<=4)
1143 if (clusters[0].size()>clusters[1].size())
1150 double diameter0=(bestCorrelationMatrix(0,0)-worseCorrelationMatrix(0,0));
1151 double diameter1=(bestCorrelationMatrix(1,1)-worseCorrelationMatrix(1,1));
1152 double diameter01=(bestCorrelationMatrix(0,1)-worseCorrelationMatrix(0,1));
1153 bool separated=(diameter01>(diameter0+diameter1));
1155 if (separated && clusters[nmin].size()<=3 && clusters[
nmax].size()>=6)
1157 for (
size_t i=0;
i<clusters[nmin].size();
i++)
1159 int imin=clusters[nmin][
i];
1160 retval.push_back(imin);
1163 else if (clusters[nmax].size()>=4 && clusters[nmin].size()>=3)
1167 double worseCorrelation=2;
1168 for (
size_t i=0;
i<clusters[nmin].size();
i++)
1170 int imgIndex=clusters[nmin][
i];
1171 if (currentImgAvgCorrelation(imgIndex)<worseCorrelation)
1173 worseCorrelation=currentImgAvgCorrelation(imgIndex);
1177 retval.push_back(imin);
1181 std::cout <<
"Remove images: ";
1182 for (
size_t i=0;
i< retval.size();
i++)
1183 std::cout << retval[
i] <<
" ";
1184 std::cout << std::endl;
1203 global_Eulersolver=solver;
1206 steps.initConstant(1);
1218 0.001,energy,iter,
steps,
true);
1232 currentImgAvgCorrelation=solver->imgAvgCorrelation.
transpose();
1233 currentImgMinCorrelation=solver->imgMinCorrelation.
transpose();
1234 currentCorrelationMatrix=solver->correlationMatrix;
1247 maxAllowed(idx++)=360;
1248 maxAllowed(idx++)=180;
1249 maxAllowed(idx++)=360;
1261 solver->setShow(
true);
1262 double energy=solver->EnergyFunction(
MATRIX1D_ARRAY(solution),bAtSolution);
1263 std::cout <<
"Correlation matrix\n" << solver->correlationMatrix
1273 trySolution(initialSolution);
1286 for (
size_t objId : SF.ids())
std::vector< Matrix2D< double > > R
bool checkParameter(int argc, const char **argv, const char *param)
void init_progress_bar(long total)
const Prog_Angular_CommonLine * parent
void resize(size_t Ndim, size_t Zdim, size_t Ydim, size_t Xdim, bool copy=true)
Matrix1D< double > imgAvgCorrelation
double psi(const size_t n=0) const
void Euler_angles2matrix(T alpha, T beta, T gamma, Matrix2D< T > &A, bool homogeneous)
void Euler_direction(double alpha, double beta, double gamma, Matrix1D< double > &v)
void sqrt(Image< double > &op)
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)
std::vector< Matrix2D< double > > L
const MultidimArray< int > * imgIdx
double correlationIndex(const MultidimArray< T > &x, const MultidimArray< T > &y, const MultidimArray< int > *mask=NULL, MultidimArray< double > *Contributions=NULL)
Matrix1D< double > commonlinei
Matrix1D< double > normali
double similarityBetweenTwoLines(int imgi, int imgj)
double realignCurrentSolution()
double EnergyFunction(double trial[], bool &bAtSolution)
Matrix1D< T > vectorProduct(const Matrix1D< T > &v1, const Matrix1D< T > &v2)
double rot(const size_t n=0) const
Matrix1D< double > normalj
void Euler_apply_transf(const Matrix2D< double > &L, const Matrix2D< double > &R, double rot, double tilt, double psi, double &newrot, double &newtilt, double &newpsi)
int readApplyGeo(const FileName &name, const MDRow &row, const ApplyGeoParams ¶ms=DefaultApplyGeoParams)
const Matrix1D< double > * currentSolution
void setShow(bool newShow)
#define FOR_ALL_ELEMENTS_IN_ARRAY2D(m)
Matrix1D< T > transpose() const
void initLinear(T minF, T maxF, int n=1, const String &mode="incr")
double tilt(const size_t n=0) const
void Radon_Transform(const MultidimArray< double > &vol, double rot, double tilt, MultidimArray< double > &RT)
#define FOR_ALL_ELEMENTS_IN_MATRIX1D(v)
void optimize(Matrix1D< double > &solution)
const char * getParameter(int argc, const char **argv, const char *param, const char *option)
void read(int argc, const char **argv)
std::vector< int > removeViaClusters(const MultidimArray< double > &correlationMatrix)
#define XMIPP_EQUAL_ACCURACY
double Euler_distanceBetweenMatrices(const Matrix2D< double > &E1, const Matrix2D< double > &E2)
double wrapperSolverEnergy(double trial[], void *prm)
std::vector< std::vector< MultidimArray< double > > > radon
void progress_bar(long rlen)
double sum(bool average=false) const
void direction(const MultidimArray< double > &orMap, MultidimArray< double > &qualityMap, double lambda, int size, MultidimArray< double > &dirMap, int x, int y)
Matrix1D< double > commonline
void getRow(size_t i, MultidimArray< T > &v) const
size_t correlations(const Dimensions &d)
void setEulerAngles(double rot, double tilt, double psi, const size_t n=0)
TYPE distance(struct Point_T *p, struct Point_T *q)
double trySolution(const Matrix1D< double > &solution)
#define MATRIX1D_ARRAY(v)
Matrix1D< double > imgMinCorrelation
const Matrix1D< int > * alreadyOptimized
EulerSolver(int dim, int pop, const Matrix1D< int > &newAlreadyOptimized, const Matrix1D< double > &newCurrentSolution, const MultidimArray< int > &newImgIdx, const Prog_Angular_CommonLine *newParent)
int textToInteger(const char *str)
#define realWRAP(x, x0, xF)
Matrix1D< double > commonlinej
double computeClusters(const MultidimArray< double > &correlationMatrix, std::vector< std::vector< int > > &clusters, MultidimArray< double > &worseCorrelationMatrix, MultidimArray< double > &bestCorrelationMatrix, bool show=false) const
void initZeros(const MultidimArray< T1 > &op)
double optimizeGroup(const Matrix1D< int > &imgIdx, Matrix1D< double > &solution, bool show=false)
void Uproject_to_plane(const Matrix1D< double > &point, const Matrix1D< double > &direction, double distance, Matrix1D< double > &result)
MultidimArray< double > correlationMatrix
void resize(size_t Ydim, size_t Xdim, bool noCopy=false)
#define intWRAP(x, x0, xF)
EulerSolver * global_Eulersolver
void indexSort(MultidimArray< int > &indx) const
void pop(struct stack_T *stack)