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