| Bsoft 2.0.5 Bernard's software package

rwmg.cpp
Go to the documentation of this file.
1
9 #include "rwmg.h"
10 #include "mg_processing.h"
11 #include "mg_img_proc.h"
12 #include "mg_ctf.h"
13 #include "mg_tags.h"
14 #include "rwmgSTAR.h"
15 #include "rwmgXML.h"
16 #include "rwmgEMX.h"
17 #include "rwmgIMOD.h"
18 #include "rwmgSerialEM.h"
19 #include "file_util.h"
20 #include "utilities.h"
21
22 // Declaration of global variables
23 extern int verbose; // Level of output to the screen
24
25 // Internal prototype
26 int project_check(Bproject* project, int flags=0);
27
28 int project_display_counts(Bproject* project)
29 {
30 long nfield = project_count_fields(project);
31 long nmg = project_count_micrographs(project);
32 long nmgs = project_count_mg_selected(project);
33 long npart = project_count_mg_particles(project);
34 long nsel = project_count_mg_part_selected(project);
35 long nfil = project_count_mg_filaments(project);
36 long nfn = project_count_mg_filament_nodes(project);
37
38 cout << endl;
39 cout << "Fields: " << nfield << endl;
40 cout << "Micrographs: " << nmg << " ( " << nmgs << " selected)" << endl;
41 cout << "Particles: " << npart << " ( " << nsel << " selected)" << endl;
42 cout << "Filaments and nodes: " << nfil << " " << nfn << endl;
43 cout << endl;
44
45 long nrec = project_count_reconstructions(project);
46 long nrecs = project_count_rec_selected(project);
47 npart = project_count_rec_particles(project);
48 nsel = project_count_rec_part_selected(project);
49 nfil = project_count_rec_filaments(project);
50 nfn = project_count_rec_filament_nodes(project);
51
52 cout << "Reconstructions: " << nrec << " ( " << nrecs << " selected)" << endl;
53 cout << "Particles: " << npart << " ( " << nsel << " selected)" << endl;
54 cout << "Filaments and nodes: " << nfil << " " << nfn << endl;
55 cout << endl;
56
57 return 0;
58 }
59
60 /* The filename is for the current input parameter file */
61 int field_resolve_file_access(Bfield* field, Bmicrograph* mg, Bstring filename, int flags)
62 {
63 if ( filename.length() < 1 ) return 0;
64
65 Bstring path;
66 Bparticle* part;
67
68 if ( filename.contains("/") ) path = filename.pre_rev('/');
69
70 if ( verbose & VERB_DEBUG )
71 cout << "DEBUG field_resolve_file_access: file=" << filename << " path=" << path << endl;
72
73 for ( ; field; field = field->next ) {
74 if ( !mg ) mg = field->mg;
75 for ( ; mg; mg = mg->next ) {
76 mg->fmg = find_file(mg->fmg, path, flags);
77 mg->fframe = find_file(mg->fframe, path, flags);
78 mg->fpart = find_file(mg->fpart, path, flags);
79 mg->ffil = find_file(mg->ffil, path, flags);
80 mg->fft = find_file(mg->fft, path, flags);
81 mg->fps = find_file(mg->fps, path, flags);
82 if ( mg->part && mg->part->fpart.length() )
83 for ( part = mg->part; part; part = part->next )
84 part->fpart = find_file(part->fpart, path, flags);
85 }
86 }
87
88 return 0;
89 }
90
91 /* The filename is for the current input parameter file */
92 int reconstruction_resolve_file_access(Breconstruction* rec, Bstring filename, int flags)
93 {
94 if ( filename.length() < 1 ) return 0;
95
96 Bstring path;
97 Bparticle* part;
98
99 if ( filename.contains("/") ) path = filename.pre_rev('/');
100
101 if ( verbose & VERB_DEBUG )
102 cout << "DEBUG reconstruction_resolve_file_access: file=" << filename << " path=" << path << endl;
103
104 for ( ; rec; rec = rec->next ) {
105 rec->frec = find_file(rec->frec, path, flags);
106 rec->fft = find_file(rec->fft, path, flags);
107 rec->fps = find_file(rec->fps, path, flags);
108 rec->fpart = find_file(rec->fpart, path, flags);
109 rec->ffil = find_file(rec->ffil, path, flags);
110 for ( part = rec->part; part; part = part->next )
111 part->fpart = find_file(part->fpart, path, flags);
112 }
113
114 return 0;
115 }
116
117 int project_resolve_file_access(Bproject* project, Bstring filename, int flags)
118 {
119 if ( filename.length() < 1 ) return 0;
120
121 field_resolve_file_access(project->field, NULL, filename, flags);
122
123 reconstruction_resolve_file_access(project->rec, filename, flags);
124
125 return 0;
126 }
127
140 Bproject* read_project(const char* filename, int flags)
141 {
142 Bstring thefile(filename);
143 return read_project(thefile, flags);
144 }
145
146 Bproject* read_project(Bstring& filename, int flags)
147 {
148 Bstring xsdfile;
149 return read_project(filename, xsdfile, flags);
150 }
151
152 Bproject* read_project(Bstring& filename, Bstring& xsdfile, int flags)
153 {
154 if ( filename.empty() ) {
155 error_show("No micrograph parameter filename!", __FILE__, __LINE__);
156 return NULL;
157 }
158
159 Bstring ext = filename.extension();
160
161 if ( verbose & VERB_LABEL )
162 cout << "Parameter filename: " << filename << endl;
163
164 int err;
165 Bproject* project = project_init();
166 project->filename = filename;
167
168 if ( ext.contains("star") ) {
169 err = read_project_star(filename, project);
170 } else if ( ext.contains("xml") ) {
171 err = read_project_xml(filename, project);
172 } else if ( ext.contains("emx") ) {
173 err = read_project_emx(filename, project, xsdfile);
174 } else if ( ext.contains("imod") ) {
175 err = read_project_imod(&filename, project, 0);
176 } else if ( ext.contains("mdoc") ) {
177 err = read_project_serialem(filename, project, 0);
178 } else {
179 cerr << "Error: Extension \"" << ext << "\" not valid for parameter files!" << endl;
180 cerr << " Parameter file \"" << filename << "\" not read." << endl;
181 err = -1;
182 }
183
184 if ( err < 0 ) {
185 error_show(filename.c_str(), __FILE__, __LINE__);
186 project_kill(project);
187 return NULL;
188 }
189
190 field_resolve_file_access(project->field, NULL, filename, flags & 8);
191
192 reconstruction_resolve_file_access(project->rec, filename, flags & 8);
193
194 project_check(project, flags);
195
196 if ( verbose & VERB_PROCESS )
197 project_display_counts(project);
198
199 return project;
200 }
201
202 Bproject* read_project(Bstring* file_list, int flags)
203 {
204 Bstring xsdfile;
205 return read_project(file_list, xsdfile, flags);
206 }
207
208 Bproject* read_project(Bstring* file_list, Bstring& xsdfile, int flags)
209 {
210 if ( !file_list ) {
211 error_show("No micrograph parameter filename!", __FILE__, __LINE__);
212 return NULL;
213 }
214
215 Bstring ext = file_list->extension();
216 Bstring* thisfile;
217
218 if ( verbose & VERB_LABEL ) {
219 cout << "Reading parameter files:";
220 for ( thisfile = file_list; thisfile; thisfile = thisfile->next )
221 cout << " " << *thisfile;
222 cout << endl;
223 }
224
225 int err;
226 Bproject* project = project_init();
227 Bfield* field = NULL;
228 Bmicrograph* mg = NULL;
229 Breconstruction* rec = NULL;
230 project->filename = *file_list;
231
232 if ( ext.contains("imod") ) {
233 err = read_project_imod(file_list, project, 0);
234 } else if ( ext.contains("mdoc") ) {
235 err = read_project_serialem(*file_list, project, 0);
236 } else for ( thisfile = file_list; thisfile; thisfile = thisfile->next ) {
237 for ( field = project->field; field && field->next; field = field->next ) ;
238 if ( field ) for ( mg = field->mg; mg && mg->next; mg = mg->next ) ;
239 for ( rec = project->rec; rec && rec->next; rec = rec->next ) ;
240 ext = thisfile->extension();
241 if ( ext.contains("star") ) {
242 err = read_project_star(*thisfile, project);
243 } else if ( ext.contains("xml") ) {
244 err = read_project_xml(*thisfile, project);
245 } else if ( ext.contains("emx") ) {
246 err = read_project_emx(*thisfile, project, xsdfile);
247 } else {
248 cerr << "Error: Extension \"" << ext << "\" not valid for parameter files!" << endl;
249 cerr << " Parameter file \"" << *thisfile << "\" not read." << endl;
250 err = -1;
251 }
252 if ( !err ) {
253 if ( !field ) field = project->field;
254 // else field = field->next;
255 // cout << "field " << field->id << endl;
256 if ( field ) {
257 if ( !mg ) mg = field->mg;
258 // else mg = mg->next;
259 // cout << "mg " << mg->id << endl;
260 if ( mg ) field_resolve_file_access(field, mg, *thisfile, flags & 8);
261 }
262 if ( !rec ) rec = project->rec;
263 // else rec = rec->next;
264 if ( rec ) reconstruction_resolve_file_access(rec, *thisfile, flags & 8);
265 }
266 }
267
268 if ( err < 0 ) {
269 error_show(file_list->c_str(), __FILE__, __LINE__);
270 project_kill(project);
271 return NULL;
272 }
273
274 project_check(project, flags);
275
276 if ( verbose & VERB_PROCESS )
277 project_display_counts(project);
278
279 return project;
280 }
281
282 long append_project(Bproject* project, Bstring* file_list, Bstring& xsdfile, int flags)
283 {
284 long nmg(0);
285
286 Bproject* project_append = read_project(file_list, xsdfile, flags);
287
288 Bfield* field;
289 Bmicrograph* mg;
290
291 for ( field = project->field; field; field = field->next ) {
292 for ( mg = field->mg; mg; mg = mg->next, nmg++ ) ;
293 if ( project_append && !field->next ) {
294 field->next = project_append->field;
295 project_append->field = NULL;
296 project_kill(project_append);
297 project_append = NULL;
298 }
299 }
300
301 return nmg;
302 }
303
304 Bparticle* read_particle(Bstring& filename, Bparticle** partlist, FOMType fom_tag[NFOM])
305 {
306 #if defined(HAVE_XML)
307 return read_particle_xml(filename, partlist, fom_tag);
308 #else
309 return NULL;
310 #endif
311 }
312
313
320 int write_project(const char* filename, Bproject* project)
321 {
322 Bstring thefile(filename);
323 return write_project(thefile, project, 0);
324 }
325
335 int write_project(Bstring& filename, Bproject* project,
336 int mg_select, int rec_select)
337 {
338 int flags(0);
339 if ( mg_select ) flags |= 2;
340 if ( rec_select ) flags |= 4;
341 return write_project(filename, project, flags);
342 }
343
358 int write_project(Bstring& filename, Bproject* project, int flags)
359 {
360 int err(0);
361 int mg_select(flags & 2), rec_select(flags & 4);
362
363 project_resolve_file_access(project, filename, flags);
364
365 project_check(project, flags & 1);
366
367 if ( verbose & VERB_PROCESS )
368 project_display_counts(project);
369
370 if ( project->split == 9 )
371 return write_project_star(filename, project, mg_select, rec_select);
372
373 if ( filename.empty() )
374 return error_show("No micrograph parameter filename!", __FILE__, __LINE__);
375
376 Bstring ext = filename.extension();
377
378 if ( verbose )
379 cout << "Writing parameter file: " << filename << endl;
380
381 if ( ext.contains("star") ) {
382 err = write_project_star(filename, project, mg_select, rec_select);
383 } else if ( ext.contains("xml") ) {
384 err = write_project_xml(filename, project, mg_select, rec_select);
385 } else if ( ext.contains("emx") ) {
386 err = write_project_emx(filename, project, mg_select, rec_select);
387 } else if ( ext.contains("imod") ) {
388 err = write_project_imod(filename, project);
389 } else {
390 cerr << "Error: Extension \"" << ext << "\" not valid for parameter files!" << endl;
391 cerr << " Parameter file \"" << filename << "\" not written." << endl;
392 err = -1;
393 }
394
395 if ( err < 0 )
396 error_show(filename.c_str(), __FILE__, __LINE__);
397 else
398 project->filename = filename;
399
400 return err;
401 }
402
403 int write_particle(Bstring& filename, Bparticle* part, int euler_flag, int omega_flag, FOMType fom_tag[NFOM])
404 {
405 #if defined(HAVE_XML)
406 return write_particle_xml(filename, part, euler_flag, omega_flag, fom_tag);
407 #else
408 return 0;
409 #endif
410 }
411
412 Bstring ppx_filename(Bstring& mg_id, int part_id)
413 {
414 Bstring filename = "ppx/" + mg_id + "_" + Bstring(part_id, "%04d") + ".ppx";
415 return filename;
416 }
417
418 int ppx_check(Bparticle* part, FOMType fom_tag[NFOM])
419 {
420 int exists(0), f;
421 Bstring filename = ppx_filename(part->mg->id, part->id);
422 Bparticle* part_nu = NULL;
423 Bparticle* part_list = NULL;
424
425 if ( access(filename.c_str(), R_OK) == 0 ) {
426 part_nu = read_particle(filename, &part_list, fom_tag);
427 if ( part_nu ) {
428 if ( part_nu->def > 0 ) {
429 part->def = part_nu->def;
430 part->dev = part_nu->dev;
431 part->ast = part_nu->ast;
432 }
433 part->mag = part_nu->mag;
434 // part->loc = part_nu->loc;
435 part->ori = part_nu->ori;
436 part->view = part_nu->view;
437 for ( f=0; f<NFOM; f++ ) part->fom[f] = part_nu->fom[f];
438 part->sel = part_nu->sel;
439 if ( part_nu->fpart.length() ) part->fpart = part_nu->fpart;
440 particle_kill(part_nu);
441 exists = 1;
442 }
443 }
444
445 // cout << "exists=" << exists << endl;
446
447 return exists;
448 }
449
450 int ppx_check(Bparticle* part)
451 {
452 FOMType fom_tag[NFOM] = {FOM, FOM_CV};
453
454 return ppx_check(part, fom_tag);
455 }
456
468 int project_update_comment(Bproject* project, int n, char** strings)
469 {
470 time_t ti = time(NULL);
471
472 int i;
473 Bstring new_comment("# ");
474
475 for ( i=0; i<n; i++ )
476 new_comment = new_comment + strings[i] + " ";
477
478 new_comment = new_comment + "\n# " + asctime(localtime(&ti)) + "\n";
479
480 if ( verbose & VERB_DEBUG )
481 cout << "DEBUG project_update_comment: " << new_comment << endl;
482
483 project->comment += new_comment;
484
485 return project->comment.length();
486 }
487
488 int project_check(Bproject* project, int flags)
489 {
490 int i, j;
491 Bfield* field;
492 Bmicrograph* mg;
493 Breconstruction* rec;
494 Bparticle* part;
495 Bbadarea* bad;
496 Bstring part_file;
497
498 if ( verbose & VERB_DEBUG )
499 cout << "DEBUG project_check: " << endl;
500
501 if ( project->field == NULL && project->rec ) project->select = 1;
502
503 for ( field=project->field; field; field=field->next ) {
504 i = 1;
505 for ( mg=field->mg; mg; mg=mg->next ) {
506 if ( verbose & VERB_DEBUG )
507 cout << "DEBUG project_check: mg=" << mg->id << endl;
508 if ( mg->next ) {
509 if ( mg->id == mg->next->id ) {
510 mg->id = mg->id + Bstring(i++, "_%03d");
511 if ( verbose )
512 cout << "Resetting micrograph ID: " << mg->id << endl;
513 if ( !mg->next->next ) {
514 mg->next->id = mg->next->id + Bstring(i, "_%03d");
515 if ( verbose )
516 cout << "Resetting micrograph ID: " << mg->next->id << endl;
517 }
518 }
519 }
520 if ( mg->sampling < 1e3 ) mg->sampling *= 1e4;
521 if ( mg->magnification < 1e3 ) mg->magnification *= 1e3;
522 if ( mg->pixel_size < 0.01 ) {
523 if ( mg->magnification && mg->sampling ) {
524 mg->pixel_size = mg->sampling/mg->magnification;
525 if ( mg->pixel_size < 0.01 ) mg->pixel_size *= 1e4; // Assume um
526 } else {
527 mg->pixel_size = 1;
528 }
529 }
530 if ( mg->scale[0] <= 0 ) mg->scale[0] = 1;
531 if ( mg->scale[1] <= 0 ) mg->scale[1] = 1;
532 if ( mg->scale[2] <= 0 ) mg->scale[2] = 1;
533 if ( mg->ctf ) {
534 if ( mg->ctf->volt() < 1e3 ) mg->ctf->volt(1e3*mg->ctf->volt());
535 if ( mg->ctf->Cs() < 1e3 ) mg->ctf->Cs(1e7*mg->ctf->Cs());
536 if ( mg->ctf->defocus_average() < 10 ) mg->ctf->defocus_average(1e4*mg->ctf->defocus_average());
537 if ( mg->ctf->defocus_deviation() < 10 ) mg->ctf->defocus_deviation(1e4*mg->ctf->defocus_deviation());
538 mg->ctf->zero(1);
539 }
540 if ( mg->part ) part_file = mg->part->fpart;
541 for ( part = mg->part; part; part = part->next ) {
542 if ( part->id < 1 )
543 cerr << "Error: Particle has an ID less than 1! (" << mg->id << ")" << endl;
544 part->mg = mg;
545 if ( part_file.length() && part_file != part->fpart ) part_file = 0;
546 if ( part->pixel_size < 0.01 ) part->pixel_size = mg->pixel_size;
547 }
548 if ( part_file.length() ) {
549 mg->fpart = part_file;
550 for ( part = mg->part; part; part = part->next ) part->fpart = 0;
551 part_file = 0;
552 }
553 for ( j=0, bad = mg->bad; bad; bad = bad->next ) bad->id = --j;
554 }
555 }
556
557 if ( verbose & VERB_DEBUG )
558 cout << "DEBUG project_check: micrographs=" << project_count_micrographs(project) << endl;
559
560 i = 1;
561 for ( rec=project->rec; rec; rec=rec->next ) {
562 if ( rec->next ) {
563 if ( rec->id == rec->next->id ) {
564 rec->id = rec->id + Bstring(i++, "_%03d");
565 if ( verbose )
566 cout << "Resetting reconstruction ID: " << rec->id << endl;
567 if ( !rec->next->next ) {
568 rec->next->id = rec->next->id + Bstring(i, "_%03d");
569 if ( verbose )
570 cout << "Resetting reconstruction ID: " << rec->next->id << endl;
571 }
572 }
573 }
574 if ( rec->voxel_size < 0.01 ) rec->voxel_size = 1;
575 if ( rec->scale[0] <= 0 ) rec->scale[0] = 1;
576 if ( rec->scale[1] <= 0 ) rec->scale[1] = 1;
577 if ( rec->scale[2] <= 0 ) rec->scale[2] = 1;
578 for ( part = rec->part; part; part = part->next ) {
579 if ( part->id < 1 )
580 cerr << "Error: Particle has an ID less than 1! (" << mg->id << ")" << endl;
581 part->rec = rec;
582 if ( part->pixel_size < 0.01 ) part->pixel_size = rec->voxel_size;
583 }
584 for ( j=0, bad = rec->bad; bad; bad = bad->next ) bad->id = --j;
585 }
586
587 if ( verbose & VERB_DEBUG )
588 cout << "DEBUG project_check: reconstructions=" << project_count_reconstructions(project) << endl;
589
590 field = project->field;
591 if ( ( flags & 1 ) && field ) {
592 if ( project_check_particles(project) < 0 ) bexit(-1);
593 }
594
595 project_update_first_zero(project);
596
597 return 0;
598 }
599
610 int project_split_write(Bstring& filename, Bproject* project)
611 {
612 long n(1), c, max(0);
613 Bstring fn;
614 Bfield* field;
615 Bmicrograph* mg;
616 Breconstruction* rec;
617 Bparticle* part;
618
619 if ( project->select < 1 ) {
620 for ( field = project->field; field; field = field->next )
621 for ( mg = field->mg; mg; mg = mg->next )
622 for ( part = mg->part; part; part = part->next )
623 if ( max < part->sel ) max = part->sel;
624 } else {
625 for ( rec = project->rec; rec; rec = rec->next )
626 for ( part = rec->part; part; part = part->next )
627 if ( max < part->sel ) max = part->sel;
628 }
629
630 if ( verbose )
631 cout << "Splitting into " << max << " sets of particles" << endl;
632
633 for ( n=1; n<=max; n++ ) {
634 if ( project->select < 1 ) {
635 for ( c=0, field = project->field; field; field = field->next ) {
636 for ( mg = field->mg; mg; mg = mg->next ) {
637 mg->select = 0;
638 for ( part = mg->part; part; part = part->next ) if ( part->sel == n ) {
639 mg->select = 1;
640 c++;
641 }
642 }
643 }
644 for ( rec = project->rec; rec; rec = rec->next )
645 rec->select = 0;
646 } else {
647 for ( field = project->field; field; field = field->next )
648 for ( mg = field->mg; mg; mg = mg->next )
649 mg->select = 0;
650 for ( c=0, rec = project->rec; rec; rec = rec->next ) {
651 rec->select = 0;
652 for ( part = rec->part; part; part = part->next ) if ( part->sel == n ) {
653 rec->select = 1;
654 c++;
655 }
656 }
657 }
658 if ( c ) {
659 fn = filename.pre_rev('.') + Bstring(n, "_%04d.") + filename.post_rev('.');
660 if ( verbose )
661 cout << "Writing " << fn << " with " << c << " particles" << endl;
662 write_project(fn, project, 1, 1);
663 }
664 }
665
666 return n;
667 }
668
678 int project_split_field_write(Bproject* project)
679 {
680 Bproject* project_temp = project_init();
681 project_temp->comment = project->comment;
682
683 int n(0);
684 Bfield* field, *field_next;
685 Bstring fn;
686
687 for ( field = project->field; field; field = field->next ) {
688 field_next = field->next;
689 field->next = NULL;
690 project_temp->field = field;
691 fn = field->id + ".star";
692 write_project(fn, project_temp, 1, 1);
693 field->next = field_next;
694 }
695
696 return n;
697 }
698
Bparticle::id
int id
Definition: mg_processing.h:92
rwmg.h
Header file for reading and writing micrograph parameters.
CTFparam::zero
double zero(int i)
Definition: ctf.h:218
CTFparam::Cs
double Cs()
Definition: ctf.h:87
write_project_emx
int write_project_emx(Bstring &filename, Bproject *project, int mg_select, int rec_select)
Writing micrograph parameters to an EMX file.
Definition: rwmgEMX.cpp:317
Bparticle::pixel_size
double pixel_size
Definition: mg_processing.h:98
write_particle
int write_particle(Bstring &filename, Bparticle *part, int euler_flag, int omega_flag, FOMType fom_tag[NFOM])
Definition: rwmg.cpp:403
read_project_star
int read_project_star(Bstring &filename, Bproject *project)
Reading micrograph parameters from STAR files.
Definition: rwmgSTAR.cpp:29
Bparticle::ast
double ast
Definition: mg_processing.h:97
Bproject::rec
Breconstruction * rec
Definition: mg_processing.h:344
rwmgIMOD.h
Converts between IMOD files and a micrograph parameter file.
Bparticle::mag
double mag
Definition: mg_processing.h:94
Bparticle::rec
Breconstruction * rec
Definition: mg_processing.h:105
project_count_rec_filaments
long project_count_rec_filaments(Bproject *project)
Counts the number of filaments in a project.
Definition: mg_processing.cpp:1008
Bparticle::view
View view
Definition: mg_processing.h:101
Breconstruction::part
Bparticle * part
Definition: mg_processing.h:304
Bproject::filename
Bstring filename
Definition: mg_processing.h:335
Breconstruction::fpart
Bstring fpart
Definition: mg_processing.h:288
Bmicrograph::id
Bstring id
Definition: mg_processing.h:202
Bbadarea
Definition: mg_processing.h:142
Bmicrograph::sampling
double sampling
Definition: mg_processing.h:213
utilities.h
Header file for general utilities.
verbose
int verbose
VERB_DEBUG
#define VERB_DEBUG
Definition: utilities.h:112
Breconstruction
Definition: mg_processing.h:280
Bproject::split
int split
Definition: mg_processing.h:337
project_display_counts
int project_display_counts(Bproject *project)
Definition: rwmg.cpp:28
mg_img_proc.h
Header file for image processing from micrograph structures.
ppx_check
int ppx_check(Bparticle *part, FOMType fom_tag[NFOM])
Definition: rwmg.cpp:418
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
project_update_first_zero
int project_update_first_zero(Bproject *project)
Updates the first zero from the defocus average for all the micrographs.
Definition: mg_ctf.cpp:1776
read_project_emx
int read_project_emx(Bstring &filename, Bproject *project, Bstring &xsdfile)
Reading micrograph parameters from XML files.
Definition: rwmgEMX.cpp:241
Bstring::length
long length() const
Definition: Bstring.cpp:263
Bmicrograph::pixel_size
double pixel_size
Definition: mg_processing.h:214
project
Bproject * project
Definition: bshow.cpp:31
project_count_mg_particles
long project_count_mg_particles(Bproject *project)
Counts all the particles in the project structure.
Definition: mg_processing.cpp:811
particle_kill
int particle_kill(Bparticle *part)
Frees a list of particles.
Definition: mg_processing.cpp:1323
VERB_PROCESS
#define VERB_PROCESS
Definition: utilities.h:107
project_count_rec_filament_nodes
long project_count_rec_filament_nodes(Bproject *project)
Counts the number of filaments in a project.
Definition: mg_processing.cpp:1029
project_count_micrographs
long project_count_micrographs(Bproject *project)
Counts all the micrographs in the project structure.
Definition: mg_processing.cpp:746
mg_ctf.h
Functions for CTF (contrast transfer function) processing.
project_count_mg_filaments
long project_count_mg_filaments(Bproject *project)
Counts the number of filaments in a project.
Definition: mg_processing.cpp:960
rwmgSerialEM.h
Converts between SerialEM MDOC files and a micrograph parameter file.
write_particle_xml
int write_particle_xml(Bstring &filename, Bparticle *part, int euler_flag, int omega_flag, FOMType fom_tag[NFOM])
Bmicrograph::ffil
Bstring ffil
Definition: mg_processing.h:208
project_count_mg_filament_nodes
long project_count_mg_filament_nodes(Bproject *project)
Counts the number of filament nodes in a project.
Definition: mg_processing.cpp:983
Bfield::next
Bfield * next
Definition: mg_processing.h:258
append_project
long append_project(Bproject *project, Bstring *file_list, Bstring &xsdfile, int flags)
Definition: rwmg.cpp:282
project_init
Bproject * project_init()
Initializes a micrograph processing project parameter structure.
Definition: mg_processing.cpp:29
Bmicrograph::part
Bparticle * part
Definition: mg_processing.h:239
project_check
int project_check(Bproject *project, int flags=0)
Definition: rwmg.cpp:488
read_project
Bproject * read_project(const char *filename, int flags)
Reading micrograph parameters from files.
Definition: rwmg.cpp:140
project_count_rec_particles
long project_count_rec_particles(Bproject *project)
Counts all the particles in the project structure.
Definition: mg_processing.cpp:902
FOM_CV
Definition: mg_processing.h:42
Bmicrograph::fpart
Bstring fpart
Definition: mg_processing.h:207
project_count_rec_selected
long project_count_rec_selected(Bproject *project)
Counts all the selected reconstructions in the project structure.
Definition: mg_processing.cpp:795
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
Bstring::contains
bool contains(const Bstring &s)
Definition: Bstring.cpp:584
Bparticle::sel
long sel
Definition: mg_processing.h:103
Bfield
Definition: mg_processing.h:257
Bmicrograph::ctf
CTFparam * ctf
Definition: mg_processing.h:238
Bparticle::mg
Bmicrograph * mg
Definition: mg_processing.h:104
rwmgXML.h
Reads and writes micrograph XML files.
NFOM
#define NFOM
Definition: mg_processing.h:16
read_project_serialem
int read_project_serialem(Bstring &filename, Bproject *project, int flag)
Creates a project structure using SerialEM MDOC parameters.
Definition: rwmgSerialEM.cpp:44
Bmicrograph::fframe
Bstring fframe
Definition: mg_processing.h:206
write_project
int write_project(const char *filename, Bproject *project)
Writing micrograph parameters to a file.
Definition: rwmg.cpp:320
project_check_particles
int project_check_particles(Bproject *project)
Checks particle numbers and box sizes.
Definition: mg_img_proc.cpp:548
Bbadarea::next
Bbadarea * next
Definition: mg_processing.h:143
Bfield::id
Bstring id
Definition: mg_processing.h:259
Bstring::next
Bstring * next
Definition: Bstring.h:31
Bmicrograph::select
long select
Definition: mg_processing.h:203
Bproject::field
Bfield * field
Definition: mg_processing.h:343
rwmgSTAR.h
Header file for reading and writing micrograph parameters from and to the STAR format.
Bstring::extension
Bstring extension()
Definition: Bstring.cpp:515
CTFparam::defocus_deviation
double defocus_deviation()
Definition: ctf.h:102
ppx_filename
Bstring ppx_filename(Bstring &mg_id, int part_id)
Definition: rwmg.cpp:412
Bmicrograph
Definition: mg_processing.h:200
mg_tags.h
All STAR and XML file format tags for micrographs and reconstructions.
read_project_xml
int read_project_xml(Bstring &filename, Bproject *project)
Reading micrograph parameters from XML files.
Definition: rwmgXML.cpp:144
file_util.h
Header file for file checking functions.
Bparticle::fpart
Bstring fpart
Definition: mg_processing.h:91
rwmgEMX.h
Reads and writes micrograph exchange files.
Bparticle::ori
Vector3< double > ori
Definition: mg_processing.h:100
reconstruction_resolve_file_access
int reconstruction_resolve_file_access(Breconstruction *rec, Bstring filename, int flags)
Definition: rwmg.cpp:92
Bstring::c_str
const char * c_str()
Definition: Bstring.h:70
Bbadarea::id
int id
Definition: mg_processing.h:144
Bstring::post_rev
Bstring post_rev(char c)
Definition: Bstring.cpp:428
Bfield::mg
Bmicrograph * mg
Definition: mg_processing.h:264
FOM
Definition: mg_processing.h:40
project_count_mg_selected
long project_count_mg_selected(Bproject *project)
Counts all the selected micrographs in the project structure.
Definition: mg_processing.cpp:763
Bparticle::dev
double dev
Definition: mg_processing.h:96
read_particle
Bparticle * read_particle(Bstring &filename, Bparticle **partlist, FOMType fom_tag[NFOM])
Definition: rwmg.cpp:304
write_project_star
int write_project_star(const char *filename, Bproject *project, int mg_select, int rec_select)
Writing micrograph parameters to a STAR file.
Definition: rwmgSTAR.cpp:56
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
Breconstruction::fft
Bstring fft
Definition: mg_processing.h:290
read_particle_xml
Bparticle * read_particle_xml(Bstring &filename, Bparticle **partlist, FOMType fom_tag[NFOM])
Bmicrograph::fps
Bstring fps
Definition: mg_processing.h:210
Bparticle
Definition: mg_processing.h:89
project_count_fields
long project_count_fields(Bproject *project)
Counts all the fields in the project structure.
Definition: mg_processing.cpp:731
Bstring
Definition: Bstring.h:29
write_project_xml
int write_project_xml(Bstring &filename, Bproject *project, int mg_select, int rec_select)
Writing micrograph parameters to a XML file.
Definition: rwmgXML.cpp:258
Bmicrograph::fft
Bstring fft
Definition: mg_processing.h:209
project_kill
int project_kill(Bproject *project)
Frees a whole project.
Definition: mg_processing.cpp:1224
Bproject::select
int select
Definition: mg_processing.h:339
CTFparam::volt
double volt()
Definition: ctf.h:83
FOMType
FOMType
Definition: mg_processing.h:38
Breconstruction::select
long select
Definition: mg_processing.h:283
project_count_reconstructions
long project_count_reconstructions(Bproject *project)
Counts all the reconstructions in the project structure.
Definition: mg_processing.cpp:780
Breconstruction::scale
Vector3< double > scale
Definition: mg_processing.h:294
Breconstruction::ffil
Bstring ffil
Definition: mg_processing.h:289
Breconstruction::bad
Bbadarea * bad
Definition: mg_processing.h:306
Bmicrograph::fmg
Bstring fmg
Definition: mg_processing.h:205
Bmicrograph::bad
Bbadarea * bad
Definition: mg_processing.h:241
Bmicrograph::magnification
double magnification
Definition: mg_processing.h:212
CTFparam::defocus_average
double defocus_average()
Definition: ctf.h:100
Bparticle::def
double def
Definition: mg_processing.h:95
project_split_field_write
int project_split_field_write(Bproject *project)
Splits a project into sets of particle selections and write the files.
Definition: rwmg.cpp:678
Breconstruction::fps
Bstring fps
Definition: mg_processing.h:291
find_file
Bstring find_file(Bstring filename, Bstring path, int flag=0)
Searches for a file within or without the given path.
Definition: file_util.cpp:54
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
read_project_imod
int read_project_imod(Bstring *file_list, Bproject *project, int flag)
Creates a project structure using IMOD parameters.
Definition: rwmgIMOD.cpp:242
Bproject::comment
Bstring comment
Definition: mg_processing.h:336
project_resolve_file_access
int project_resolve_file_access(Bproject *project, Bstring filename, int flags)
Definition: rwmg.cpp:117
Bstring::pre_rev
Bstring pre_rev(char c)
Definition: Bstring.cpp:413
field_resolve_file_access
int field_resolve_file_access(Bfield *field, Bmicrograph *mg, Bstring filename, int flags)
Definition: rwmg.cpp:61
Bstring::empty
bool empty()
Definition: Bstring.h:71
Bparticle::next
Bparticle * next
Definition: mg_processing.h:90
project_split_write
int project_split_write(Bstring &filename, Bproject *project)
Splits a project into sets of particle selections and write the files.
Definition: rwmg.cpp:610
write_project_imod
int write_project_imod(Bstring &imodfile, Bproject *project)
Creates IMOD parameter files from a project structure.
Definition: rwmgIMOD.cpp:451
VERB_LABEL
#define VERB_LABEL
Definition: utilities.h:106
Bmicrograph::scale
Vector3< double > scale
Definition: mg_processing.h:221
bexit
int bexit(int value)
Exit function for cleanup and debugging.
Definition: utilities.cpp:273
Breconstruction::next
Breconstruction * next
Definition: mg_processing.h:281
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
Bmicrograph::next
Bmicrograph * next
Definition: mg_processing.h:201