73 double rad_min,
double rad_max,
double res_min,
double res_max,
double AmB_min,
double AB_min,
int diff_out,
74 int origins2,
Bstring outimg,
int fieldnum);
77 Hand_Stats* Pair,
double rad_min,
double rad_max,
double res_min,
double res_max,
double AmB_min,
double AB_min,
78 int diff_out,
int origins2,
Bstring outimg,
int fieldnum);
115 int* mg_index,
int* mg_select,
double rad_min,
double rad_max,
116 double res_min,
double res_max,
double AmB_min,
double AB_min,
117 int diff_out,
int origins2,
Bstring outimg)
133 cout <<
"Minimum Radius (pixels): " << rad_min << endl;
134 cout <<
"Maximum Radius (pixels): " << rad_max << endl;
135 cout <<
"High-Pass filter (angs.): " << res_min << endl;
136 cout <<
"Low-Pass filter (angs.): " << res_max << endl << endl;
150 cout <<
"Hand A map origin: " << mapA->
image->
origin() << endl;
151 cout <<
"Hand B map origin: " << mapB->
image->
origin() << endl;
152 cout <<
"Map Sampling (angs./pixel): " << mapA->
sampling(0) << endl << endl;
157 for ( field =
project->
field, ifield=1; field; field = field->
next, ifield++ ) {
164 res_min, res_max, AmB_min, AB_min, diff_out, origins2, outimg, ifield);
171 cout << endl << endl;
178 if ( (Global->
CountA/n_Global) >= 0.95 ) {
180 if (
verbose) cout <<
"Output map has hand A (same as input map)." << endl;
181 }
else if ( (Global->
CountB/n_Global) >= 0.95 ) {
183 if (
verbose) cout <<
"Output map has hand B (opposite of input map)." << endl;
187 cout <<
"Output map is undetermined because the number of selected" << endl;
188 cout <<
"particles favoring hand A or B was not 95% or greater." << endl;
231 double rad_min,
double rad_max,
double res_min,
double res_max,
double AmB_min,
double AB_min,
int diff_out,
232 int origins2,
Bstring outimg,
int fieldnum)
243 error_show(
"Error in field_get_handedness", __FILE__, __LINE__);
244 cerr <<
"The tilt-axis direction is not the same or is invalid in this pair:" << endl;
247 cerr <<
"You may have a pair mismatch or may need to enter a value for both micrographs." << endl;
252 cout <<
"Tilt pair:" << endl;
253 cout <<
"Micrograph 1: " << mg1->
fpart << endl;
254 cout <<
"Micrograph 2: " << mg2->
fpart << endl;
255 cout <<
"Tilt-axis direction: " << mg1->
tilt_axis*(180/
M_PI) << endl;
265 for ( particle1=mg1->
part; particle1; particle1=particle1->
next )
if ( particle1->
sel ) {
267 for ( particle2=mg2->
part; particle2 && particle1->
id != particle2->
id; particle2=particle2->
next ) ;
270 rad_min, rad_max, res_min, res_max, AmB_min, AB_min, diff_out, origins2, outimg, fieldnum);
354 Hand_Stats* Pair,
double rad_min,
double rad_max,
double res_min,
double res_max,
double AmB_min,
double AB_min,
355 int diff_out,
int origins2,
Bstring outimg,
int fieldnum)
363 double diff2A_phi(0);
364 double diff2A_the(0);
365 double diff2A_psi(0);
366 double diff2B_phi(0);
367 double diff2B_the(0);
368 double diff2B_psi(0);
375 Euler angles2A, angles2B;
404 rot_matrix1A = view1A.
matrix();
405 rot_matrix1B = view1B.
matrix();
409 rot_matrix2A = rot_matrix1A * rot_matrixtilt;
410 rot_matrix2B = rot_matrix1B * rot_matrixtilt;
413 angles1A =
Euler(view1A);
414 angles2A =
Euler(rot_matrix2A);
415 angles2B =
Euler(rot_matrix2B);
418 cout <<
"Input orientation (phi, theta, psi) = " <<
420 cout <<
"Predicted orientation 2A (phi, theta, psi) = " <<
422 cout <<
"Predicted orientation 2B (phi, theta, psi) = " <<
426 cout <<
"Matrix for first view, hand A" << endl;
427 cout << rot_matrix1A << endl;
428 cout <<
"Matrix for tilt" << endl;
429 cout << rot_matrixtilt << endl;
430 cout <<
"Matrix for second view, hand A" << endl;
431 cout << rot_matrix2A << endl;
432 cout <<
"Matrix for second view, hand B" << endl;
433 cout << rot_matrix2B << endl;
448 img2B = img2A->
copy();
455 translate1 = particle1->
ori - oriA;
458 translate2A = particle2->
ori - oriA;
459 translate2B = particle2->
ori - oriB;
460 }
else if (origins2 == 1) {
461 prj2A = mapA->
rotate_project(rot_matrix2A, translate0, max_radius);
462 prj2B = mapB->
rotate_project(rot_matrix2B, translate0, max_radius);
465 img2A->
find_shift(prj2A, NULL, res_max, res_min, max_radius, 0, 1);
470 img2B->
find_shift(prj2B, NULL, res_max, res_min, max_radius, 0, 1);
473 img2B->
origin(translate2B + oriB);
477 }
else if (origins2 == 2) {
484 prj1A = mapA->
rotate_project(rot_matrix1A, translate1, max_radius);
485 prj2A = mapA->
rotate_project(rot_matrix2A, translate2A, max_radius);
486 prj2B = mapB->
rotate_project(rot_matrix2B, translate2B, max_radius);
529 cout <<
"General parameters" << endl;
530 cout <<
" radius min,max: " << rad_min <<
" " << rad_max << endl;
531 cout <<
" resolution min,max: " << res_min <<
" " << res_max << endl;
532 cout <<
" micrograph 1,2: " << mg1->
id <<
" " << mg2->
id << endl;
533 cout <<
" particle 1,2: " << particle1->
id <<
" " << particle2->
id << endl;
534 cout <<
"Image 1 parameters" << endl;
535 cout <<
" background: " << img1->
background(
long(0)) << endl;
536 cout <<
" origin (x,y,z): " << img1->
image->
origin() << endl;
537 cout <<
" pixel size (x,y,z): " << img1->
sampling(0) << endl;
538 cout <<
"Projection 1A parameters" << endl;
539 cout <<
" background: " << img2A->
background(
long(0)) << endl;
540 cout <<
" origin (x,y,z): " << prj1A->
image->
origin() << endl;
541 cout <<
" pixel size (x,y,z): " << prj1A->
sampling(0) << endl;
542 cout <<
"Image 2A parameters" << endl;
543 cout <<
" background: " << img2B->
background(
long(0)) << endl;
544 cout <<
" origin (x,y,z): " << img2A->
image->
origin() << endl;
545 cout <<
" pixel size (x,y,z): " << img2A->
sampling(0) << endl;
546 cout <<
"Projection 2A parameters" << endl;
547 cout <<
" background: " << prj1A->
background(
long(0)) << endl;
548 cout <<
" origin (x,y,z): " << prj2A->
image->
origin() << endl;
549 cout <<
" pixel size (x,y,z): " << prj2A->
sampling(0) << endl;
550 cout <<
"Image 2B parameters" << endl;
551 cout <<
" background: " << prj2A->
background(
long(0)) << endl;
552 cout <<
" origin (x,y,z): " << img2B->
image->
origin() << endl;
553 cout <<
" pixel size (x,y,z): " << img2B->
sampling(0) << endl;
554 cout <<
"Projection 2B parameters" << endl;
555 cout <<
" background: " << prj2B->
background(
long(0)) << endl;
556 cout <<
" origin (x,y,z): " << prj2B->
image->
origin() << endl;
557 cout <<
" pixel size (x,y,z): " << prj2B->
sampling(0) << endl;
565 cc1A = img1->
correlate(prj1A, rad_min, rad_max, NULL, 0);
566 cc2A = img2A->
correlate(prj2A, rad_min, rad_max, NULL, 0);
567 cc2B = img2B->
correlate(prj2B, rad_min, rad_max, NULL, 0);
569 particle1->
fom[1] = cc1A;
570 particle2->
fom[1] = cc2A;
571 particle2->
fom[2] = cc2B;
579 if (
verbose) cout << setprecision(4) << particle1->
id <<
tab << cc1A <<
tab << cc2A <<
tab << cc2B <<
tab << cc2A-cc2B;
581 if ( fabs(cc2A-cc2B) >= AmB_min ) {
582 if ( (cc2A < AB_min) && (cc2B < AB_min) ) {
592 if (
verbose && (diff_out > 0) ) {
601 if ( !ThresholdOK ) {
606 if (
verbose && !diff_out ) cout <<
tab << ThresholdOK;
612 if ( (ThresholdOK == 1) && (diff_out > 0) ) {
614 view2 = particle2->
view;
615 euler2 =
Euler(view2);
621 diff2A_the = euler2.
theta() - angles2A.
theta();
624 diff2B_the = euler2.
theta() - angles2B.
theta();
627 if (
verbose && (diff_out >= 2) ) {
628 cout <<
" Measured - Predicted =";
629 cout <<
" " << (180/
M_PI)*diff2A_phi;
630 cout <<
" " << (180/
M_PI)*diff2A_the;
631 cout <<
" " << (180/
M_PI)*diff2A_psi;
632 cout <<
" " << (180/
M_PI)*diff2B_phi;
633 cout <<
" " << (180/
M_PI)*diff2B_the;
634 cout <<
" " << (180/
M_PI)*diff2B_psi << endl << endl;
640 if (ThresholdOK == 1) {
649 else if (cc2B > cc2A)
703 if (N == 0)
return -1;
789 cout <<
"Particle images vs. projections at predicted orientations" << endl << endl;
790 cout <<
"\tCorrelation Coefficients";
791 if (which_one == 0) {
792 if (diff_out>0) cout <<
"\tPredicted Orientations";
793 cout << endl << endl;
794 cout <<
"\tprj.\tprj.\tprj." << endl;
795 cout <<
"\tview1\tview2\tview2\tprjs" << endl;
796 cout <<
"\thandA\thandA\thandB\tvs." << endl;
797 cout <<
"Part.\tvs.\tvs.\tvs.\timage2";
798 if (diff_out>0) cout <<
"\tview2, handA\tview2, handB";
800 cout <<
"Id\timage1\timage2\timage2\tA - B";
801 if (diff_out>0) cout <<
"\tPhi\tTheta\tPsi\tPhi\tTheta\tPsi";
802 else cout <<
"\tselected";
804 cout <<
"================================================";
805 if (diff_out>0) cout <<
"======================================";
809 if (diff_out>0) cout <<
"\t|Measured Orientation -";
810 if (diff_out>0) cout << endl <<
"\tPredicted Orientation|" << endl;
811 else cout << endl << endl;
812 cout <<
"\tprj.\t prj.\tprj." << endl;
813 cout <<
"\tview1\tview2\tview2" << endl;
814 cout <<
"\thandA\thandA\thandB" << endl;
815 cout <<
"\tvs.\tvs.\tvs.";
816 if (diff_out>0) cout <<
"\tview2, handA\tview2, handB";
818 cout <<
"Global\timage1\timage2\timage2";
819 if (diff_out>0) cout <<
"\tPhi\tTheta\tPsi\tPhi\tTheta\tPsi";
821 cout <<
"====================================";
822 if (diff_out>0) cout <<
"============================================";
839 double ToDeg = 180/
M_PI;
841 cout << setprecision(4);
843 if (which_one == 0) {
856 if (stats->
Tie > 0) cout <<
"NOTE: " << stats->
Tie <<
" particles in this pair did not favor either hand A or hand B" << endl;
857 if (diff_out > 0) cout <<
"*Average for pred. orientations is average of |measured angle - predicted angle|" << endl;
872 if (stats->
Tie > 0) cout <<
"NOTE: " << stats->
Tie <<
" particles in this analysis did not favor either hand A or hand B" << endl;
873 cout << endl <<
"NOTE: Hand A is handedness of input map. Mirror of input map is hand B." << endl;
900 int pcount1, pcount2;
908 if ( sel_consist < 1 || sel_consist > 2 ) {
909 cerr <<
"Error: " << sel_consist <<
" is a wrong value for setting consistent selection values." << endl <<
"Set to 1 or 2." << endl;
913 index = sel_consist - 1;
916 cout << endl <<
"Selection values in all micrographs set to those of micrograph view "
917 << sel_consist <<
" (standard)." << endl <<
"standard micrograph reset micrograph (field-of-view):" << endl;
921 for ( mg=field->
mg; mg; mg=mg->
next ) {
923 if (
verbose ) cout << mgstd->
id <<
" " << mg->
id <<
" (" << field->
id <<
")" << endl;
925 if ( pcount2 == pcount1 )
926 for ( particlestd=mgstd->
part, particle=mg->
part; particlestd && particle; particlestd=particlestd->
next, particle=particle->
next )
927 particle->
sel = particlestd->
sel;
930 for ( particlestd=mgstd->
part; particlestd; particlestd=particlestd->
next )
931 for ( particle=mg->
part; particle; particle=particle->
next )
932 if ( particle->
id == particlestd->
id ) {
933 particle->
sel = particlestd->
sel;
937 cout <<
"Micrograph " << mgstd->
id <<
" has " << pcount1 <<
" particles. Micrograph " << mg->
id <<
" has " << pcount2 <<
" particles." << endl;
938 cout <<
"Only " << i <<
" particle select values in micrograph " << mg->
id <<
" were changed." << endl;