| Bsoft 2.0.5 Bernard's software package

bico.cpp
Go to the documentation of this file.
1
10 #include "mg_processing.h"
11 #include "mg_reconstruct.h"
12 #include "rwmg.h"
13 #include "rwimg.h"
14 #include "rwsymop.h"
15 #include "symmetry.h"
16 #include "linked_list.h"
17 #include "utilities.h"
18 #include "options.h"
19 #include "timer.h"
20
21 // Declaration of global variables
22 extern int verbose; // Level of output to the screen
23
24 fft_plan planf, planb;
25
26 Bimage* project_ico_worst_vertex(Bproject* project, Bimage* pref,
27 Bimage* pmask, Bimage* pfsmask, double hires, double lores, double maxres);
28 Bimage* project_ico_opposite_vertex(Bproject* project, Bimage* pmask,
29 Bimage* pfsmask, double hires, double lores, double maxres);
30 Bimage* project_ico_best_c5(Bproject* project, Bimage* pref,
31 Bimage* pmask, Bimage* pfsmask, double hires, double lores, double maxres);
32 long project_assign_special_vertex_orientations(Bproject* project, Bproject* project_specvert);
33
34 // Usage assistance
35 const char* use[] = {
36 " ",
37 "Usage: bico [options] tomo.star",
38 "-------------------------------",
39 "Analyzes icosahedral subtomograms.",
40 " ",
41 "Actions:",
42 "-find opp Type of correlation: worst, opposite, c5.",
43 " ",
44 "Parameters:",
45 "-verbose 7 Verbosity of output.",
46 "-resolution 15.6,200 Resolution limits for cross-correlation (default 0,inf).",
47 "-maxresolution 9.5 Maximum reconstruction resolution limit (default Nyquist).",
48 " ",
49 "Input:",
50 "-reference image.map Reference for cross-correlation.",
51 "-mask image.map Real space mask.",
52 "-Mask fsmask.mrc Frequency space mask (missing data).",
53 "-special vert.star Parameter file with special vertex orientations.",
54 " ",
55 "Output:",
56 "-output file.star Output parameter file.",
57 "-reconstruction file.ext Reconstruction file name.",
58 " ",
59 NULL
60 };
61
62 int main(int argc, char **argv)
63 {
64 // Initialize variables
65 Bstring type; // Type of analysis: worst or opposite
66 double hires(0), lores(0); // Limiting resolution for cross-correlation
67 double maxres(0); // Maximum reconstruction resolution
68 Bstring ref_file; // Reference template file name
69 Bstring mask_file; // Real space mask
70 Bstring fsmask_file; // Frequency space missing mask
71 Bstring specvert_file; // Special vertex parameter file
72 Bstring outfile; // Output parameter file name
73 Bstring reconsfile; // Output reconstruction file
74
75 int optind;
76 Boption* option = get_option_list(use, argc, argv, optind);
77 Boption* curropt;
78 for ( curropt = option; curropt; curropt = curropt->next ) {
79 if ( curropt->tag == "find" )
80 type = curropt->value;
81 if ( curropt->tag == "resolution" )
82 if ( curropt->values(hires, lores) < 1 )
83 cerr << "-resolution: A high resolution limit must be specified!" << endl;
84 if ( curropt->tag == "maxresolution" )
85 if ( ( maxres = curropt->value.real() ) < 0.1 )
86 cerr << "-maxresolution: A resolution limit must be specified!" << endl;
87 if ( curropt->tag == "reference" )
88 ref_file = curropt->filename();
89 if ( curropt->tag == "mask" )
90 mask_file = curropt->filename();
91 if ( curropt->tag == "Mask" )
92 fsmask_file = curropt->filename();
93 if ( curropt->tag == "special" )
94 specvert_file = curropt->filename();
95 if ( curropt->tag == "output" )
96 outfile = curropt->filename();
97 if ( curropt->tag == "reconstruction" )
98 reconsfile = curropt->filename();
99 }
100 option_kill(option);
101
102 double ti = timer_start();
103
104 // Read all the parameter files
105 Bstring* file_list = NULL;
106 while ( optind < argc ) string_add(&file_list, argv[optind++]);
107 if ( !file_list ) {
108 cerr << "Error: No parameter files specified!" << endl;
109 bexit(-1);
110 }
111
112 Bproject* project = read_project(file_list);
113 string_kill(file_list);
114
115 if ( project == NULL ) {
116 cerr << "Error: No input file read!" << endl;
117 bexit(-1);
118 }
119
120 Vector3<long> size;
121 Bimage* pref = NULL;
122 if ( ref_file.length() ) {
123 pref = read_img(ref_file, 1, 0);
124 } else {
125 pref = project_reconstruct_3D(project, -1, size, maxres);
126 write_img("reference.mrc", pref, 0);
127 }
128
129 if ( !pref ) {
130 cerr << "Error: No template map!" << endl;
131 bexit(-1);
132 }
133
134 Bimage* pmask = NULL;
135 if ( mask_file.length() ) {
136 pmask = read_img(mask_file, 1, 0);
137 pref->multiply(pmask);
138 }
139
140 Bimage* pfsmask = NULL;
141 if ( fsmask_file.length() ) {
142 pfsmask = read_img(fsmask_file, 1, 0);
143 if ( pfsmask->image->origin().length() < 1 )
144 pfsmask->center_wrap(); // Make sure the origin is in the center
145 }
146
147 Bimage* pavg = NULL;
148
149 if ( type.length() ) {
150 if ( type[0] == 'w' ) {
151 pavg = project_ico_worst_vertex(project, pref, pmask, pfsmask, hires, lores, maxres);
152 } else if ( type[0] == 'o' ) {
153 pavg = project_ico_opposite_vertex(project, pmask, pfsmask, hires, lores, maxres);
154 } else if ( type == "c5" ) {
155 pavg = project_ico_best_c5(project, pref, pmask, pfsmask, hires, lores, maxres);
156 }
157 }
158
159 if ( specvert_file.length() ) {
160 Bproject* project_specvert = read_project(specvert_file);
161 project_assign_special_vertex_orientations(project, project_specvert);
162 project_kill(project_specvert);
163 }
164
165 project_update_comment(project, argc, argv);
166
167 if ( project && outfile.length() )
168 write_project(outfile, project, 0, 0);
169
170 long i(0);
171 Bstring filename(reconsfile);
172 if ( pavg && reconsfile.length() ) {
173 for ( Bimage* p = pavg; p; p = p->next ) {
174 p->label(get_cmd_line(argc, argv));
175 if ( pavg->next ) filename = reconsfile.pre_rev('.') + Bstring(++i, "_%02d.") + reconsfile.post_rev('.');
176 if ( verbose )
177 cout << "Writing " << filename << endl;
178 write_img(filename, p, 0);
179 }
180 /* pavg->next->label(get_cmd_line(argc, argv));
181 filename = reconsfile.pre_rev('.') + "_02." + reconsfile.post_rev('.');
182 if ( verbose )
183 cout << "Writing " << filename << endl;
184 write_img(filename, pavg->next, 0);*/
185 }
186
187 project_kill(project);
188 delete pavg;
189 delete pmask;
190 delete pfsmask;
191
192 if ( verbose & VERB_TIME )
193 timer_report(ti);
194
195 bexit(0);
196 }
197
198 Bimage* img_read_orient_mask(Bstring& filename, Bimage* pmask, View view)
199 {
200 Bimage* p = read_img(filename, 1, 0);
201
202 if ( !p ) {
203 error_show("img_read_mask_orient", __FILE__, __LINE__);
204 return p;
205 }
206
207 p->rotate(view);
208
209 if ( pmask ) p->multiply(pmask);
210
211 p->image->view(view);
212
213 return p;
214 }
215
216 double img_cc(Bimage* p1, Bimage* p2, Bimage* pfsmask, double hires, double lores)
217 {
218 // double cc(1);
219 Bimage* pfsmrot = NULL;
220 if ( pfsmask ) {
221 pfsmrot = pfsmask->copy();
222 if ( pfsmrot->image->origin().length() < 1 )
223 pfsmrot->center_wrap();
224 pfsmrot->rotate(p1->image->view());
225 pfsmrot->zero_origin();
226 }
227
228 p1->find_shift(0, p2, pfsmrot, hires, lores, 0.5, planf, planb);
229 /*
230 if ( cc <= 1e-10 ) {
231 cerr << "Correlation coefficient too small! " << cc << endl;
232 bexit(-1);
233 }*/
234
235 delete pfsmrot;
236
237 return p1->image->FOM();
238 }
239
240 long particle_worst_vertex(Bparticle* vert, Bimage* pref, Bimage* pmask, Bimage* pfsmask, double hires, double lores)
241 {
242 long i, psel(0);
243 double cc_worst(1);
244 Bparticle* worst = NULL;
245
246 vector<Bparticle*> varr(12);
247
248 for ( i=0, worst = vert; worst && i<12; worst = worst->next, ++i )
249 varr[i] = worst;
250
251 #ifdef HAVE_GCD
252 dispatch_apply(11, dispatch_get_global_queue(0, 0), ^(size_t i){
253 Bparticle* v = varr[i];
254 Bimage* p = img_read_orient_mask(v->fpart, pmask, v->view);
255 v->fom[0] = img_cc(p, pref, pfsmask, hires, lores);
256 delete p;
257 });
258 #else
259 #pragma omp parallel for
260 for ( i=0; i<12; ++i ) {
261 Bparticle* v = varr[i];
262 Bimage* p = img_read_orient_mask(v->fpart, pmask, v->view);
263 v->fom[0] = img_cc(p, pref, pfsmask, hires, lores);
264 delete p;
265 }
266 #endif
267
268 for ( i=0; vert && i<12; vert = vert->next, ++i ) {
269 if ( verbose & VERB_FULL )
270 cout << vert->sel << tab << vert->fom[0] << endl;
271 if ( cc_worst > vert->fom[0] ) {
272 psel = vert->sel;
273 cc_worst = vert->fom[0];
274 worst = vert;
275 }
276 vert->sel = 1;
277 }
278
279 if ( worst )
280 worst->sel = 2;
281
282 return psel;
283 }
284
285 long particle_cc_opposite_vertices(Bparticle* vert, Bimage* pmask,
286 Bimage* pfsmask, double hires, double lores)
287 {
288 long i, j, psel(0);
289 double at(M_PI - 0.02), cc, cc_worst(1);
290 Bparticle* vert1 = vert;
291 Bparticle* vert2;
292 Bparticle* worst = NULL;
293 Bparticle* worst2 = NULL;
294 Bimage *p1, *p2;
295
296 for ( i=0, vert2 = vert1; vert2 && i<12; vert2 = vert2->next, ++i )
297 vert2->fom[0] = -2;
298
299 for ( i=0; vert && i<11; vert = vert->next, ++i ) if ( vert->fom[0] < -1 ) {
300 p1 = img_read_orient_mask(vert->fpart, pmask, vert->view);
301 for ( j=i+1, vert2 = vert->next; vert2 && j<12; vert2 = vert2->next, ++j )
302 if ( vert->view.backward().angle(vert2->view.backward()) > at ) break;
303 if ( j<12 && vert2 ) {
304 p2 = img_read_orient_mask(vert2->fpart, pmask, vert2->view);
305 cc = img_cc(p1, p2, pfsmask, hires, lores);
306 delete p2;
307 vert->fom[0] = vert2->fom[0] = cc;
308 if ( verbose & VERB_FULL )
309 cout << vert->sel << " - " << vert2->sel << tab << cc << endl;
310 if ( cc_worst > cc ) {
311 psel = vert->sel;
312 cc_worst = cc;
313 worst = vert;
314 worst2 = vert2;
315 }
316 }
317 delete p1;
318 }
319
320 for ( i=0, vert2 = vert1; vert2 && i<12; vert2 = vert2->next, ++i )
321 vert2->sel = 1;
322
323 if ( worst )
324 worst->sel = worst2->sel = 2;
325
326 return psel;
327 }
328
329 long particle_worst_opposite_vertex(Bparticle* vert, Bimage* pref,
330 Bimage* pmask, Bimage* pfsmask, double hires, double lores)
331 {
332 long i, psel(0);
333 double cc, cc1(0);
334 Bparticle* vert1 = NULL;
335 Bparticle* vert2;
336 Bimage* p;
337
338 for ( i=1, vert2 = vert; vert2 && i<=12; vert2 = vert2->next, ++i ) {
339 if ( vert2->sel == 2 ) {
340 p = img_read_orient_mask(vert2->fpart, pmask, vert2->view);
341 cc = img_cc(p, pref, pfsmask, hires, lores);
342 delete p;
343 if ( vert1 ) {
344 if ( cc1 > cc ) {
345 vert1->sel = 1;
346 } else {
347 vert2->sel = 1;
348 psel = i;
349 }
350 break;
351 } else {
352 vert1 = vert2;
353 cc1 = cc;
354 psel = i;
355 }
356 }
357 }
358
359 return psel;
360 }
361
362 long particle_best_c5(Bparticle* part, Bimage* pref, Bimage* pmask,
363 Bimage* pfsmask, double hires, double lores)
364 {
365 long i, psel(0);
366 double* cc = new double[5];
367
368 Bsymmetry* sym = init_point_group_symmetry("C5");
369 View* views = symmetry_get_all_views(sym, part->view);
370 View* v;
371 vector<View> view_arr(5);
372 for ( i=0, v=views; v; v=v->next, ++i ) view_arr[i] = *v;
373 kill_list((char *) views, sizeof(View));
374
375 #ifdef HAVE_GCD
376 dispatch_apply(4, dispatch_get_global_queue(0, 0), ^(size_t i){
377 Bimage* p = img_read_orient_mask(part->fpart, pmask, view_arr[i]);
378 cc[i] = img_cc(p, pref, pfsmask, hires, lores);
379 delete p;
380 });
381 #else
382 #pragma omp parallel for
383 for ( i=0; i<5; ++i ) {
384 Bimage* p = img_read_orient_mask(part->fpart, pmask, view_arr[i]);
385 cc[i] = img_cc(p, pref, pfsmask, hires, lores);
386 delete p;
387 }
388 #endif
389
390 part->fom[0] = -1;
391 for ( i=0; i<5; ++i ) {
392 if ( verbose & VERB_FULL )
393 cout << i << tab << cc[i] << endl;
394 if ( part->fom[0] < cc[i] ) {
395 psel = i+1;
396 part->fom[0] = cc[i];
397 part->view = view_arr[i];
398 }
399 }
400
401 delete[] cc;
402
403 return psel;
404 }
405
423 Bimage* project_ico_worst_vertex(Bproject* project, Bimage* pref,
424 Bimage* pmask, Bimage* pfsmask, double hires, double lores, double maxres)
425 {
426 if ( hires < 2*project->rec->voxel_size ) hires = 4*project->rec->voxel_size;
427 if ( lores < hires ) lores = 1e6;
428 if ( maxres > hires ) maxres = hires;
429
430 if ( !pref ) {
431 cerr << "Error: No template map!" << endl;
432 return NULL;
433 }
434
435 planf = pref->fft_setup(FFTW_FORWARD, 1);
436 planb = pref->fft_setup(FFTW_BACKWARD, 1);
437
438 long i, psel;
439 Vector3<long> size;
440 Breconstruction* rec;
441 Bparticle* part;
442 Bparticle* vert;
443
444 if ( verbose ) {
445 cout << "Determining the special vertices:" << endl;
446 cout << "Resolution limits: " << hires << " - " << lores << " A" << endl;
447 if ( pref )
448 cout << "Reference: " << pref->file_name() << endl;
449 if ( pmask )
450 cout << "Real space mask: " << pmask->file_name() << endl;
451 if ( pfsmask )
452 cout << "Frequency space mask: " << pfsmask->file_name() << endl;
453 }
454
455 for ( rec = project->rec; rec; rec = rec->next ) if ( rec->part ) {
456 if ( verbose ) {
457 cout << "Reconstruction: " << rec->frec << endl;
458 cout << "Particle\tSpecial vertex" << endl;
459 }
460 for ( i=1, vert = part = rec->part; part; part = part->next, ++i ) {
461 if ( i == 12 ) {
462 psel = particle_worst_vertex(vert, pref, pmask, pfsmask, hires, lores);
463 if ( verbose )
464 cout << vert->group << tab << psel << endl;
465 vert = part->next;
466 i = 0;
467 }
468 }
469 }
470
471 delete pref;
472
473 /* Bimage* pavg = project_reconstruct_3D(project, 1, 0, size);
474 delete pavg->next;
475
476 pavg->next = project_reconstruct_3D(project, 2, 0, size);
477 */
478 Bimage* pavg = project_reconstruct_3D(project, 1, size, maxres);
479 delete pavg->next;
480
481 pavg->next = project_reconstruct_3D(project, 2, size, maxres);
482
483 fft_destroy_plan(planf);
484 fft_destroy_plan(planb);
485
486 delete pavg->next->next;
487 pavg->next->next = NULL;
488
489 return pavg;
490 }
491
511 Bimage* project_ico_opposite_vertex(Bproject* project, Bimage* pmask,
512 Bimage* pfsmask, double hires, double lores, double maxres)
513 {
514 if ( hires < 2*project->rec->voxel_size ) hires = 4*project->rec->voxel_size;
515 if ( lores < hires ) lores = 1e6;
516 if ( maxres > hires ) maxres = hires;
517
518 long i, psel;
519 Breconstruction* rec;
520 Bparticle* part;
521 Bparticle* vert;
522
523 if ( verbose ) {
524 cout << "Determining the special vertices:" << endl;
525 cout << "Resolution limits: " << hires << " - " << lores << " A" << endl;
526 if ( pmask )
527 cout << "Real space mask: " << pmask->file_name() << endl;
528 if ( pfsmask )
529 cout << "Frequency space mask: " << pfsmask->file_name() << endl;
530 }
531
532 planf = fft_setup_plan(project->rec->box_size, FFTW_FORWARD, 1);
533 planb = fft_setup_plan(project->rec->box_size, FFTW_BACKWARD, 1);
534
535 for ( rec = project->rec; rec; rec = rec->next ) if ( rec->part ) {
536 if ( verbose ) {
537 cout << "Reconstruction: " << rec->frec << endl;
538 cout << "Particle\tVertex pair" << endl;
539 }
540 for ( i=1, vert = part = rec->part; part; part = part->next, ++i ) {
541 if ( i == 12 ) {
542 psel = particle_cc_opposite_vertices(vert, pmask, pfsmask, hires, lores);
543 if ( verbose )
544 cout << vert->group << tab << psel << endl;
545 vert = part->next;
546 i = 0;
547 }
548 }
549 }
550
551 Vector3<long> size;
552 Bimage* pavg = project_reconstruct_3D(project, 1, size, maxres);
553 /*
554 if ( mask_file.length() ) {
555 pmask = read_img(mask_file, 1, 0);
556 pavg->multiply(pmask);
557 }
558 */
559 for ( rec = project->rec; rec; rec = rec->next ) if ( rec->part ) {
560 if ( verbose ) {
561 cout << "Reconstruction: " << rec->frec << endl;
562 cout << "Particle\tSpecial vertex" << endl;
563 }
564 for ( i=1, vert = part = rec->part; part; part = part->next, ++i ) {
565 if ( i == 12 ) {
566 psel = particle_worst_opposite_vertex(vert, pavg, pmask, pfsmask, hires, lores);
567 if ( verbose )
568 cout << vert->group << tab << psel << endl;
569 vert = part->next;
570 i = 0;
571 }
572 }
573 }
574
575 pavg->next = project_reconstruct_3D(project, 2, size, maxres);
576
577 fft_destroy_plan(planf);
578 fft_destroy_plan(planb);
579
580 delete pavg->next->next;
581 pavg->next->next = NULL;
582
583 return pavg;
584 }
585
606 Bimage* project_ico_best_c5(Bproject* project, Bimage* pref,
607 Bimage* pmask, Bimage* pfsmask, double hires, double lores, double maxres)
608 {
609 if ( hires < 2*project->rec->voxel_size ) hires = 4*project->rec->voxel_size;
610 if ( lores < hires ) lores = 1e6;
611 if ( maxres > hires ) maxres = hires;
612
613 long psel, n(0), nc(0);
614 Breconstruction* rec;
615 Bparticle* part;
616
617 if ( !pref ) {
618 cerr << "Error: No template map!" << endl;
619 return NULL;
620 }
621
622 if ( verbose ) {
623 cout << "Determining the best 5-fold for each vertex:" << endl;
624 cout << "Resolution limits: " << hires << " - " << lores << " A" << endl;
625 cout << "Reference: " << pref->file_name() << endl;
626 if ( pmask )
627 cout << "Real space mask: " << pmask->file_name() << endl;
628 if ( pfsmask )
629 cout << "Frequency space mask: " << pfsmask->file_name() << endl;
630 }
631
632 planf = fft_setup_plan(project->rec->box_size, FFTW_FORWARD, 1);
633 planb = fft_setup_plan(project->rec->box_size, FFTW_BACKWARD, 1);
634
635 for ( rec = project->rec; rec; rec = rec->next ) if ( rec->part ) {
636 if ( verbose ) {
637 cout << "Reconstruction: " << rec->frec << endl;
638 cout << "Particle\tBestC5" << endl;
639 }
640 for ( part = rec->part; part; part = part->next ) {
641 if ( part->sel == 2 ) {
642 psel = particle_best_c5(part, pref, pmask, pfsmask, hires, lores);
643 if ( verbose )
644 cout << part->group << tab << psel << endl;
645 n++;
646 if ( psel > 1 ) nc++;
647 }
648 }
649 }
650
651 if ( verbose )
652 cout << "Number of view changes: " << nc << " (" << nc*100.0/n << "%)" << endl;
653
654 Vector3<long> size;
655 Bimage* pavg = project_reconstruct_3D(project, 2, size, maxres);
656
657 fft_destroy_plan(planf);
658 fft_destroy_plan(planb);
659
660 delete pavg->next;
661 pavg->next = NULL;
662
663 return pavg;
664 }
665
666 long project_assign_special_vertex_orientations(Bproject* project, Bproject* project_specvert)
667 {
668 long i, npart(0);
669
670 Breconstruction* rec, *rec_sv;
671 Bparticle* part, *vert;
672
673 if ( verbose )
674 cout << "Transferring the special vertex orientations" << endl;
675
676 for ( rec = project->rec; rec; rec = rec->next ) if ( rec->part ) {
677 for ( rec_sv = project_specvert->rec; rec_sv; rec_sv = rec_sv->next )
678 if ( rec_sv->id == rec->id && rec->frec == rec_sv->frec ) break;
679 if ( rec_sv && rec_sv->part ) {
680 if ( verbose )
681 cout << "Reconstruction: " << rec->frec << endl;
682 vert = rec_sv->part;
683 for ( part = rec->part; part; part = part->next ) {
684 if ( part->id == vert->group ) {
685 for ( i=0; vert && i<12; vert = vert->next, ++i ) {
686 cout << part->id << tab << vert->id << tab << vert->sel << endl;
687 if ( vert->sel == 2 ) {
688 part->view = vert->view;
689 npart++;
690 }
691 }
692 } else {
693 cerr << "Error: reconstruction " << rec->id << " particle " << part->id << endl;
694 }
695 }
696 }
697 }
698
699 if ( verbose )
700 cout << "Number of particles updated: " << npart << endl;
701
702 return npart;
703 }
704
705
write_project
int write_project(const char *filename, Bproject *project)
Writing micrograph parameters to a file.
Definition: rwmg.cpp:320
Bparticle::id
int id
Definition: mg_processing.h:92
rwmg.h
Header file for reading and writing micrograph parameters.
Bstring::real
double real()
Definition: Bstring.cpp:545
string_add
Bstring * string_add(Bstring **list, const char *string)
Adds a string to a linked list.
Definition: Bstring.cpp:705
Bproject::rec
Breconstruction * rec
Definition: mg_processing.h:344
Bsub_image::view
void view(double x, double y, double z, double a)
Definition: Bimage.h:143
Bparticle::view
View view
Definition: mg_processing.h:101
Breconstruction::part
Bparticle * part
Definition: mg_processing.h:304
planb
fft_plan planb
Definition: bico.cpp:24
View::next
View * next
Definition: View.h:28
project_ico_worst_vertex
Bimage * project_ico_worst_vertex(Bproject *project, Bimage *pref, Bimage *pmask, Bimage *pfsmask, double hires, double lores, double maxres)
Determines the special vertex for icosahedral symmetry and returns two maps.
Definition: bico.cpp:423
symmetry.h
Header file for general symmetry functions.
utilities.h
Header file for general utilities.
Boption::value
Bstring value
Definition: options.h:30
Breconstruction
Definition: mg_processing.h:280
Boption::tag
Bstring tag
Definition: options.h:29
planf
fft_plan planf
Definition: bico.cpp:24
kill_list
long kill_list(char *list, unsigned long size)
Frees all the items in a linked list.
Definition: linked_list.cpp:214
Bparticle::fom
double fom[NFOM]
Definition: mg_processing.h:102
read_project
Bproject * read_project(const char *filename, int flags=0)
Reading micrograph parameters from files.
Definition: rwmg.cpp:140
Bstring::length
long length() const
Definition: Bstring.cpp:263
project
Bproject * project
Definition: bshow.cpp:31
main
int main(int argc, char **argv)
Definition: bico.cpp:62
rwsymop.h
Header file for reading and writing symmetry operators.
particle_best_c5
long particle_best_c5(Bparticle *part, Bimage *pref, Bimage *pmask, Bimage *pfsmask, double hires, double lores)
Definition: bico.cpp:362
Bimage::file_name
void file_name(string s)
Definition: Bimage.h:230
Bimage::multiply
void multiply(long j, Complex< double > cv)
Definition: Bimage.h:312
Bimage::center_wrap
int center_wrap()
Centers an image with wrapping.
Definition: Bimage_transform.cpp:713
project_reconstruct_3D
Bimage * project_reconstruct_3D(Bproject *project, long selnum, int calcfom, Vector3< long > size)
Transforms 3D maps and calculates an average.
Definition: mg_reconstruct.cpp:1235
get_option_list
Boption * get_option_list(const char *use[], int argc, char *argv[], int &optind)
Parses command line arguments based on a template.
Definition: options.cpp:40
Breconstruction::box_size
Vector3< long > box_size
Definition: mg_processing.h:296
read_img
Bimage * read_img(char *filename, int readdata, int img_select)
General driver function to read multiple image formats.
Definition: rwimg.cpp:76
particle_worst_opposite_vertex
long particle_worst_opposite_vertex(Bparticle *vert, Bimage *pref, Bimage *pmask, Bimage *pfsmask, double hires, double lores)
Definition: bico.cpp:329
img_cc
double img_cc(Bimage *p1, Bimage *p2, Bimage *pfsmask, double hires, double lores)
Definition: bico.cpp:216
get_cmd_line
string get_cmd_line(int argc, char **argv)
Returns the command line as a string.
Definition: utilities.cpp:36
Boption::filename
Bstring filename()
Definition: options.h:85
timer.h
Utilities for timing functions.
Bimage
General image parameter class.
Definition: Bimage.h:163
use
const char * use[]
Definition: bico.cpp:35
Bparticle::sel
long sel
Definition: mg_processing.h:103
M_PI
#define M_PI
Definition: utilities.h:59
linked_list.h
Header file for generalized linked list functions.
Bimage::zero_origin
int zero_origin()
Shifts the origins to zero with wrapping.
Definition: Bimage_transform.cpp:727
Boption
A class for a command line input option.
Definition: options.h:26
VERB_TIME
#define VERB_TIME
Definition: utilities.h:110
project_assign_special_vertex_orientations
long project_assign_special_vertex_orientations(Bproject *project, Bproject *project_specvert)
Definition: bico.cpp:666
fft_plan
fftwf_plan fft_plan
Definition: fft.h:16
Bsub_image::FOM
double FOM()
Definition: Bimage.h:151
init_point_group_symmetry
Bsymmetry * init_point_group_symmetry(Bstring symmetry_string)
Sets up a symmetry structure from a string identifier.
Definition: symmetry.cpp:39
View::backward
View backward()
Definition: View.h:115
write_img
int write_img(const char *filename, Bimage *p, int compression)
General driver function to write multiple image formats.
Definition: rwimg.cpp:280
Bparticle::group
int group
Definition: mg_processing.h:93
Bparticle::fpart
Bstring fpart
Definition: mg_processing.h:91
Bsub_image::origin
void origin(double x, double y, double z)
Definition: Bimage.h:127
Bstring::post_rev
Bstring post_rev(char c)
Definition: Bstring.cpp:428
Bsymmetry
Definition: symmetry.h:38
Bimage::next
Bimage * next
Definition: Bimage.h:165
verbose
int verbose
Boption::next
Boption * next
Definition: options.h:28
Bparticle
Definition: mg_processing.h:89
Bstring
Definition: Bstring.h:29
Bimage::copy
Bimage * copy()
Copies the header information and data of an image into a new image structure.
Definition: Bimage.cpp:2695
particle_worst_vertex
long particle_worst_vertex(Bparticle *vert, Bimage *pref, Bimage *pmask, Bimage *pfsmask, double hires, double lores)
Definition: bico.cpp:240
Bimage::fft_setup
fft_plan fft_setup(fft_direction dir, int opt=0)
Sets up a plan for fast Fourier transforms.
Definition: Bimage_fft.cpp:29
project_kill
int project_kill(Bproject *project)
Frees a whole project.
Definition: mg_processing.cpp:1224
particle_cc_opposite_vertices
long particle_cc_opposite_vertices(Bparticle *vert, Bimage *pmask, Bimage *pfsmask, double hires, double lores)
Definition: bico.cpp:285
img_read_orient_mask
Bimage * img_read_orient_mask(Bstring &filename, Bimage *pmask, View view)
Definition: bico.cpp:198
Vector3< long >
fft_destroy_plan
int fft_destroy_plan(fft_plan plan)
Deallocates a plan for fast Fourier transforms.
Definition: fft.cpp:87
timer_report
double timer_report(double lasttime)
Reports the time elapsed since a given time.
Definition: timer.cpp:67
View::angle
double angle()
Definition: View.h:95
View
Definition: View.h:26
Bimage::rotate
int rotate()
Rotates an image using parameters defined in the image in place.
Definition: Bimage_transform.cpp:253
Bimage::find_shift
int find_shift(Bimage *pref, Bimage *pmask, double hires, double lores, double radius, double sigma, int refine_flag)
Calculates a cross-correlation map to find the shift for the pair of images.
Definition: Bimage_correlate.cpp:932
fft_setup_plan
fft_plan fft_setup_plan(long x, long y, long z, fft_direction dir, int opt)
Sets up a plan for fast Fourier transforms.
Definition: fft.cpp:31
project_ico_opposite_vertex
Bimage * project_ico_opposite_vertex(Bproject *project, Bimage *pmask, Bimage *pfsmask, double hires, double lores, double maxres)
Determines the special vertex for icosahedral symmetry and returns two maps.
Definition: bico.cpp:511
option_kill
int option_kill(Boption *option)
Deallocates a linked list of option structures.
Definition: options.cpp:109
mg_processing.h
Header file for micrograph processing.
Breconstruction::frec
Bstring frec
Definition: mg_processing.h:287
Breconstruction::voxel_size
double voxel_size
Definition: mg_processing.h:292
project_ico_best_c5
Bimage * project_ico_best_c5(Bproject *project, Bimage *pref, Bimage *pmask, Bimage *pfsmask, double hires, double lores, double maxres)
Determines the best 5-fold orientation of the vertex wrt a reference.
Definition: bico.cpp:606
rwimg.h
Header file for 2D and 3D image I/O.
options.h
Header file for option handlers.
Bstring::pre_rev
Bstring pre_rev(char c)
Definition: Bstring.cpp:413
mg_reconstruct.h
Functions for reconstruction.
project_update_comment
int project_update_comment(Bproject *project, int n, char **strings)
Puts a set of strings and time in the main comment of a project.
Definition: rwmg.cpp:468
Bparticle::next
Bparticle * next
Definition: mg_processing.h:90
VERB_FULL
#define VERB_FULL
Definition: utilities.h:109
Boption::values
long values(T1 &v1, T2 &v2)
Definition: options.h:115
bexit
int bexit(int value)
Exit function for cleanup and debugging.
Definition: utilities.cpp:273
Breconstruction::next
Breconstruction * next
Definition: mg_processing.h:281
timer_start
double timer_start()
Starts timer and prints the time.
Definition: timer.cpp:52
symmetry_get_all_views
View * symmetry_get_all_views(Bsymmetry *sym, View asu_view)
Get all symmetry-related views of one given view.
Definition: symmetry.cpp:448
error_show
int error_show(string message, string file, int line)
Displays the error with file and line reference.
Definition: utilities.cpp:755
tab
ostream & tab(ostream &out)
Definition: utilities.cpp:21
Bproject
Definition: mg_processing.h:333
Bimage::image
Bsub_image * image
Definition: Bimage.h:188
Breconstruction::id
Bstring id
Definition: mg_processing.h:282
string_kill
int string_kill(Bstring *list)
Kills a string linked list.
Definition: Bstring.cpp:760