| Bsoft 2.0.5 Bernard's software package

ps_micrograph.cpp
Go to the documentation of this file.
1
9 #include "ps_micrograph.h"
10 #include "ps_plot.h"
11 #include "ps_views.h"
12 #include "rwimg.h"
13 #include "symmetry.h"
14 #include "linked_list.h"
15 #include "utilities.h"
16
17 // Declaration of global variables
18 extern int verbose; // Level of output to the screen
19
20 // Internal function prototypes
21 int ps_origins(ofstream* fps, Bstring& title, Bproject* project, int flags);
22
30 int ps_mg_particle_positions(Bstring& filename, Bstring& title, Bproject* project)
31 {
32 int i, width = 0, height = 0, left=50, bottom=50, nmg = 0;
33
34 Bfield* field = project->field;
35 if ( !field ) return -1;
36
37 Bmicrograph* mg = field->mg;
38 if ( !mg ) return -1;
39
40 Bparticle* part = mg->part;
41 if ( !part ) return -1;
42
43 Bimage* p;
44
45 // Find the dimensions of the micrographs from the coordinate sets
46 for ( field=project->field; field; field=field->next ) {
47 for ( mg=field->mg; mg; mg=mg->next ) {
48 p = read_img(mg->fmg, 0, 0);
49 if ( !p ) {
50 error_show("Error in ps_mg_particle_positions", __FILE__, __LINE__);
51 cerr << "Micrograph " << mg->fmg << " not found" << endl;
52 return -1;
53 }
54 if ( width < p->sizeX() ) width = p->sizeX();
55 if ( height < p->sizeY() ) height = p->sizeY();
56 delete p;
57 nmg++;
58 }
59 }
60 if ( verbose & VERB_DEBUG )
61 cout << "DEBUG ps_mg_particle_positions: width=" << width << " height=" << height << endl;
62
63 float scale(500.0/width);
64 if ( scale > 700.0/height ) scale = 700.0/height;
65
66 ofstream* fps = ps_open_and_init(filename, title, nmg, 600, 800);
67
68 for ( field=project->field; field; field=field->next ) {
69 for ( i=0, mg=field->mg; mg; mg=mg->next, i++ ) {
70 *fps << "%%%%Page: " << i+1 << " " << i+1 << endl;
71 *fps << "/Helvetica findfont 12 scalefont setfont" << endl;
72 *fps << "50 755 moveto (" << title << ": " << mg->fpart << ") show" << endl;
73 *fps << "/Scale " << scale << " def" << endl;
74 *fps << "/Height 700 def\n/Width 500 def" << endl;
75 *fps << "/Frame { newpath 0 0 moveto Width 0 lineto Width Height lineto 0 Height lineto closepath } def" << endl;
76
77 *fps << "/Data [\n%x y mag sel" << endl;
78 for ( part=mg->part; part; part=part->next ) if ( part->sel )
79 *fps << part->loc[0] << " " << part->loc[1] << " " <<
80 part->mag << " " << part->sel << endl;
81 *fps << "] def" << endl;
82
83 *fps << "gsave" << endl;
84 *fps << " " << left << " " << bottom << " translate" << endl;
85 *fps << " Frame stroke" << endl;
86 // *fps << " Frame clip" << endl;
87 *fps << " Scale Scale scale" << endl;
88 *fps << " /Helvetica findfont 64 scalefont setfont" << endl;
89 *fps << " 0 4 Data length 4 sub { " << endl;
90 *fps << " /Index exch def" << endl;
91 *fps << " /x Data Index get def" << endl;
92 *fps << " /y Data Index 1 add get def" << endl;
93 *fps << " /mag Data Index 2 add get def" << endl;
94 *fps << " /sel Data Index 3 add get def" << endl;
95 *fps << " x y moveto 0 30 rmoveto sel cvi (xxxx) cvs show stroke" << endl;
96 *fps << " x y moveto 0 -30 rmoveto mag cvr (x.xxx) cvs show stroke" << endl;
97 *fps << " } for" << endl;
98 *fps << "grestore" << endl;
99
100 *fps << "showpage" << endl;
101 }
102 }
103
104 ps_close(fps);
105
106 return 0;
107 }
108
121 int ps_particle_views_origins(Bstring& filename, Bstring& title,
122 Bstring& symmetry_string, Bproject* project, int selection)
123 {
124 Bsymmetry* sym = init_point_group_symmetry(symmetry_string);
125
126 View* view = views_from_project(project, selection);
127
128 change_views_to_asymmetric_unit(sym, view);
129
130 kill_symmetry(sym);
131
132 if ( verbose & VERB_LABEL )
133 cout << "Writing postscript file: " << filename << endl << endl;
134
135 ofstream* fps = ps_open_and_init(filename, symmetry_string, 1, 600, 800);
136
137 *fps << "/Helvetica-Bold findfont 20 scalefont setfont" << endl;
138 *fps << "40 740 moveto (" << filename << ") show" << endl;
139
140 ps_views(fps, symmetry_string, view, 2);
141
142 kill_list((char *) view, sizeof(View));
143
144 *fps << "/Helvetica-Bold findfont 20 scalefont setfont" << endl;
145 *fps << "40 740 moveto (" << filename << ") show" << endl;
146
147 ps_origins(fps, title, project, 2);
148
149 ps_close(fps);
150
151 return 0;
152 }
153
170 int ps_origins(Bstring& filename, Bstring& title, Bproject* project, int flags)
171 {
172 if ( verbose & VERB_LABEL )
173 cout << "Writing postscript file: " << filename << endl << endl;
174
175 ofstream* fps = ps_open_and_init(filename, title, 1, 600, 800);
176
177 *fps << "/Helvetica-Bold findfont 20 scalefont setfont" << endl;
178 *fps << "40 740 moveto (" << filename << ") show" << endl;
179
180 ps_origins(fps, title, project, flags);
181
182 ps_close(fps);
183
184 return 0;
185 }
186
187 int ps_origins(ofstream* fps, Bstring& title, Bproject* project, int flags)
188 {
189 if ( verbose & VERB_DEBUG )
190 cout << "DEBUG ps_origins: flags=" << flags << endl;
191
192 int left(50), bottom(150), width(500), height(500);
193 Bfield* field = project->field;
194 Bmicrograph* mg = NULL;
195 Breconstruction* rec = project->rec;
196 Bparticle* part = NULL;
197
198 // Discover the dimension of the first particle image
199 // I supposed that the rest have the same dimentions (not always true).
200 Bimage* p = NULL;
201 long nx = 0, ny = 0, nz = 0;
202
203 if ( project->select < 1 ) {
204 if ( field && field->mg ) {
205 nx = (long) field->mg->box_size[0];
206 ny = (long) field->mg->box_size[1];
207 nz = 1;
208 }
209 for ( field = project->field; field && !p; field = field->next )
210 for ( mg = field->mg; mg && !p; mg = mg->next )
211 if ( ! access(mg->fpart.c_str(), R_OK) )
212 p = read_img(mg->fpart, 0, 0); // Read one image header
213 } else {
214 if ( rec ) {
215 nx = (long) rec->box_size[0];
216 ny = (long) rec->box_size[1];
217 nz = (long) rec->box_size[2];
218 }
219 for ( rec = project->rec; rec && !p; rec = rec->next ) {
220 if ( ! access(rec->fpart.c_str(), R_OK) )
221 p = read_img(rec->fpart, 0, 0); // Read one image header
222 for ( part = rec->part; part && !p; part = part->next )
223 if ( ! access(part->fpart.c_str(), R_OK) )
224 p = read_img(part->fpart, 0, 0); // Read one image header
225 }
226 }
227
228 if ( p ) {
229 nx = p->sizeX();
230 ny = p->sizeY();
231 nz = p->sizeZ();
232 delete p;
233 }
234
235 if ( nx*ny < 1 ) {
236 error_show("Error in ps_origins: zero image size!", __FILE__, __LINE__);
237 return -1;
238 }
239
240 long n = 0; // number of particles
241 float cx = nx/2;
242 float cy = ny/2;
243 float scale = width*1.0/nx;
244 if ( verbose & VERB_FULL ) {
245 cout << "Dimensions of the image particles: " << nx << " * " << ny << endl;
246 cout << "Center of the particle images: " << cx << " * " << cy << endl;
247 }
248
249 long i, m, ix, iy;
250 float* count = NULL;
251
252 if ( flags == 2 ) {
253 count = new float[nx*ny];
254 for ( i=0; i<nx*ny; i++ ) count[i] = 0;
255 if ( project->select < 1 ) {
256 for ( n=m=0, field = project->field; field; field = field->next )
257 for ( mg = field->mg; mg; mg = mg->next )
258 for ( part = mg->part; part; part = part->next )
259 if ( part->sel > 0 ) {
260 ix = (long) part->ori[0];
261 iy = (long) part->ori[1];
262 if ( ix < 0 ) ix += nx;
263 if ( iy < 0 ) iy += ny;
264 if ( ix >= 0 && iy >= 0 && ix < nx && iy < ny ) {
265 i = iy*nx+ix;
266 count[i]++;
267 if ( m < count[i] ) m = (int) count[i];
268 n++;
269 }
270 }
271 } else {
272 for ( n=m=0, rec = project->rec; rec; rec = rec->next )
273 for ( part = rec->part; part; part = part->next )
274 if ( part->sel > 0 ) {
275 ix = (long) part->ori[0];
276 iy = (long) part->ori[1];
277 if ( ix < 0 ) ix += nx;
278 if ( iy < 0 ) iy += ny;
279 if ( ix >= 0 && iy >= 0 && ix < nx && iy < ny ) {
280 i = iy*nx+ix;
281 count[i]++;
282 if ( m < count[i] ) m = (int) count[i];
283 n++;
284 }
285 }
286 }
287 }
288
289 if ( verbose & VERB_DEBUG )
290 cout << "DEBUG ps_origins: number of particles selected = " << n << endl;
291
292 *fps << "%%%%Page: Origins 2" << endl;
293 *fps << "/Helvetica-Bold findfont 14 scalefont setfont" << endl;
294 *fps << "/Left " << left << " def\n/Bottom " << bottom << " def\n/Height " << height << " def\n/Width " << width << " def" << endl;
295
296 *fps << "/Origin [" << endl;
297 if ( flags == 2 ) {
298 *fps << "%x y count weight" << endl;
299 for ( i=iy=0; iy<ny; iy++ )
300 for ( ix=0; ix<nx; ix++, i++ )
301 if ( count[i] ) *fps << ix << " " << iy << " " << count[i] << " " << count[i]/m << endl;
302 delete[] count;
303 } else {
304 *fps << "%x y count weight" << endl;
305 if ( project->select < 1 ) {
306 for ( n=0, field = project->field; field; field = field->next )
307 for ( mg = field->mg; mg; mg = mg->next )
308 for ( part = mg->part; part; part = part->next )
309 if ( part->sel > 0 ) {
310 *fps << part->ori[0] << " " << part->ori[1] << " 0.0 0.0" << endl;
311 n++;
312 }
313 } else {
314 for ( rec = project->rec; rec; rec = rec->next )
315 for ( part = rec->part; part; part = part->next )
316 if ( part->sel > 0 ) {
317 *fps << part->ori[0] << " " << part->ori[1] << " 0.0 0.0" << endl;
318 n++;
319 }
320 }
321 }
322
323 *fps << "] def" << endl;
324
325 *fps << "/Dim " << nx << " def" << endl;
326 *fps << "/Rad Dim 2 div def" << endl;
327 *fps << "/Scale Width Dim div def" << endl;
328 *fps << "/Box { newpath " << endl;
329 *fps << " Rad Rad Rad 0 360 arc stroke" << endl; // Circle
330 *fps << " 0 0 moveto 0 Dim rlineto Dim 0 rlineto 0 Dim neg rlineto Dim neg 0 rlineto" << endl; // Square
331 *fps << " 0 Rad moveto Dim 0 rlineto" << endl; // Cross
332 *fps << " Rad 0 moveto 0 Dim rlineto" << endl;
333 *fps << " closepath } def" << endl;
334
335 *fps << "40 720 moveto (Number of origins: " << n << ") show" << endl;
336 if ( nz < 2 ) *fps << "40 700 moveto (Particle dimensions: " << nx << " x " << ny << ") show" << endl;
337 else *fps << "40 700 moveto (Particle dimensions: " << nx << " x " << ny << " x " << nz << ") show" << endl;
338 *fps << "40 680 moveto (Maximum count: " << m << ") show" << endl;
339 *fps << "/Helvetica findfont 16 scalefont setfont" << endl;
340 *fps << "gsave" << endl;
341 *fps << " Left Bottom translate Scale Scale scale" << endl;
342 *fps << " " << 1/scale << " setlinewidth Box stroke" << endl;
343 if ( flags == 2 ) {
344 *fps << " 0 0.1 1 {" << endl;
345 *fps << " /f exch def" << endl;
346 *fps << " 0 4 Origin length 4 sub {" << endl;
347 *fps << " /Index exch def" << endl;
348 *fps << " /x Origin Index get def" << endl;
349 *fps << " /y Origin Index 1 add get def" << endl;
350 *fps << " /v Origin Index 3 add get def" << endl;
351 *fps << " v f ge {" << endl;
352 *fps << " 1 v sub setgray" << endl;
353 *fps << " x y 0.5 0 360 arc fill" << endl;
354 *fps << " } if" << endl;
355 *fps << " } for stroke" << endl;
356 *fps << " } for" << endl;
357 } else {
358 *fps << " /n 0 def" << endl;
359 *fps << " 0 4 Origin length 4 sub {" << endl;
360 *fps << " /Index exch def" << endl;
361 *fps << " /x Origin Index get def" << endl;
362 *fps << " /y Origin Index 1 add get def" << endl;
363 *fps << " x y 0.5 0 360 arc fill" << endl;
364 if ( flags == 1 ) {
365 *fps << " /n n 1 add def" << endl;
366 *fps << " x y moveto 0.02 0.02 rmoveto n cvi (xxxx) cvs show stroke" << endl;
367 }
368 *fps << " } for stroke" << endl;
369 }
370 *fps << "grestore" << endl;
371 *fps << "showpage" << endl;
372
373 return 0;
374 }
375
382 int ps_part_fom_histogram(Bstring& filename, Bproject* project)
383 {
384 if ( !project ) return 0;
385
386 int f, nfom;
387 long i, j, nh(200);
388 char tag[256];
389 Bfield* field;
390 Bmicrograph* mg;
391 Breconstruction* rec;
392 Bparticle* part;
393
394 for ( f=nfom=0; f<NFOM; f++ ) if ( project->fom_tag[f] ) nfom = f + 1;
395
396 Bstring title("FOM histogram");
397 Bplot* plot = new Bplot(1, nh+1, nfom+1);
398 plot->title(title);
399
400 plot->page(0).title(title);
401 plot->page(0).columns(nfom+1);
402 for ( i=0; i<=nfom; i++ ) plot->page(0).column(i).number(i);
403 plot->page(0).column(0).label("FOM");
404 plot->page(0).column(0).axis(1);
405 for ( i=1; i<=nfom; i++ ) {
406 get_fom_tag(project->fom_tag[i-1], tag);
407 plot->page(0).column(i).type(1);
408 // plot->page(0).column(i).label("Count");
409 plot->page(0).column(i).label(tag);
410 plot->page(0).column(i).axis(3);
411 plot->page(0).column(i).element_size(0.5);
412 }
413 // plot->page(0).column(nfom).label("Count");
414 plot->page(0).column(1).color(0,0,0);
415 if ( nfom > 1 ) plot->page(0).column(2).color(1,0,0);
416 if ( nfom > 2 ) plot->page(0).column(3).color(0,1,0);
417 if ( nfom > 3 ) plot->page(0).column(4).color(0,0,1);
418 if ( nfom > 4 ) plot->page(0).column(5).color(1,1,0);
419 plot->page(0).axis(1).min(-1);
420 plot->page(0).axis(1).max(1);
421 plot->page(0).axis(1).inc(0.2);
422 plot->page(0).axis(1).label("FOM");
423 plot->page(0).axis(3).label("Count");
424
425 /*
426 for ( f=i=0; f<NFOM; f++ ) if ( project->fom_tag[f] ) {
427 get_fom_tag(project->fom_tag[f], tag);
428 switch ( i ) {
429 case 0: *fps << " 0 0 0 setcolor" << endl; break;
430 case 1: *fps << " 1 0 0 setcolor" << endl; break;
431 case 2: *fps << " 0 1 0 setcolor" << endl; break;
432 case 3: *fps << " 0 0 1 setcolor" << endl; break;
433 case 4: *fps << " 1 1 0 setcolor" << endl; break;
434 }
435 *fps << left << " " << bottom-100-20*i << " moveto (" << tag << ") show" << endl;
436 i++;
437 }
438 */
439 for ( i=0; i<=nh; i++ ) (*plot)[i] = i*2.0/nh - 1;
440
441 if ( verbose & VERB_PROCESS ) {
442 if ( nfom < 2 )
443 cout << "Generating file " << filename << " with a FOM histogram" << endl << endl;
444 else
445 cout << "Generating file " << filename << " with " << nfom << " FOM histograms" << endl << endl;
446 }
447
448 for ( f=0, j=plot->rows(); f<nfom; f++, j+=plot->rows() ) if ( project->fom_tag[f] ) {
449 if ( project->select < 1 ) {
450 for ( field = project->field; field; field = field->next ) {
451 for ( mg = field->mg; mg; mg = mg->next ) {
452 for ( part = mg->part; part; part = part->next ) if ( part->sel ) {
453 i = (long) ((part->fom[f]+1)*nh/2 + 0.5);
454 if ( i < 0 ) i = 0;
455 if ( i > nh ) i = nh;
456 (*plot)[i+j] += 1;
457 }
458 }
459 }
460 } else {
461 for ( rec = project->rec; rec; rec = rec->next ) {
462 for ( part = rec->part; part; part = part->next ) if ( part->sel ) {
463 i = (long) ((part->fom[f]+1)*nh/2 + 0.5);
464 if ( i < 0 ) i = 0;
465 if ( i > nh ) i = nh;
466 (*plot)[i+j] += 1;
467 }
468 }
469 }
470 }
471
472 if ( verbose & VERB_DEBUG )
473 cout << "DEBUG ps_part_fom_histogram: Histogram data transferred" << endl;
474
475 ofstream* fps = ps_open_and_init(filename, plot);
476
477 ps_graph(fps, plot, 1);
478
479 delete plot;
480
481
482 long npart(0);
483 if ( project->select < 1 ) npart = project_count_mg_part_selected(project);
484 else npart = project_count_rec_part_selected(project);
485
486 if ( nfom > 1 && npart > 0) {
487 title = "FOM plot";
488 plot = new Bplot(1, npart, nfom);
489 plot->title(title);
490 // cout << "DEBUG ps_part_fom_histogram: page=" << plot->page(0).number() << endl;
491
492 plot->page(0).title(title);
493 plot->page(0).columns(nfom);
494 for ( i=0; i<nfom; i++ ) plot->page(0).column(i).number(i);
495 get_fom_tag(project->fom_tag[0], tag);
496 plot->page(0).column(0).label(tag);
497 plot->page(0).column(0).axis(1);
498 for ( i=1; i<nfom; i++ ) {
499 get_fom_tag(project->fom_tag[i], tag);
500 plot->page(0).column(i).type(0);
501 plot->page(0).column(i).label(tag);
502 plot->page(0).column(i).axis(3);
503 plot->page(0).column(i).element_size(0.9);
504 }
505
506 plot->page(0).column(1).color(1,0,0);
507 if ( nfom > 2 ) plot->page(0).column(2).color(0,1,0);
508 if ( nfom > 3 ) plot->page(0).column(3).color(0,0,1);
509 if ( nfom > 4 ) plot->page(0).column(4).color(1,1,0);
510
511 for ( i=1; i<4; i+=2 ) {
512 plot->page(0).axis(i).min(-1);
513 plot->page(0).axis(i).max(1);
514 plot->page(0).axis(i).inc(0.2);
515 }
516
517 for ( f=0, j=0; f<nfom; f++, j+=npart ) if ( project->fom_tag[f] ) {
518 if ( project->select < 1 ) {
519 for ( i=0, field = project->field; field; field = field->next ) {
520 for ( mg = field->mg; mg; mg = mg->next ) {
521 for ( part = mg->part; part; part = part->next ) if ( part->sel ) {
522 (*plot)[i+j] = part->fom[f];
523 i++;
524 }
525 }
526 }
527 } else {
528 for ( i=0, rec = project->rec; rec; rec = rec->next ) {
529 for ( part = rec->part; part; part = part->next ) if ( part->sel ) {
530 (*plot)[i+j] = part->fom[f];
531 i++;
532 }
533 }
534 }
535 }
536
537 if ( verbose & VERB_DEBUG )
538 cout << "DEBUG ps_part_fom_histogram: FOM data: npart=" << npart << " transferred=" << i << endl;
539
540 ps_graph(fps, plot, 1);
541
542 delete plot;
543 }
544
545 ps_class_average_fom(fps, project);
546
547 ps_close(fps);
548
549 return 0;
550 }
551
558 int ps_defocus_histogram(Bstring& filename, Bproject* project)
559 {
560 if ( !project ) return 0;
561
562 int n(0);
563 long i, nc(2), nh(100);
564 double damax(10), da, dd, a, c, s, ca(0), sa(0), r2(0);
565 double daa(0), das(0), dda(0), dds(0);
566 Bfield* field;
567 Bmicrograph* mg;
568 // Breconstruction* rec;
569
570 Bstring title("Defocus histogram");
571 Bplot* plot = new Bplot(1, nh+1, nc);
572 plot->title(title);
573
574 plot->page(0).title(title);
575 plot->page(0).columns(nc);
576 for ( i=0; i<nc; i++ ) plot->page(0).column(i).number(i);
577 plot->page(0).column(0).label("Defocus");
578 plot->page(0).column(0).axis(1);
579 plot->page(0).column(1).type(1);
580 plot->page(0).column(1).label("Count");
581 plot->page(0).column(1).axis(3);
582 plot->page(0).column(1).element_size(0.5);
583 plot->page(0).column(1).color(0,0,0);
584 plot->page(0).axis(1).min(0);
585 plot->page(0).axis(1).max(damax);
586 plot->page(0).axis(1).inc(2);
587 plot->page(0).axis(1).label("Defocus");
588 plot->page(0).axis(3).label("Count");
589
590 for ( i=0; i<=nh; i++ ) (*plot)[i] = i*damax/nh;
591
592 for ( field = project->field; field; field = field->next ) {
593 for ( mg = field->mg; mg; mg = mg->next ) if ( mg->ctf ) {
594 da = mg->ctf->defocus_average() * 1e-4;
595 dd = mg->ctf->defocus_deviation() * 1e-4;
596 a = mg->ctf->astigmatism_angle();
597 c = cos(a);
598 s = sin(a);
599 ca += c;
600 sa += s;
601 // r2 += c*c + s*s;
602 daa += da;
603 dda += dd;
604 das += da*da;
605 dds += dd*dd;
606 n++;
607 i = (long) (nh*da/damax + 0.5);
608 if ( i < 0 ) i = 0;
609 if ( i > nh ) i = nh;
610 (*plot)[i+nh] += 1;
611 }
612 }
613
614 daa /= n;
615 dda /= n;
616 das = das/n - daa*daa;
617 dds = dds/n - dda*dda;
618 if ( das > 0 ) das = sqrt(das);
619 else das = 0;
620 if ( dds > 0 ) dds = sqrt(dds);
621 else dds = 0;
622
623 ca /= n;
624 sa /= n;
625 a = atan2(sa, ca);
626 r2 = ca*ca + sa*sa;
627
628 if ( verbose ) {
629 cout << "Defocus average: " << daa << " (" << das << ")" << endl;
630 cout << "Defocus deviation: " << dda << " (" << dds << ")" << endl;
631 cout << "Astigmatism angle: " << a*180/M_PI << " (" << sqrt(-log(r2)) << ")" << endl;
632 }
633
634 if ( verbose & VERB_PROCESS )
635 cout << "Generating file " << filename << " with defocus histograms" << endl << endl;
636
637 ofstream* fps = ps_open_and_init(filename, plot);
638
639 ps_graph(fps, plot, 1);
640
641 delete plot;
642
643
644 ps_close(fps);
645
646 return 0;
647 }
648
655 int ps_astigmatism_plot(Bstring& filename, Bproject* project)
656 {
657 if ( !project ) return 0;
658
659 long i, j, nc(2);
660 Bfield* field;
661 Bmicrograph* mg;
662
663 long nmg = project_count_micrographs(project);
664
665 Bstring title("Astigmatism plot");
666 Bplot* plot = new Bplot(1, nmg, nc);
667 plot->title(title);
668
669 plot->page(0).title(title);
670 plot->page(0).columns(nc);
671 for ( i=0; i<nc; i++ ) plot->page(0).column(i).number(i);
672 plot->page(0).column(0).label("Defocus Deviation");
673 plot->page(0).column(0).axis(1);
674 plot->page(0).column(1).type(0);
675 plot->page(0).column(1).label("Astigmatism Angle");
676 plot->page(0).column(1).axis(3);
677 plot->page(0).column(1).element_size(2);
678 plot->page(0).column(1).color(0,0,0);
679 // plot->page(0).axis(1).min(0);
680 // plot->page(0).axis(1).max(1e4);
681 // plot->page(0).axis(1).inc(1e3);
682 plot->page(0).axis(1).label("Defocus Deviation");
683 // plot->page(0).axis(3).min(-90);
684 // plot->page(0).axis(3).max(90);
685 // plot->page(0).axis(3).inc(15);
686 plot->page(0).axis(3).label("Astigmatism Angle");
687
688 for ( i=0, j=nmg, field = project->field; field; field = field->next ) {
689 for ( mg = field->mg; mg; mg = mg->next ) if ( mg->ctf ) {
690 (*plot)[i++] = mg->ctf->defocus_deviation();
691 (*plot)[j++] = mg->ctf->astigmatism_angle()*180.0/M_PI;
692 }
693 }
694
695 if ( verbose & VERB_PROCESS )
696 cout << "Generating file " << filename << " with an astigmatism plot" << endl << endl;
697
698 ofstream* fps = ps_open_and_init(filename, plot);
699
700 ps_graph(fps, plot, 1);
701
702 delete plot;
703
704 ps_close(fps);
705
706 return 0;
707 }
708
716 int ps_marker_errors(Bstring& filename, Bstring& title, Bproject* project)
717 {
718 int i = 0, width = 0, height = 0, left=50, bottom=50, nmg = 0, nmark = 0;
719
720 Bfield* field = project->field;
721 Bmicrograph* mg_ref = project->field->mg;
722 Bmicrograph* mg;
723 Breconstruction* rec;
724 Bmarker* mark;
725 Bimage* p;
726 Vector3<float> shift;
727
728 if ( verbose & VERB_PROCESS )
729 cout << "Generating file " << filename << " with marker errors" << endl << endl;
730
731 // Find the dimensions of the micrographs from the coordinate sets
732 for ( field=project->field; field; field=field->next ) {
733 for ( mg=field->mg; mg; mg=mg->next ) {
734 if ( fabs(mg_ref->tilt_angle) > fabs(mg->tilt_angle) ) mg_ref = mg;
735 p = read_img(mg->fmg, 0, 0);
736 if ( !p ) {
737 error_show("Error in ps_marker_errors", __FILE__, __LINE__);
738 cerr << "Micrograph " << mg->fmg << " not found" << endl;
739 return -1;
740 }
741 if ( width < p->sizeX() ) width = p->sizeX();
742 if ( height < p->sizeY() ) height = p->sizeY();
743 delete p;
744 nmg++;
745 }
746 }
747 if ( verbose & VERB_DEBUG )
748 cout << "DEBUG ps_marker_errors: width=" << width << " height=" << height << endl;
749
750 for ( nmark=0, mark=mg_ref->mark; mark; mark=mark->next, nmark++ ) ;
751
752 float scale(500.0/width);
753 if ( scale > 500.0/height ) scale = 500.0/height;
754
755 float mark_rad(width/409.6);
756 float mark_diam(2*mark_rad);
757 float err_scale(width/204.8);
758
759 ofstream* fps = ps_open_and_init(filename, title, nmg, 600, 800);
760
761 *fps << "/ArrowHeadSize " << width/70 << " def" << endl;
762 *fps << "/ahead {" << endl;
763 *fps << " 1 index 4 index sub" << endl;
764 *fps << " 1 index 4 index sub" << endl;
765 *fps << " exch atan" << endl;
766 *fps << " ArrowHeadSize -.8 mul" << endl;
767 *fps << " dup" << endl;
768 *fps << " 2 index cos mul 4 index add" << endl;
769 *fps << " exch" << endl;
770 *fps << " 2 index sin mul 3 index add" << endl;
771 *fps << " 5 2 roll" << endl;
772 *fps << " gsave" << endl;
773 *fps << " 3 1 roll" << endl;
774 *fps << " translate" << endl;
775 *fps << " rotate" << endl;
776 *fps << " newpath" << endl;
777 *fps << " 0 0 moveto" << endl;
778 *fps << " ArrowHeadSize dup neg exch .25 mul" << endl;
779 *fps << " 2 copy lineto" << endl;
780 *fps << " ArrowHeadSize -.8 mul 0" << endl;
781 *fps << " 2 copy" << endl;
782 *fps << " 6 4 roll" << endl;
783 *fps << " neg curveto" << endl;
784 *fps << " closepath fill" << endl;
785 *fps << " grestore" << endl;
786 *fps << "} bind def" << endl;
787 *fps << "/arrowline {" << endl;
788 *fps << " ahead" << endl;
789 *fps << " moveto" << endl;
790 *fps << " lineto" << endl;
791 *fps << " stroke" << endl;
792 *fps << "} bind def" << endl;
793
794 *fps << "/Axis_x1 " << mg_ref->origin[0]*(1 - cos(mg_ref->tilt_axis)) << " def" << endl;
795 *fps << "/Axis_x2 " << mg_ref->origin[0]*(1 + cos(mg_ref->tilt_axis)) << " def" << endl;
796 *fps << "/Axis_y1 " << mg_ref->origin[0]*(1 - sin(mg_ref->tilt_axis)) << " def" << endl;
797 *fps << "/Axis_y2 " << mg_ref->origin[0]*(1 + sin(mg_ref->tilt_axis)) << " def" << endl;
798
799 for ( field=project->field; field; field=field->next, i++ ) {
800 *fps << "%%Page: " << i+1 << " " << i+1 << endl;
801 *fps << "/Helvetica findfont 12 scalefont setfont" << endl;
802 *fps << "50 755 moveto (" << title << ": " << field->id << ") show" << endl;
803 *fps << "50 735 moveto (Marker traces) show" << endl;
804 *fps << "/Scale " << scale << " def" << endl;
805 *fps << "/Height 500 def\n/Width 500 def" << endl;
806 *fps << "/Frame { newpath 0 0 moveto Width 0 lineto Width Height lineto 0 Height lineto closepath } def" << endl;
807
808 *fps << "/Pos [" << endl << "%mg";
809 for ( mark=mg_ref->mark; mark; mark=mark->next )
810 *fps << " " << mark->id << "x " << mark->id << "y";
811 *fps << endl;
812 for ( mg=field->mg; mg; mg=mg->next ) {
813 *fps << mg->img_num;
814 shift = mg_ref->origin - mg->origin;
815 for ( mark=mg->mark; mark; mark=mark->next )
816 *fps << " " << mark->loc[0] + shift[0] << " " << mark->loc[1] + shift[1];
817 *fps << endl;
818 }
819 *fps << "] def" << endl;
820
821 *fps << "gsave" << endl;
822 *fps << " " << left << " " << bottom << " translate" << endl;
823 *fps << " Frame stroke" << endl;
824 *fps << " Scale Scale scale" << endl;
825 *fps << " /Helvetica findfont " << width/50 << " scalefont setfont" << endl;
826 *fps << " " << mark_rad << " setlinewidth [10 10] 0 setdash" << endl;
827 *fps << " Axis_x1 Axis_y1 moveto Axis_x2 Axis_y2 lineto stroke" << endl;
828 *fps << " 1 setlinewidth [] 0 setdash" << endl;
829 *fps << " /nm 1 def" << endl;
830 *fps << " 1 1 " << nmark << " { " << endl;
831 *fps << " /Index exch def" << endl;
832 *fps << " /id Index def" << endl;
833 *fps << " /x Pos nm get def" << endl;
834 *fps << " /y Pos nm 1 add get def" << endl;
835 *fps << " x y moveto " << mark_diam << " " << mark_diam << " rmoveto id cvi (xxxx) cvs show stroke" << endl;
836 *fps << " x y " << mark_rad << " 0 360 arc closepath fill" << endl;
837 *fps << " x y moveto" << endl;
838 *fps << " " << 2*nmark+1 << " " << 2*nmark+1 << " Pos length " << 2*nmark+1 << " sub { " << endl;
839 *fps << " /Index2 exch def" << endl;
840 *fps << " /x Pos Index2 nm add get def" << endl;
841 *fps << " /y Pos Index2 nm add 1 add get def" << endl;
842 *fps << " x y lineto" << endl;
843 *fps << " } for stroke" << endl;
844 *fps << " x y " << mark_rad << " 0 360 arc closepath stroke" << endl;
845 *fps << " /nm nm 2 add def" << endl;
846 *fps << " } for" << endl;
847 *fps << "grestore" << endl;
848
849 *fps << "showpage" << endl;
850 }
851
852 for ( field=project->field; field; field=field->next, i++ ) {
853 *fps << "%%Page: " << i+1 << " " << i+1 << endl;
854 *fps << "/Helvetica findfont 12 scalefont setfont" << endl;
855 *fps << "50 755 moveto (" << title << ": " << field->id << ") show" << endl;
856 *fps << "50 735 moveto (Marker errors (x" << err_scale << ")) show" << endl;
857 *fps << "/Scale " << scale << " def" << endl;
858 *fps << "/Height 500 def\n/Width 500 def" << endl;
859 *fps << "/Frame { newpath 0 0 moveto Width 0 lineto Width Height lineto 0 Height lineto closepath } def" << endl;
860
861 *fps << "/Loc [\n%id x y" << endl;
862 for ( nmark=0, mark=mg_ref->mark; mark; mark=mark->next, nmark++ )
863 *fps << mark->id << " " << mark->loc[0] << " " << mark->loc[1] << endl;
864 *fps << "] def" << endl;
865
866 *fps << "/Err [" << endl << "%mg";
867 for ( mark=mg_ref->mark; mark; mark=mark->next )
868 *fps << " " << mark->id << "x " << mark->id << "y";
869 *fps << endl;
870 for ( mg=field->mg; mg; mg=mg->next ) {
871 *fps << mg->img_num;
872 for ( mark=mg->mark; mark; mark=mark->next )
873 *fps << " " << mark->err[0] << " " << mark->err[1];
874 *fps << endl;
875 }
876 *fps << "] def" << endl;
877
878 *fps << "gsave" << endl;
879 *fps << " " << left << " " << bottom << " translate" << endl;
880 *fps << " Frame stroke" << endl;
881 *fps << " Scale Scale scale" << endl;
882 *fps << " /Helvetica findfont " << width/50 << " scalefont setfont" << endl;
883 *fps << " " << mark_rad << " setlinewidth [10 10] 0 setdash" << endl;
884 *fps << " Axis_x1 Axis_y1 moveto Axis_x2 Axis_y2 lineto stroke" << endl;
885 *fps << " 1 setlinewidth [] 0 setdash" << endl;
886 *fps << " /nm -1 def" << endl;
887 *fps << " 0 3 Loc length 3 sub { " << endl;
888 *fps << " /Index exch def" << endl;
889 *fps << " /id Loc Index get def" << endl;
890 *fps << " /x Loc Index 1 add get def" << endl;
891 *fps << " /y Loc Index 2 add get def" << endl;
892 *fps << " /nm nm 2 add def" << endl;
893 *fps << " x y moveto " << mark_diam << " " << mark_diam << " rmoveto id cvi (xxxx) cvs show stroke" << endl;
894 *fps << " x y " << mark_rad << " 0 360 arc closepath fill" << endl;
895 *fps << " x y moveto" << endl;
896 *fps << " 0 " << 2*nmark+1 << " Err length " << 2*nmark+1 << " sub { " << endl;
897 *fps << " /Index2 exch def" << endl;
898 *fps << " /ex Err Index2 nm add get " << err_scale << " mul x add def" << endl;
899 *fps << " /ey Err Index2 nm add 1 add get " << err_scale << " mul y add def" << endl;
900 *fps << " ex ey lineto" << endl;
901 *fps << " } for stroke" << endl;
902 *fps << " } for" << endl;
903 *fps << "grestore" << endl;
904
905 *fps << "showpage" << endl;
906 }
907
908 if ( project->rec ) {
909 rec = project->rec;
910 *fps << "%%Page: " << i+1 << " " << i+1 << endl;
911 *fps << "/Helvetica findfont 12 scalefont setfont" << endl;
912 *fps << "50 755 moveto (" << title << ": " << rec->id << ") show" << endl;
913 *fps << "50 735 moveto (Marker error sum vectors) show" << endl;
914 *fps << "/Scale " << scale << " def" << endl;
915 *fps << "/Height 500 def\n/Width 500 def" << endl;
916 *fps << "/Frame { newpath 0 0 moveto Width 0 lineto Width Height lineto 0 Height lineto closepath } def" << endl;
917
918 *fps << "/Vec [" << endl << "%id x y ex ey" << endl;
919 for ( mark=rec->mark; mark; mark=mark->next )
920 *fps << mark->id << " " << mark->loc[0] << " " <<
921 mark->loc[1] << " " << mark->err[0] << " " << mark->err[1] << endl;
922 *fps << "] def" << endl;
923
924 *fps << "gsave" << endl;
925 *fps << " " << left << " " << bottom << " translate" << endl;
926 *fps << " Frame stroke" << endl;
927 *fps << " Scale Scale scale" << endl;
928 *fps << " /Helvetica findfont " << width/50 << " scalefont setfont" << endl;
929 *fps << " " << mark_rad << " setlinewidth [10 10] 0 setdash" << endl;
930 *fps << " Axis_x1 Axis_y1 moveto Axis_x2 Axis_y2 lineto stroke" << endl;
931 *fps << " 1 setlinewidth [] 0 setdash" << endl;
932 *fps << " 0 5 Vec length 5 sub { " << endl;
933 *fps << " /Index exch def" << endl;
934 *fps << " /id Vec Index get def" << endl;
935 *fps << " /x Vec Index 1 add get def" << endl;
936 *fps << " /y Vec Index 2 add get def" << endl;
937 *fps << " /ex Vec Index 3 add get x add def" << endl;
938 *fps << " /ey Vec Index 4 add get y add def" << endl;
939 *fps << " /d ex x sub ey y sub add def" << endl;
940 *fps << " x y moveto " << mark_diam << " " << mark_diam << " rmoveto id cvi (xxxx) cvs show stroke" << endl;
941 *fps << " x y " << mark_rad << " 0 360 arc closepath fill" << endl;
942 *fps << " d 0 ne {" << endl;
943 *fps << " x y ex ey arrowline" << endl;
944 *fps << " } if" << endl;
945 *fps << " } for" << endl;
946 *fps << "grestore" << endl;
947
948 *fps << "showpage" << endl;
949 }
950
951 ps_close(fps);
952
953 return 0;
954 }
955
965 int ps_dual_zcompare(Bstring& filename, Bproject* project)
966 {
967 if ( !project->rec ) return -1;
968 if ( !project->rec->next ) return -1;
969
970 Breconstruction* rec1 = project->rec;
971 Breconstruction* rec2 = project->rec->next;
972 Bmarker* mark1 = NULL;
973 Bmarker* mark2 = NULL;
974 Bstring x_label("X coordinate");
975 Bstring y_label("Y coordinate");
976 Bstring z_label("Z coordinate");
977 long i, npt;
978
979 Vector3<double> cmin, cmax;
980
981 for ( npt=0, mark1 = rec1->mark; mark1; mark1 = mark1->next ) if ( mark1->sel ) {
982 for ( mark2 = rec2->mark; mark2 && mark2->id != mark1->id; mark2 = mark2->next ) ;
983 if ( mark2 && mark2->sel ) npt++;
984 }
985
986 if ( verbose )
987 cout << "Generating plot " << filename << endl << endl;
988
989 Bstring title("Comparing dual tilt marker positions");
990 Bplot* plot = new Bplot(3, npt, 6);
991 plot->title(title);
992
993 for ( i=0, mark1 = rec1->mark; mark1; mark1 = mark1->next ) if ( mark1->sel ) {
994 for ( mark2 = rec2->mark; mark2 && mark2->id != mark1->id; mark2 = mark2->next ) ;
995 if ( mark2 && mark2->sel ) {
996 cmin = cmin.min(mark1->loc);
997 cmin = cmin.min(mark2->loc);
998 cmax = cmax.max(mark1->loc);
999 cmax = cmax.max(mark2->loc);
1000 (*plot)[i] = mark1->loc[0];
1001 (*plot)[i+npt] = mark1->loc[1];
1002 (*plot)[i+2*npt] = mark1->loc[2];
1003 (*plot)[i+3*npt] = mark2->loc[0];
1004 (*plot)[i+4*npt] = mark2->loc[1];
1005 (*plot)[i+5*npt] = mark2->loc[2];
1006 i++;
1007 }
1008 }
1009 // cout << "Pages: " << plot->pages() << endl;
1010 for ( i=0; i<3; i++ ) { // cout << "Setting up page " << plot->page(i).number() << endl;
1011 plot->page(i).title(title);
1012 plot->page(i).columns(2);
1013 plot->page(i).column(0).axis(1);
1014 plot->page(i).column(1).axis(3);
1015 plot->page(i).column(1).type(0);
1016 plot->page(i).column(1).element_size(3);
1017 plot->page(i).axis(1).min(cmin[i]);
1018 plot->page(i).axis(1).max(cmax[i]);
1019 plot->page(i).axis(3).min(cmin[i]);
1020 plot->page(i).axis(3).max(cmax[i]);
1021 }
1022 plot->page(0).column(0).label(x_label);
1023 plot->page(0).column(1).label(x_label);
1024 plot->page(1).column(0).label(y_label);
1025 plot->page(1).column(1).label(y_label);
1026 plot->page(2).column(0).label(z_label);
1027 plot->page(2).column(1).label(z_label);
1028 plot->page(0).column(0).number(0);
1029 plot->page(0).column(1).number(3);
1030 plot->page(1).column(0).number(1);
1031 plot->page(1).column(1).number(4);
1032 plot->page(2).column(0).number(2);
1033 plot->page(2).column(1).number(5);
1034
1035 // cout << "Zcompare setup done " << endl;
1036
1037 ps_plot(filename, plot);
1038
1039 delete plot;
1040
1041 return 0;
1042 }
1043
1050 int ps_class_average_fom(ofstream* fps, Bproject* project)
1051 {
1052 if ( !project ) return 0;
1053 if ( !project->class_avg ) return 0;
1054
1055 long i, nc(0), nmax(0), nt(0);
1056 double fommax(0);
1057 Bparticle* ca = project->class_avg;
1058
1059 for ( ca = project->class_avg; ca; ca = ca->next ) if ( ca->sel ) {
1060 if ( nmax < ca->sel ) nmax = ca->sel;
1061 if ( fommax < ca->fom[0] ) fommax = ca->fom[0];
1062 nt += ca->sel;
1063 nc++;
1064 }
1065
1066 nmax = log(nmax) + 1;
1067
1068 if ( verbose & VERB_PROCESS )
1069 cout << "Generating a class average plot" << endl << endl;
1070
1071 Bstring title("Class average FOMs");
1072 Bplot* plot = new Bplot(1, nc, 2);
1073 plot->title(title);
1074
1075 plot->page(0).title(title);
1076 plot->page(0).columns(2);
1077 for ( i=0; i<2; i++ ) plot->page(0).column(i).number(i);
1078 plot->page(0).column(0).label("log(number)");
1079 plot->page(0).column(0).axis(1);
1080 plot->page(0).column(1).type(0);
1081 plot->page(0).column(1).label("FOM");
1082 plot->page(0).column(1).axis(3);
1083 plot->page(0).column(1).element_size(5);
1084 plot->page(0).column(1).color(0,0,0);
1085 plot->page(0).axis(1).min(0);
1086 plot->page(0).axis(1).max(nmax);
1087 plot->page(0).axis(1).flags(2);
1088 // plot->page(0).axis(1).inc(2);
1089 plot->page(0).axis(1).label("log(number)");
1090 plot->page(0).axis(3).min(0);
1091 plot->page(0).axis(3).max(fommax);
1092 plot->page(0).axis(3).label("FOM");
1093
1094 for ( i=0, ca = project->class_avg; ca; ca = ca->next ) if ( ca->sel ) {
1095 (*plot)[i] = log(ca->sel);
1096 (*plot)[i+nc] = ca->fom[0];
1097 i++;
1098 }
1099
1100 Bstring txt;
1101 txt = Bstring(nc, "Number of class averages: %ld");
1102 plot->page(0).add_text(txt);
1103 txt = Bstring(nt, "Number of particles: %ld");
1104 plot->page(0).add_text(txt);
1105
1106 ps_graph(fps, plot, 1);
1107
1108 delete plot;
1109
1110 return 0;
1111 }
Baxis::inc
double inc()
Definition: Bplot.h:34
Baxis::label
Bstring & label()
Definition: Bplot.h:28
ps_micrograph.h
Header file for postscript tools dealing with micrograph particle sets.
ps_origins
int ps_origins(ofstream *fps, Bstring &title, Bproject *project, int flags)
Definition: ps_micrograph.cpp:187
Bproject::rec
Breconstruction * rec
Definition: mg_processing.h:344
Bparticle::mag
double mag
Definition: mg_processing.h:94
Baxis::min
double min()
Definition: Bplot.h:30
Breconstruction::part
Bparticle * part
Definition: mg_processing.h:304
Breconstruction::mark
Bmarker * mark
Definition: mg_processing.h:307
Breconstruction::fpart
Bstring fpart
Definition: mg_processing.h:288
Bplot::title
Bstring & title()
Definition: Bplot.h:189
Bmicrograph::img_num
int img_num
Definition: mg_processing.h:211
Bcolumn::element_size
double element_size()
Definition: Bplot.h:74
symmetry.h
Header file for general symmetry functions.
utilities.h
Header file for general utilities.
CTFparam::astigmatism_angle
double astigmatism_angle()
Definition: ctf.h:104
VERB_DEBUG
#define VERB_DEBUG
Definition: utilities.h:112
Breconstruction
Definition: mg_processing.h:280
Bcolumn::label
Bstring & label()
Definition: Bplot.h:63
kill_list
long kill_list(char *list, unsigned long size)
Frees all the items in a linked list.
Definition: linked_list.cpp:214
project_count_mg_part_selected
long project_count_mg_part_selected(Bproject *project)
Counts the number of particles in a project.
Definition: mg_processing.cpp:833
Bparticle::fom
double fom[NFOM]
Definition: mg_processing.h:102
Bmarker
Definition: marker.h:21
project
Bproject * project
Definition: bshow.cpp:31
kill_symmetry
int kill_symmetry(Bsymmetry *sym)
Deallocates a symmetry structure.
Definition: symmetry.cpp:207
VERB_PROCESS
#define VERB_PROCESS
Definition: utilities.h:107
ps_open_and_init
ofstream * ps_open_and_init(Bstring filename, Bstring title, int npages, int width, int height)
Opens and initializes a postscript file.
Definition: ps_plot.cpp:31
Bcolumn::color
double * color()
Definition: Bplot.h:76
project_count_micrographs
long project_count_micrographs(Bproject *project)
Counts all the micrographs in the project structure.
Definition: mg_processing.cpp:746
Bpage::column
Bcolumn & column(long i)
Definition: Bplot.h:110
ps_mg_particle_positions
int ps_mg_particle_positions(Bstring &filename, Bstring &title, Bproject *project)
Postscript plot of the positions of particles on micrographs.
Definition: ps_micrograph.cpp:30
ps_marker_errors
int ps_marker_errors(Bstring &filename, Bstring &title, Bproject *project)
Postscript plot of the errors associated with fiducial markers.
Definition: ps_micrograph.cpp:716
Bmicrograph::tilt_angle
double tilt_angle
Definition: mg_processing.h:217
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
Bfield::next
Bfield * next
Definition: mg_processing.h:258
get_fom_tag
Bstring get_fom_tag(FOMType fom_type)
Returns the tag associated with a particular FOM.
Definition: mg_processing.cpp:3971
Bmicrograph::part
Bparticle * part
Definition: mg_processing.h:239
Baxis::max
double max()
Definition: Bplot.h:32
Vector3::max
Type max()
Definition: Vector3.h:175
Bimage
General image parameter class.
Definition: Bimage.h:163
Bmicrograph::fpart
Bstring fpart
Definition: mg_processing.h:207
Bmicrograph::tilt_axis
double tilt_axis
Definition: mg_processing.h:216
project_count_rec_part_selected
long project_count_rec_part_selected(Bproject *project)
Counts all the particles in the project structure.
Definition: mg_processing.cpp:919
Bparticle::sel
long sel
Definition: mg_processing.h:103
Bfield
Definition: mg_processing.h:257
M_PI
#define M_PI
Definition: utilities.h:59
linked_list.h
Header file for generalized linked list functions.
Bmicrograph::ctf
CTFparam * ctf
Definition: mg_processing.h:238
NFOM
#define NFOM
Definition: mg_processing.h:16
Bcolumn::number
long number()
Definition: Bplot.h:61
ps_views
int ps_views(Bstring &filename, Bstring &symmetry_string, View *view, int flags)
Generates postscript plot of views on the unit sphere.
Definition: ps_views.cpp:34
Bfield::id
Bstring id
Definition: mg_processing.h:259
Bproject::field
Bfield * field
Definition: mg_processing.h:343
Bcolumn::type
long type()
Definition: Bplot.h:66
Bproject::fom_tag
FOMType fom_tag[NFOM]
Definition: mg_processing.h:342
Bpage::axis
Baxis & axis(long id)
Definition: Bplot.h:117
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
CTFparam::defocus_deviation
double defocus_deviation()
Definition: ctf.h:102
Bpage::title
Bstring & title()
Definition: Bplot.h:100
Bmicrograph
Definition: mg_processing.h:200
change_views_to_asymmetric_unit
int change_views_to_asymmetric_unit(Bsymmetry *sym, View *view)
Change the views to those in the asymmetric unit.
Definition: symmetry.cpp:834
Bmicrograph::origin
Vector3< double > origin
Definition: mg_processing.h:220
Bproject::class_avg
Bparticle * class_avg
Definition: mg_processing.h:345
ps_particle_views_origins
int ps_particle_views_origins(Bstring &filename, Bstring &title, Bstring &symmetry_string, Bproject *project, int selection)
Generates asymmetric unit particle view and origin postscript plots.
Definition: ps_micrograph.cpp:121
Bmarker::id
int id
Definition: marker.h:23
Bparticle::fpart
Bstring fpart
Definition: mg_processing.h:91
Bparticle::ori
Vector3< double > ori
Definition: mg_processing.h:100
ps_plot
int ps_plot(Bstring filename, Bplot *plot)
Generates postscript graphs.
Definition: ps_plot.cpp:128
Bstring::c_str
const char * c_str()
Definition: Bstring.h:70
Bmicrograph::mark
Bmarker * mark
Definition: mg_processing.h:242
Bmarker::next
Bmarker * next
Definition: marker.h:22
Bfield::mg
Bmicrograph * mg
Definition: mg_processing.h:264
ps_part_fom_histogram
int ps_part_fom_histogram(Bstring &filename, Bproject *project)
Postscript plot of the particle FOM histogram.
Definition: ps_micrograph.cpp:382
Bsymmetry
Definition: symmetry.h:38
Bpage::add_text
void add_text(Bstring &s)
Definition: Bplot.h:122
Bparticle
Definition: mg_processing.h:89
Baxis::flags
long flags()
Definition: Bplot.h:38
Bstring
Definition: Bstring.h:29
Bimage::sizeX
void sizeX(long nx)
Definition: Bimage.h:377
Bplot::rows
void rows(long n)
Definition: Bplot.h:207
Bplot::page
Bpage & page(long i)
Definition: Bplot.h:211
Bproject::select
int select
Definition: mg_processing.h:339
ps_dual_zcompare
int ps_dual_zcompare(Bstring &filename, Bproject *project)
Generates a PostScript file that displays X by X, Y by Y, and Z by Z plots for diagnostic purposes.
Definition: ps_micrograph.cpp:965
ps_plot.h
Header file for postscript output functions.
Bmicrograph::box_size
Vector3< long > box_size
Definition: mg_processing.h:230
ps_graph
int ps_graph(ofstream *fps, Bplot *plot, int page_number)
Generates postscript graphs.
Definition: ps_plot.cpp:246
ps_astigmatism_plot
int ps_astigmatism_plot(Bstring &filename, Bproject *project)
Postscript plot of micrograph astigmatism parameters.
Definition: ps_micrograph.cpp:655
Bimage::sizeZ
void sizeZ(long nz)
Definition: Bimage.h:379
ps_defocus_histogram
int ps_defocus_histogram(Bstring &filename, Bproject *project)
Postscript histogram plot of micrograph defocus parameters.
Definition: ps_micrograph.cpp:558
Vector3< float >
views_from_project
View * views_from_project(Bproject *project, int selection)
Retrieves the particle views from a project.
Definition: mg_processing.cpp:3925
Bmicrograph::fmg
Bstring fmg
Definition: mg_processing.h:205
Bparticle::loc
Vector3< double > loc
Definition: mg_processing.h:99
ps_class_average_fom
int ps_class_average_fom(ofstream *fps, Bproject *project)
Postscript histogram plot of class average FOM's.
Definition: ps_micrograph.cpp:1050
View
Definition: View.h:26
Bmarker::err
Vector3< float > err
Definition: marker.h:26
Vector3::min
Type min()
Definition: Vector3.h:169
Bmarker::loc
Vector3< float > loc
Definition: marker.h:25
Bpage::columns
void columns(long ncol)
Definition: Bplot.h:105
CTFparam::defocus_average
double defocus_average()
Definition: ctf.h:100
verbose
int verbose
rwimg.h
Header file for 2D and 3D image I/O.
ps_close
int ps_close(ofstream *fps)
Closes a postscript file.
Definition: ps_plot.cpp:104
ps_views.h
Header file for postscript tools dealing with views.
Bparticle::next
Bparticle * next
Definition: mg_processing.h:90
VERB_FULL
#define VERB_FULL
Definition: utilities.h:109
Bimage::sizeY
void sizeY(long ny)
Definition: Bimage.h:378
VERB_LABEL
#define VERB_LABEL
Definition: utilities.h:106
Breconstruction::next
Breconstruction * next
Definition: mg_processing.h:281
Bmarker::sel
int sel
Definition: marker.h:29
error_show
int error_show(string message, string file, int line)
Displays the error with file and line reference.
Definition: utilities.cpp:755
Bproject
Definition: mg_processing.h:333
Breconstruction::id
Bstring id
Definition: mg_processing.h:282
Bcolumn::axis
long axis()
Definition: Bplot.h:68
Bplot
Definition: Bplot.h:146
Bmicrograph::next
Bmicrograph * next
Definition: mg_processing.h:201