Bsoft  2.1.0
Bernard's software package
bmg.cpp
Go to the documentation of this file.
1 
9 #include "mg_processing.h"
10 #include "mg_img_proc.h"
11 #include "mg_particle_select.h"
12 #include "rwmg.h"
13 #include "mg_ctf.h"
14 #include "file_util.h"
15 #include "utilities.h"
16 #include "options.h"
17 
18 // Declaration of global variables
19 extern int verbose; // Level of output to the screen
20 
21 // Usage assistance
22 const char* use[] = {
23 " ",
24 "Usage: bmg [options] input.star/input.img [input.star/input.img]",
25 "----------------------------------------------------------------",
26 "Manipulates micrograph parameter files.",
27 "If the input files are images, a new parameter file will be created.",
28 " ",
29 "Actions:",
30 "-reconstructions Operate on reconstruction parameters rather than micrographs.",
31 "-getfield field1 Get a single field from a parameter file.",
32 "-getmicrograph mg1 Get a single micrograph from a parameter file.",
33 "-selected Show selected particles.",
34 "-histogram 80,0.01 Histogram of magnification values of selected particles.",
35 "-add Add micrograph coordinates and particle origins.",
36 "-Euler Convert orientations from views to Euler angles.",
37 "-View Convert orientations from Euler angles to views.",
38 "-flip y Reverse the particle coordinates in the micrographs along the given axis.",
39 "-oriflip y Reverse the particle origins along the given axis.",
40 "-toview -2.5,5.5,9,45 Transform particle orientations relative to this view.",
41 "-toeuler 45,30,10 Transform particle orientations relative to these Euler angles.",
42 "-remove Do not write non-selected micrographs into the parameter file.",
43 " ",
44 "Actions dealing with file references:",
45 "-check Check if files can be found.",
46 "-filenames Delete file names of files not found.",
47 " ",
48 "Actions for generating parameters from images:",
49 "-extract part Extract views from images: mg, frame, rec, part, fil.",
50 " ",
51 "Actions modifiying images:",
52 "-write Write particle views into images.",
53 "-bin 3 Bin micrographs by given kernel size, new file names with a \"_b<n>\" insert.",
54 "-changepixelsize 3.68 Change the pixel size and all associated size parameters.",
55 " ",
56 "Parameters:",
57 "-verbose 7 Verbosity of output.",
58 "-numberperfield 3 Number of micrographs per field-of-view (default 1).",
59 "-fieldID dbgd Set the field ID (multiple micrographs will get numbered ID's).",
60 "-mgpath dir/subdir Set micrograph file paths.",
61 "-framepath dir/subdir Set micrograph frames file paths.",
62 "-pspath dir/subdir Set power spectrum file paths.",
63 "-partpath dir/subdir Set particle file paths.",
64 "-filpath dir/subdir Set filament file paths.",
65 "-samemgpart Set micrograph and particle file names to be the same.",
66 "-Scansampling 3.6 Set scan sampling or pixel size (um/pixel).",
67 "-mgpixelsize 1.2,1.15,1 Set micrograph pixel size (angstrom/pixel, one value sets all).",
68 "-partpixelsize 2.3,2.2,1 Set particle pixel size (angstrom/pixel, one value sets all).",
69 "-boxsize 55 Set particle box size (default from parameter file).",
70 "-mgorigin 1256,1256,1 Set micrograph origins (voxels).",
71 "-partorigin 215,215,1 Set particle origins (voxels).",
72 " ",
73 "Actions setting microscope and CTF parameters:",
74 "-Magnification 38500 Set magnification.",
75 "-electrondose 35.5 Set electron dose (electrons/angstrom)",
76 "-Defocus 1.8,0.3,-34 Set defocus average, deviation, and astigmatism angle (um, degrees).",
77 "-Astigmatism 0.3,-34 Set defocus deviation and astigmatism angle (um, degrees).",
78 "-Cs 2.0 Set spherical aberration, Cs (mm).",
79 "-Volt 100 Set acceleration voltage (kV).",
80 "-Amplitude 0.07 Set amplitude contrast (fraction)",
81 "-alpha 0.15 Set illumination half-angle (milliradians).",
82 "-basetype 2 Baseline type: (default 1)",
83 " Type 1: Polynomial with 5 coefficients.",
84 " Type 2: Double Gaussian with 5 coefficients.",
85 " Type 3: EMAN style with 4 coefficients.",
86 "-baseline 1,1.5,-2.6,12.9,30,118 Baseline type and 4 or 5 coefficients: (default 1,0,0,0,0)",
87 "-envtype 3 Envelope type: (default 4)",
88 " Type 1: Single gaussian (2 coefficients).",
89 " Type 2: Single gaussian with constant (3 coefficients).",
90 " Type 3: Double gaussian (4 coefficients).",
91 " Type 4: Double gaussian with constant (5 coefficients).",
92 "-reset defocus Reset particle defocus to micrograph defocus.",
93 " ",
94 "Input:",
95 "-input input.star Input master parameter file to merge in data blocks from other input files.",
96 "-revert part.star,15 Replace file names with those in this file,",
97 " with a flag indicating: 1=mg, 2=ps, 4=rec, 8=part.",
98 "-replacectf ctf.star Replace CTF parameters with those in this file.",
99 "-replacepart part.star Replace particle parameters with those in this file.",
100 "-validate mg.xsd Validate XML input file(s) with this schema.",
101 "-ppx update Process files in directory \"ppx\":",
102 " update: Update particle records in the parameter file.",
103 " list: List existing ppx files.",
104 " absent: List absent ppx files.",
105 " ",
106 "Output:",
107 "-output output.star Output parameter file (required any time \"-split\" is used to indicate the type).",
108 "-split 3 Split micrograph or reconstruction data blocks into individual files:",
109 " Argument: 1-6: number of digits inserted before extension",
110 " Argument: \"id\": micrograph ID's are used as file names (no -output required).",
111 " Argument: \"field\": field ID's are used as file names (no -output required).",
112 "-dump file.txt Dump all the particle origins and views.",
113 " ",
114 NULL
115 };
116 
117 int main (int argc, char **argv)
118 {
119  // Initialize optional variables
120  int use_rec(0); // Flag to process reconstructions
121  int fom_index(0); // Index of FOM to act on
122  Bstring mgpath; // Micrograph file path
123  Bstring framepath; // Micrograph frames file path
124  Bstring pspath; // Power spectrum file path
125  Bstring partpath; // Particle file path
126  Bstring filpath; // Filament file path
127  Bstring field_id; // User-specified field ID
128  Bstring get_field; // Field ID to get
129  Bstring get_mg; // Micrograph ID to get
130 // Bstring magfile; // STAR format file with map magnification parameters
131  int show_selected(0); // Don't show selected by default
132  int bins(0); // Bins must be >0 to get histogram
133  double histo_inc(0.01); // Histogram increment
134  int nseries(0); // Number of micrographs in a series from a field
135  int add_origins(0); // Add origins to micrograph coordinates
136  int bin(0); // Binning for micrographs
137  Bstring extract; // Create records from images
138  int write_views(0); // Use particle views from parameter file
139  int mg_part_flag(0); // Different mg & part file names
140  double magnification(0); // Magnification
141  double sampling(0); // Take scan sampling from input files
142  Vector3<double> mg_pixel; // Take micrograph pixel size from input files
143  Vector3<double> part_pixel; // Take particle pixel size from input files
144  Vector3<double> new_pixel_size; // New pixel size to rescale all length parameters
145  Vector3<double> mgorigin; // Micrograph origin
146  Vector3<double> partorigin; // Particle origin
147  int box_size(0); // Particle box size
148  double def_avg(0); // No defocus specified
149  double def_dev(0); // Default no astigmatism
150  double ast_angle(0); // Default astigmatism angle
151  double dose(0); // Electron dose
152  double Cs(0); // Spherical aberration
153  double Volts(0); // Acceleration voltage
154  double Amp(0); // Amplitude contrast contribution
155  double alpha(0); // Illumination half-angle (radians)
156  int basetype(1); // Baseline type: 1=poly, 2=double_gauss, 3=EMAN
157  double base[5] = {1,0,0,0,0}; // Baseline coefficients
158  int envtype(4); // Envelope type: 1=gauss, 2=gauss+, 3=double_gauss, 4=double_gauss+
159  double env[5] = {1,-10,0,0,0}; // Envelope coefficients
160  int setbase(0);
161  int setenv(0);
162  int setcohenv(0); // Flag to set partial coherence envelope
163  Bstring reset; // Reset a particle parameter from its micrograph
164  int to_euler(0); // No conversion
165  int to_views(0); // No conversion
166  int loc_flip(0); // No location flipping
167  int ori_flip(0); // No origin flipping
168  View view; // View for new reference
169  Euler euler; // Euler angles for new reference
170  Bstring masterfile; // Input master parameter file name
171  Bstring revertfilenames; // Parameter file name with old file names
172  int name_flag(0); // File names to reveert to old versions
173  Bstring replacectffile; // Parameter file name with desired CTF parameters
174  Bstring replacepartfile; // Parameter file name with desired particle parameters
175  Bstring xsdfile; // XML schema file
176  Bstring ppx("none"); // Processing ppx files
177  Bstring outfile; // Output parameter file name
178  Bstring dumpfile; // File to dump particle info to
179  int split(0); // Output one big STAR file
180  int read_flags(0); // Flags to pass to the parameter file reading function
181  int write_flags(0); // Flags to pass to the parameter file writing function
182 
183  int optind;
184  Boption* option = get_option_list(use, argc, argv, optind);
185  Boption* curropt;
186  for ( curropt = option; curropt; curropt = curropt->next ) {
187  if ( curropt->tag == "reconstructions" ) use_rec = 1;
188  if ( curropt->tag == "getfield" ) {
189  get_field = curropt->value;
190  if ( get_field.length() < 1 )
191  cerr << "-getfield: A field ID must be specified!" << endl;
192  }
193  if ( curropt->tag == "getmicrograph" ) {
194  get_mg = curropt->value;
195  if ( get_mg.length() < 1 )
196  cerr << "-getmicrograph: A micrograph ID must be specified!" << endl;
197  }
198  if ( curropt->tag == "selected" )
199  show_selected = 1;
200  if ( curropt->tag == "histogram" )
201  if ( curropt->values(bins, histo_inc) < 1 ) {
202  cerr << "-histogram: The number of bins must be specified!" << endl;
203  bexit(-1);
204  }
205  if ( curropt->tag == "numberperfield" )
206  if ( ( nseries = curropt->value.integer() ) < 1 ) {
207  cerr << "-numberperfield: The number of micrographs in a field-of-view must be specified!" << endl;
208  bexit(-1);
209  }
210  if ( curropt->tag == "add" )
211  add_origins = 1;
212  if ( curropt->tag == "toview" ) {
213  view = curropt->view();
214  }
215  if ( curropt->tag == "toeuler" ) {
216  euler = curropt->euler();
217  view = euler.view();
218  }
219  if ( curropt->tag == "remove" ) write_flags |= 2;
220  if ( curropt->tag == "check" ) read_flags |= 8;
221  if ( curropt->tag == "filenames" ) read_flags |= 24;
222  if ( curropt->tag == "bin" )
223  if ( ( bin = curropt->value.integer() ) < 1 )
224  cerr << "-bin: A binning value must be specified!" << endl;
225  if ( curropt->tag == "extract" ) extract = curropt->value;
226  if ( curropt->tag == "write" )
227  write_views = 1;
228  if ( curropt->tag == "changepixelsize" )
229  new_pixel_size = curropt->scale();
230  if ( curropt->tag == "fieldID" ) {
231  field_id = curropt->value;
232  if ( field_id.length() < 1 )
233  cerr << "-fieldID: A field ID must be specified!" << endl;
234  }
235  if ( curropt->tag == "mgpath" ) {
236  mgpath = curropt->value;
237  if ( mgpath.length() < 1 )
238  cerr << "-mgpath: The micrograph file path must be specified!" << endl;
239  else
240  if ( mgpath[-1] != '/' ) mgpath += "/";
241  }
242  if ( curropt->tag == "framepath" ) {
243  framepath = curropt->value;
244  if ( framepath.length() < 1 )
245  cerr << "-framepath: The micrograph frames file path must be specified!" << endl;
246  else
247  if ( framepath[-1] != '/' ) framepath += "/";
248  }
249  if ( curropt->tag == "pspath" ) {
250  pspath = curropt->value;
251  if ( pspath.length() < 1 )
252  cerr << "-pspath: The power spectrum file path must be specified!" << endl;
253  else
254  if ( pspath[-1] != '/' ) pspath += "/";
255  }
256  if ( curropt->tag == "partpath" ) {
257  partpath = curropt->value;
258  if ( partpath.length() < 1 )
259  cerr << "-partpath: The particle file path must be specified!" << endl;
260  else
261  if ( partpath[-1] != '/' ) partpath += "/";
262  }
263  if ( curropt->tag == "filpath" ) {
264  filpath = curropt->value;
265  if ( filpath.length() < 1 )
266  cerr << "-filpath: The filament file path must be specified!" << endl;
267  else
268  if ( filpath[-1] != '/' ) filpath += "/";
269  }
270  if ( curropt->tag == "samemgpart" )
271  mg_part_flag = 1;
272  if ( curropt->tag == "Magnification" )
273  if ( ( magnification = curropt->value.real() ) < 0.00001 )
274  cerr << "-Magnification: The magnification must be specified!" << endl;
275  if ( curropt->tag == "Scansampling" ) {
276  if ( ( sampling = curropt->value.real() ) < 0.0001 )
277  cerr << "-Scansampling: The scan sampling must be specified!" << endl;
278  else if ( sampling < 1e3 ) sampling *= 1e4; // Assume um
279  }
280  if ( curropt->tag == "mgpixelsize" )
281  mg_pixel = curropt->scale();
282  if ( curropt->tag == "partpixelsize" )
283  part_pixel = curropt->scale();
284  if ( curropt->tag == "boxsize" )
285  if ( ( box_size = curropt->value.integer() ) < 1 )
286  cerr << "-boxsize: A particle box size in pixels must be specified" << endl;
287  if ( curropt->tag == "mgorigin" )
288  mgorigin = curropt->origin();
289  if ( curropt->tag == "partorigin" )
290  partorigin = curropt->origin();
291  if ( curropt->tag == "electrondose" )
292  if ( ( dose = curropt->value.real() ) < 0.001 )
293  cerr << "-electrondose: The electron dose must be specified!" << endl;
294  if ( curropt->tag == "Defocus" ) {
295  if ( curropt->values(def_avg, def_dev, ast_angle) < 1 )
296  cerr << "-Defocus: A defocus value must be specified!" << endl;
297  else {
298  if ( def_avg < 1e3 ) def_avg *= 1e4; // Assume um
299  if ( def_dev < 1e3 ) def_dev *= 1e4; // Assume um
300  ast_angle *= M_PI/180.0; // Assume degrees
301  }
302  }
303  if ( curropt->tag == "Astigmatism" ) {
304  if ( curropt->values(def_dev, ast_angle) < 1 )
305  cerr << "-Defocus: A defocus value must be specified!" << endl;
306  else {
307  if ( def_dev < 1e3 ) def_dev *= 1e4; // Assume um
308  ast_angle *= M_PI/180.0; // Assume degrees
309  }
310  }
311  if ( curropt->tag == "Cs" ) {
312  if ( ( Cs = curropt->value.real() ) < 0.001 )
313  cerr << "-Cs: A Cs value must be specified!" << endl;
314  else if ( Cs < 1e3 ) Cs *= 1e7; // Assume mm
315  }
316  if ( curropt->tag == "Volt" ) {
317  if ( ( Volts = curropt->value.real() ) < 1 )
318  cerr << "-Volt: A voltage must be specified!" << endl;
319  else if ( Volts < 1e3 ) Volts *= 1e3; // Assume kilovolts
320  }
321  if ( curropt->tag == "Amplitude" ) {
322  if ( ( Amp = curropt->value.real() ) < 0.00001 )
323  cerr << "-Amplitude: A fraction must be specified!" << endl;
324  else if ( Amp > 1 ) Amp /= 100; // Assume percentage
325  }
326  if ( curropt->tag == "alpha" ) {
327  if ( ( alpha = curropt->value.real() ) < 0.00000001 )
328  cerr << "-alpha: The illumination half-angle must be specified!" << endl;
329  else
330  if ( alpha > 0.01 ) alpha /= 1000; // Assume milliradians
331  }
332  if ( curropt->tag == "basetype" ) {
333  basetype = curropt->value.integer();
334  if ( basetype < 1 || basetype > 3 ) {
335  basetype = 1;
336  cerr << "Warning: The baseline type must be 1, 2 or 3. Reset to 1." << endl;
337  } else
338  setbase = 1;
339  }
340  if ( curropt->tag == "baseline" ) {
341  vector<double> d = curropt->value.split_into_doubles(",");
342  for ( size_t i=0; i<d.size(); i++ ) base[i] = d[i];
343  if ( d.size() < 1 )
344  cerr << "-baseline: At least one coefficient must be specified!" << endl;
345  else
346  setbase = 2;
347  }
348  if ( curropt->tag == "envtype" ) {
349  envtype = curropt->value.integer();
350  if ( envtype < 1 || envtype > 4 ) {
351  envtype = 4;
352  cerr << "Warning: The envelope type must be 1, 2, 3 or 4. Reset to 4." << endl;
353  } else
354  setenv = 1;
355  }
356  if ( curropt->tag == "envelope" ) {
357  vector<double> d = curropt->value.split_into_doubles(",");
358  for ( size_t i=0; i<d.size(); i++ ) env[i] = d[i];
359  if ( d.size() < 1 )
360  cerr << "-envelope: At least an envelope amplitude must be specified!" << endl;
361  else
362  setenv = 2;
363  }
364  if ( curropt->tag == "reset" )
365  reset = curropt->value;
366  if ( curropt->tag == "Euler" )
367  to_euler = 1; // Convert orientations to Euler angles
368  if ( curropt->tag == "View" )
369  to_views = 1; // Convert orientations to views
370  if ( curropt->tag == "flip" ) {
371  if ( curropt->value.contains("x") ) loc_flip += 1;
372  if ( curropt->value.contains("y") ) loc_flip += 2;
373  if ( curropt->value.contains("z") ) loc_flip += 4;
374  }
375  if ( curropt->tag == "oriflip" ) {
376  if ( curropt->value.contains("x") ) ori_flip += 1;
377  if ( curropt->value.contains("y") ) ori_flip += 2;
378  if ( curropt->value.contains("z") ) ori_flip += 4;
379  }
380  if ( curropt->tag == "input" )
381  masterfile = curropt->filename();
382  if ( curropt->tag == "revert" ) {
383  revertfilenames = curropt->value.pre(',');
384  name_flag = curropt->value.post(',').integer();
385  }
386  if ( curropt->tag == "replacectf" )
387  replacectffile = curropt->filename();
388  if ( curropt->tag == "replacepart" )
389  replacepartfile = curropt->filename();
390  if ( curropt->tag == "validate" )
391  xsdfile = curropt->filename();
392  if ( curropt->tag == "ppx" ) ppx = curropt->value;
393  if ( curropt->tag == "output" )
394  outfile = curropt->filename();
395  if ( curropt->tag == "split" ) {
396  if ( curropt->value.contains("id") || curropt->value.contains("ID") ) split = 9;
397  else if ( curropt->value.contains("field") || curropt->value.contains("FIELD") ) split = -9;
398  else if ( ( split = curropt->value.integer() ) < 1 )
399  cerr << "-split: An integer must be specified!" << endl;
400  else
401  if ( split > 6 ) split = 6;
402  }
403  if ( curropt->tag == "dump" )
404  dumpfile = curropt->filename();
405  }
406  option_kill(option);
407 
408  if ( pspath.length() < 1 && mgpath.length() ) pspath = mgpath;
409 
410  Bproject* project = NULL;
411  Bproject* project2 = NULL;
412 
413  if ( masterfile.length() )
414  project = read_project(masterfile, read_flags);
415 
416  // Read all the parameter files
417  Bstring* file_list = NULL;
418  while ( optind < argc ) string_add(&file_list, argv[optind++]);
419  if ( !file_list ) {
420  cerr << "Error: No parameter or image files specified!" << endl;
421  bexit(-1);
422  }
423 
424  if ( file_type(*file_list) == Micrograph )
425  project2 = read_project(file_list, xsdfile, read_flags);
426  else
427  project2 = project_create_from_images(file_list, extract);
428 
429  string_kill(file_list);
430 
431 // cout << "---" << project2->filename << endl;
432 
433  if ( project ) {
434  project_update(project, project2, fom_index);
435  project_kill(project2);
436  } else
437  project = project2;
438 
439  if ( use_rec ) project->select = 1;
440 
441  if ( revertfilenames.length() ) {
442  project2 = read_project(revertfilenames, xsdfile, read_flags);
443  project_revert_filenames(project, project2, name_flag);
444  project_kill(project2);
445  }
446 
447  if ( replacectffile.length() ) {
448  project2 = read_project(replacectffile, xsdfile, read_flags);
450  project_kill(project2);
451  }
452 
453  if ( replacepartfile.length() ) {
454  project2 = read_project(replacepartfile, xsdfile, read_flags);
456  project_kill(project2);
457  }
458 
459  if ( ppx[0] == 'u' ) project_update_from_ppx(project);
460  else if ( ppx[0] == 'l' ) {
463  } else if ( ppx[0] == 'a' ) {
466  }
467 
468  if ( get_field.length() )
469  project_select_field(project, get_field);
470 
471  if ( get_mg.length() )
473 
474  if ( reset.length() ) project_reset(project, reset);
475 
476  if ( bin > 1 ) {
477  project_bin_micrographs(project, bin, mgpath, partpath);
478  } else if ( new_pixel_size[0] ) {
479  project_change_pixel_size(project, new_pixel_size, mgpath, partpath);
480  } else {
481  if ( mgpath.length() )
483  if ( framepath.length() )
484  project_set_frame_path(project, framepath);
485  if ( pspath.length() )
487  if ( partpath.length() )
489  if ( filpath.length() )
491  }
492 
493  if ( mg_part_flag )
495 
496  if ( extract.contains("part") )
498 
499  if ( write_views )
501 
502  if ( nseries )
503  project_set_field_id(project, nseries, field_id);
504 
505  if ( magnification )
506  project_set_magnification(project, magnification);
507 
508  if ( sampling )
510 
511  if ( mgorigin[0] )
513 
514  if ( partorigin[0] )
516 
517  if ( mg_pixel[0] )
519 
520  if ( part_pixel[0] )
522 
523  if ( box_size )
525 
526  if ( def_avg )
527  project_set_defocus(project, def_avg, def_dev, ast_angle);
528  else if ( def_dev )
529  project_set_astigmatism(project, def_dev, ast_angle);
530 
531  if ( dose )
532  project_set_dose(project, dose);
533 
534  if ( Volts )
535  project_set_volts(project, Volts);
536 
537  if ( Cs )
538  project_set_Cs(project, Cs);
539 
540  if ( Amp )
541  project_set_amp_shift(project, sin(Amp));
542 
543  if ( alpha )
544  project_set_alpha(project, alpha);
545 
546  if ( setbase )
547  project_set_baseline(project, basetype, base);
548 
549  if ( setenv )
550  project_set_envelope(project, envtype, env);
551 
552  if ( setcohenv )
554 
555  if ( add_origins )
557 
558  if ( loc_flip )
560 
561  if ( ori_flip )
562  project_flip_origins(project, ori_flip);
563 
564  if ( view.vector_size() )
566 
567  if ( verbose & (VERB_RESULT|VERB_LABEL) )
569 
570  if ( show_selected )
572 
573  if ( bins )
574  project_show_mag_histogram(project, bins, histo_inc);
575 
576  if ( to_views && !to_euler )
577  project->euler_flag = 0;
578 
579  if ( to_euler && !to_views )
580  project->euler_flag = 1;
581 
582  if ( dumpfile.length() ) project_dump(project, dumpfile);
583 
584 //
585  if ( project ) {
586  if ( split < 0 )
588  else if ( outfile.length() || split == 9 ) {
589  project->split = split;
590  write_project(outfile, project, write_flags);
591  }
592  }
593 
595 
596  bexit(0);
597 }
project_set_envelope
int project_set_envelope(Bproject *project, int type, double *coeff)
Sets the envelope equations of all the micrographs.
Definition: mg_ctf.cpp:1809
Boption
A class for a command line input option.
Definition: options.h:26
project_flip_particle_coordinates
int project_flip_particle_coordinates(Bproject *project, int flip)
Reverses one or more particle coordinates.
Definition: mg_img_proc.cpp:1081
project_kill
int project_kill(Bproject *project)
Frees a whole project.
Definition: mg_processing.cpp:429
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:810
mg_particle_select.h
Select particles.
Boption::scale
Vector3< double > scale()
Definition: options.h:190
project_set_powerspectrum_path
int project_set_powerspectrum_path(Bproject *project, Bstring &path)
Sets the path to powerspectrum files for all the micrographs.
Definition: mg_processing.cpp:1824
project_update
int project_update(Bproject *project, Bproject *proj_new, int fom_index)
Updates an existing project with new information.
Definition: mg_processing.cpp:809
string_kill
int string_kill(Bstring *list)
Kills a string linked list.
Definition: Bstring.cpp:768
project_merge_CTF_parameters
int project_merge_CTF_parameters(Bproject *project, Bproject *ctfproject)
Puts CTF parameters from one project into another.
Definition: mg_ctf.cpp:1383
project_show_hierarchy
long project_show_hierarchy(Bproject *project)
Shows the project hierarchy.
Definition: mg_processing.cpp:1506
Bproject::select
int select
Definition: mg_processing.h:342
project_bin_micrographs
int project_bin_micrographs(Bproject *project, int bin, Bstring mgpath, Bstring partpath)
Bins all micrographs a project.
Definition: mg_img_proc.cpp:1495
project_update_from_ppx
long project_update_from_ppx(Bproject *project)
Updates a project with ppx files.
Definition: rwmg.cpp:655
file_util.h
Header file for file checking functions.
Bstring
Definition: Bstring.h:29
project_set_dose
int project_set_dose(Bproject *project, double dose)
Sets the electron dose of all the micrographs.
Definition: mg_processing.cpp:2099
Bproject::split
int split
Definition: mg_processing.h:340
base
string base(string &filename)
Definition: string_util.cpp:28
View::vector_size
double vector_size()
Definition: View.h:106
Bstring::integer
long integer()
Definition: Bstring.cpp:547
project_list_ppx
long project_list_ppx(Bproject *project, int flag)
Lists existing ppx files for a project.
Definition: rwmg.cpp:696
Boption::next
Boption * next
Definition: options.h:28
project_set_part_pixel_size
int project_set_part_pixel_size(Bproject *project, Vector3< double > pixel_size)
Sets the pixel size for all the particles.
Definition: mg_processing.cpp:2042
Vector3< double >
bexit
int bexit(int value)
Exit function for cleanup and debugging.
Definition: utilities.cpp:280
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
project_set_baseline
int project_set_baseline(Bproject *project, int type, double *coeff)
Sets the baseline equations of all the micrographs.
Definition: mg_ctf.cpp:1902
project_set_frame_path
int project_set_frame_path(Bproject *project, Bstring &path)
Sets the path to micrograph frames files for all the micrographs.
Definition: mg_processing.cpp:1795
project_set_volts
int project_set_volts(Bproject *project, double volts)
Sets the acceleration voltage of all the micrographs.
Definition: mg_ctf.cpp:1579
Bstring::real
double real()
Definition: Bstring.cpp:553
project_set_field_id
int project_set_field_id(Bproject *project, int nseries, Bstring &field_id)
Sets the field id's according to a regular series.
Definition: mg_processing.cpp:1456
options.h
Header file for option handlers.
project_set_alpha
int project_set_alpha(Bproject *project, double alpha)
Sets the beam source size/divergence angle of all the micrographs.
Definition: mg_ctf.cpp:1752
part_set_sequential
long part_set_sequential(Bproject *project)
Selects one selection number and sets all others to zero.
Definition: mg_particle_select.cpp:352
View
Definition: View.h:26
project_set_micrograph_origins
int project_set_micrograph_origins(Bproject *project, Vector3< double > origin)
Sets micrograph origins to the given origin.
Definition: mg_processing.cpp:2122
Bstring::post
Bstring post(char c)
Definition: Bstring.cpp:402
Boption::origin
Vector3< double > origin()
Definition: options.h:180
Boption::view
View view()
Definition: options.h:247
verbose
int verbose
project
Bproject * project
Definition: bshow.cpp:33
Boption::tag
Bstring tag
Definition: options.h:29
Boption::values
long values(T1 &v1, T2 &v2)
Definition: options.h:115
rwmg.h
Header file for reading and writing micrograph parameters.
project_set_mg_pixel_size
int project_set_mg_pixel_size(Bproject *project, Vector3< double > pixel_size)
Sets the pixel size for all the micrographs.
Definition: mg_processing.cpp:1997
project_show_selected
long project_show_selected(Bproject *project)
Shows the selected particles in a project.
Definition: mg_select.cpp:907
project_merge_part_parameters
int project_merge_part_parameters(Bproject *project, Bproject *partproject)
Puts particle parameters from one project into another.
Definition: mg_processing.cpp:1118
project_set_particle_path
int project_set_particle_path(Bproject *project, Bstring &path)
Sets the path to particle files for all the micrographs.
Definition: mg_processing.cpp:1853
Bstring::pre
Bstring pre(char c)
Definition: Bstring.cpp:389
project_show_mag_histogram
long project_show_mag_histogram(Bproject *project, long bins, double increment)
Shows the histogram for magnification values for selected particles.
Definition: mg_select.cpp:1422
project_dump
long project_dump(Bproject *project, Bstring &filename)
Dumps particle info in the project hierarchy.
Definition: mg_processing.cpp:1646
Micrograph
@ Micrograph
Definition: file_util.h:23
project_set_astigmatism
int project_set_astigmatism(Bproject *project, double def_dev, double ast_angle)
Sets the defocus deviation and astigmatism angle of all the micrographs.
Definition: mg_ctf.cpp:1514
Boption::value
Bstring value
Definition: options.h:30
VERB_RESULT
#define VERB_RESULT
Definition: utilities.h:109
mg_ctf.h
Functions for CTF (contrast transfer function) processing.
project_create_from_images
Bproject * project_create_from_images(Bstring *file_list, Bstring type)
Creates a project structure using image file names.
Definition: mg_img_proc.cpp:230
project_rotate_particle_views
int project_rotate_particle_views(Bproject *project, View view)
Rotates particle views with respect to a reference view.
Definition: mg_processing.cpp:2429
Bproject
Definition: mg_processing.h:336
use
const char * use[]
Definition: bmg.cpp:22
Bstring::split_into_doubles
vector< double > split_into_doubles(const Bstring &delim)
Definition: Bstring.cpp:673
mg_img_proc.h
Header file for image processing from micrograph structures.
project_set_views_in_images
int project_set_views_in_images(Bproject *project)
Sets views in particle images from the project parameter structure.
Definition: mg_img_proc.cpp:1193
project_equal_mg_part_files
int project_equal_mg_part_files(Bproject *project)
Sets micrograph and particle files to be the same.
Definition: mg_processing.cpp:88
project_set_filament_path
int project_set_filament_path(Bproject *project, Bstring &path)
Sets the path to filament files for all the micrographs.
Definition: mg_processing.cpp:1903
read_project
Bproject * read_project(const char *filename, int flags=0)
Reading micrograph parameters from files.
Definition: rwmg.cpp:141
Euler::view
View view()
Definition: Euler.h:62
M_PI
#define M_PI
Definition: utilities.h:63
utilities.h
Header file for general utilities.
project_select_field
int project_select_field(Bproject *project, Bstring &field_id)
Selects a field from the project and deletes the rest.
Definition: mg_select.cpp:1468
split
vector< string > split(const string &s)
Splits a string on whitespace.
Definition: string_util.cpp:92
Bstring::length
long length() const
Definition: Bstring.cpp:263
project_select_micrograph
int project_select_micrograph(Bproject *project, Bstring &mg_id)
Selects a micrograph from the project and deletes the rest.
Definition: mg_select.cpp:1500
project_set_particle_box_size
int project_set_particle_box_size(Bproject *project, Vector3< long > box_size)
Sets particle box size to the given value.
Definition: mg_processing.cpp:2284
project_revert_filenames
int project_revert_filenames(Bproject *project, Bproject *project_old, int flag)
Reverts file names to what it was in an old project.
Definition: mg_processing.cpp:1388
Bproject::euler_flag
int euler_flag
Definition: mg_processing.h:343
project_set_particle_origins
int project_set_particle_origins(Bproject *project, Vector3< double > origin)
Sets particle origins to given values.
Definition: mg_processing.cpp:2348
project_set_views_from_images
int project_set_views_from_images(Bproject *project)
Gets views from particle images.
Definition: mg_img_proc.cpp:1144
write_project
int write_project(const char *filename, Bproject *project)
Writing micrograph parameters to a file.
Definition: rwmg.cpp:321
main
int main(int argc, char **argv)
Definition: bmg.cpp:117
project_flip_origins
int project_flip_origins(Bproject *project, int flip)
Flip origin coordinates.
Definition: mg_processing.cpp:2196
mg_processing.h
Header file for micrograph processing.
project_set_scan_sampling
int project_set_scan_sampling(Bproject *project, double sampling)
Sets the scan sampling for all the micrographs.
Definition: mg_processing.cpp:1977
Boption::filename
Bstring filename()
Definition: options.h:85
option_kill
int option_kill(Boption *option)
Deallocates a linked list of option structures.
Definition: options.cpp:111
project_set_amp_shift
int project_set_amp_shift(Bproject *project, double amp_shift)
Sets the amplitude contribution of all the micrographs.
Definition: mg_ctf.cpp:1638
project_set_magnification
int project_set_magnification(Bproject *project, double mag)
Sets the magnification for all the micrographs.
Definition: mg_processing.cpp:1954
Boption::euler
Euler euler()
Definition: options.h:259
project_reset
long project_reset(Bproject *project, Bstring &reset)
Reset a particle parameter from its micrograph.
Definition: mg_processing.cpp:2516
project_change_pixel_size
int project_change_pixel_size(Bproject *project, Vector3< double > new_pixel_size, Bstring mgpath, Bstring partpath)
Changes all the micrograph fields linked to the pixel size.
Definition: mg_img_proc.cpp:1526
Bstring::contains
bool contains(const Bstring &s)
Definition: Bstring.cpp:592
VERB_LABEL
#define VERB_LABEL
Definition: utilities.h:110
Euler
Definition: Euler.h:28
project_add_origins_to_coords
int project_add_origins_to_coords(Bproject *project)
Adds the particle origins to the micrograph coordinates.
Definition: mg_processing.cpp:2154
string_add
Bstring * string_add(Bstring **list, const char *string)
Adds a string to a linked list.
Definition: Bstring.cpp:713
project_set_coherence_envelope
int project_set_coherence_envelope(Bproject *project)
Replaces envelope equations with those based on partial coherence in all micrographs.
Definition: mg_ctf.cpp:1844
project_set_defocus
int project_set_defocus(Bproject *project, double def_avg, double def_dev, double ast_angle)
Sets the defocus values of all the micrographs.
Definition: mg_ctf.cpp:1463
project_set_micrograph_path
int project_set_micrograph_path(Bproject *project, Bstring &path)
Sets the path to micrograph files for all the micrographs.
Definition: mg_processing.cpp:1766
file_type
FileType file_type(const char *filename)
Checks the file type using the extension and contents.
Definition: file_util.cpp:178
project_set_Cs
int project_set_Cs(Bproject *project, double Cs)
Sets the spherical aberation constant of all the micrographs.
Definition: mg_ctf.cpp:1609