Bsoft  2.1.0
Bernard's software package
btrack.cpp
Go to the documentation of this file.
1 
9 #include "rwmg.h"
10 #include "rwimg.h"
11 #include "mg_processing.h"
12 #include "mg_img_proc.h"
13 #include "mg_align.h"
14 #include "mg_tomography.h"
15 #include "mg_tomo_track.h"
16 //#include "ps_micrograph.h"
17 #include "ps_marker.h"
18 #include "utilities.h"
19 #include "options.h"
20 #include "timer.h"
21 
22 
23 // Declaration of global variables
24 extern int verbose; // Level of output to the screen
25 
26 // Usage assistance
27 const char* use[] = {
28 " ",
29 "Usage: btrack [options] input.star [input.star]",
30 "-----------------------------------------------",
31 "Track fiducial markers in a tomographic tilt series of micrographs.",
32 " ",
33 "Actions:",
34 "-all Select all markers.",
35 "-updatematrix Update micrograph matrices from tilt and axis angles.",
36 "-lambda 2650 Calculate thickness from proportionality coefficient (in angstrom).",
37 "-adjusttilt Apply tilt adjustments based on intensity variation.",
38 "-pick 1,20,1 Pick seed markers in reference image (1) or all images (2),",
39 " excluding the distance from the edge (in pixels).",
40 " and a flag to add to rather than replace existing markers.",
41 "-generatemarkers Generates markers for all micrographs from a seed.",
42 "-findaxis 10,1.5,-30,50 Finds the tilt axis using seed markers and micrographs ",
43 " near the given tilt angle and with the axis angle step size,",
44 " start and end (default axis parameters: 1,-180,180).",
45 "-track 5,1.5 Track markers: number of iterations and residual target (default 10% of marker radius).",
46 " using zero-tilt reference markers as seed.",
47 "-crossmarker Cross-correlate markers during z-search (default real space correlate).",
48 "-recenter Recenter z coordinates during tracking (default not).",
49 "-refine shifts Refine marker parameters:",
50 " markers: Refine marker micrograph positions.",
51 " z: Refine marker z positions.",
52 " origins: Refine micrograph origins.",
53 " scales: Refine micrograph scales.",
54 " views: Refine view transforms.",
55 " all: Refine origins, scales and views simultaneously.",
56 " 8,v,o,z: Refine iteratively in sequence views, origins and z's.",
57 "-resetmodel Reset the x and y marker coordinates to that of the zero-degree tilt image.",
58 "-angles Calculate micrograph orientation angles.",
59 "-check Determine if markers all fall within micrograph boundaries.",
60 "-fix Fix markers falling outside micrograph boundaries.",
61 "-errors 1.6 Show errors above this threshold (distance in pixels).",
62 "-exclude 0,1,134-140 Exclude these micrographs (can be \"none\").",
63 "-deselect 5-9,33 Deselect markers by id from all micrographs and models.",
64 " ",
65 "Parameters:",
66 "-verbose 7 Verbosity of output.",
67 "-datatype u Force writing of a new data type.",
68 "-sampling 1.5,1.5,1.5 Sampling (A/pixel; a single value can be given).",
69 "-resolution 900,300 High and low resolution limits for cross-correlation (default 0.1,1000 angstrom).",
70 "-origin 110,50,44 Origin for tilt axis (default 0,0,0).",
71 "-axis 74.7 Tilt axis angle relative to x-axis (default 0 or from parameter file).",
72 "-tilt -65,1.5 Tilt series start and step size (default from parameter file).",
73 "-reference 48 Reference image for alignment (default closest to zero tilt).",
74 "-edge 23,12 Smooth the edge to a given width, with gaussian decay of a given width.",
75 "-goldradius 12 Gold particle radius (default from parameter file).",
76 "-shiftlimit 155.5 Limit on micrograph shift search in pixels (default 25% of micrograph width).",
77 "-thickness 2156.5 Estimated tomogram thickness (default and minimum 1000 angstrom).",
78 " ",
79 "Output:",
80 "-output file.star Output parameter file (produces numbered files for tracking).",
81 "-image file.pif Output multi-image file with aligned images.",
82 "-Postscript out.ps Postscript output with marker error plots.",
83 " ",
84 NULL
85 };
86 
87 
88 int main(int argc, char** argv)
89 {
90  // Initializing variables
91  int select_all(0); // Flag to select all markers
92  int update_matrix(0); // Flag to update micrograph matrix
93  int adjust_tilt(0); // Flag to apply tilt adjustments based on intensity variation
94  int reset_model(0); // Flag to reset the x and y coordinates of the model
95  int genmarkers(0); // Generates markers for all micrographs from a seed
96  int pickmarkers(0); // Flag to pick markers in reference image (1) or all images (2)
97  int addmarkers(0); // Flag to add picked markers rather than replace old markers
98  double lambda(0); // Calculates the thickness
99  double findaxis(0); // Flag and tilt angle to find tilt axis
100  double axis_step(1); // Tilt axis angle step size (in degrees)
101  double axis_start(-180); // Tilt axis angle start (in degrees)
102  double axis_end(180); // Tilt axis angle end (in degrees)
103  int trackmarkers(0); // Flag to align using markers
104  double target(0); // Target resdual to terminate tracking
105  int cc_type(0); // Type of marker correlation: 0=real space, 1=cross correlation
106  int recenter(0); // Flag to recenter z coordinates
107  int edge(0); // Edge to exclude from picking markers
108  int ref_iter(0); // Refine geometric transformations: iterations
109  double ref_tol(1e-4); // Refine geometric transformations: tolerance
110  Bstring refop; // String to define refine operations
111  int fixmarkers(0); // Flag to fix markers falling outside micrograph boundaries
112  int checkmarkers(0); // Flag to determine if markers all fall within micrograph boundaries
113  int calc_angles(0); // Flag to calculate micrograph orientation angles
114  double error_cutoff(0); // Threshold to show errors
115  Bstring mg_exclude; // Micrographs to exclude
116  Bstring deselect; // String specifying markers to deselect
117  double gold_radius(0); // Gold marker radius
118  DataType datatype(Unknown_Type); // Conversion to new type
119  int ref_img(-1); // Reference image for alignment, <0 means find zero tilt
120  Vector3<double> sam; // Units for the three axes (A/pixel)
121  double hi_res(0), lo_res(1000); // Default resolution range
122  Vector3<double> origin; // Tilt axis origin
123  double tilt_axis(0); // Tilt axis angle
124  double tilt_start(0); // Tilt angle start
125  double tilt_step(0); // Tilt_angle step size
126  double edge_width(0), gauss_width(0); // Edge parameters
127  double shift_limit(-1); // Micrograph shift search limit
128  double thickness(0); // Estimated tomogram thickness in angstrom
129  Bstring paramfile; // Output parameter file
130  Bstring imgfile; // Output multi-image file
131  Bstring psfile; // Output postscript file
132 
133  int optind;
134  Boption* option = get_option_list(use, argc, argv, optind);
135  Boption* curropt;
136  for ( curropt = option; curropt; curropt = curropt->next ) {
137  if ( curropt->tag == "all" ) select_all = 1;
138  if ( curropt->tag == "updatematrix" ) update_matrix = 1;
139  if ( curropt->tag == "adjusttilt" ) adjust_tilt = 1;
140  if ( curropt->tag == "lambda" )
141  if ( ( lambda = curropt->value.real() ) < 1 )
142  cerr << "-lambda: A mean free path must be specified!" << endl;
143  if ( curropt->tag == "pick" )
144  if ( curropt->values(pickmarkers, edge, addmarkers) < 1 )
145  cerr << "-pick: A 1 or 2 must be specified." << endl;
146  if ( curropt->tag == "generatemarkers" ) genmarkers = 1;
147  if ( curropt->tag == "findaxis" ) {
148  if ( curropt->values(findaxis,
149  axis_step, axis_start, axis_end) < 1 )
150  cerr << "-findaxis: A tilt angle must be specified." << endl;
151  else {
152  findaxis *= M_PI/180.0;
153  axis_step *= M_PI/180.0;
154  axis_start *= M_PI/180.0;
155  axis_end *= M_PI/180.0;
156  }
157  }
158  if ( curropt->tag == "track" )
159  if ( curropt->values(trackmarkers, target) < 1 )
160  cerr << "-track: A maximum number of iterations must be specified." << endl;
161  if ( curropt->tag == "crossmarker" ) cc_type = 1;
162  if ( curropt->tag == "recenter" ) recenter = 1;
163  if ( curropt->tag == "refine" ) {
164  ref_iter = curropt->value.integer();
165  if ( ref_iter < 1 ) {
166  ref_iter = 1;
167  refop = curropt->value.substr(0,1).lower();
168  } else {
169  refop = curropt->value.post(',').remove(',');
170  }
171  if ( refop.length() < 1 ) {
172  cerr << "-refine: The option is misformed! (" << curropt->value << ")" << endl;
173  bexit(-1);
174  }
175  }
176  if ( curropt->tag == "resetmodel" ) reset_model = 1;
177  if ( curropt->tag == "angles" ) calc_angles = 1;
178  if ( curropt->tag == "check" ) checkmarkers = 1;
179  if ( curropt->tag == "fix" ) fixmarkers = 1;
180  if ( curropt->tag == "errors" )
181  if ( ( error_cutoff = curropt->value.real() ) < 0.001 )
182  cerr << "-errors: An error cutoff value must be specified." << endl;
183  if ( curropt->tag == "exclude" ) mg_exclude = curropt->value;
184  if ( curropt->tag == "deselect" ) deselect = curropt->value;
185  if ( curropt->tag == "datatype" )
186  datatype = curropt->datatype();
187  if ( curropt->tag == "sampling" )
188  sam = curropt->scale();
189  if ( curropt->tag == "reference" )
190  if ( ( ref_img = curropt->value.integer() ) < 0 )
191  cerr << "-reference: An image number must be specified." << endl;
192  if ( curropt->tag == "resolution" ) {
193  if ( curropt->values(hi_res, lo_res) < 1 )
194  cerr << "-resolution: Resolution limits must be specified." << endl;
195  else if ( hi_res > lo_res )
196  swap(hi_res, lo_res);
197  }
198  if ( curropt->tag == "origin" )
199  origin = curropt->origin();
200  if ( curropt->tag == "axis" ) {
201  tilt_axis = curropt->value.real();
202  tilt_axis = angle_set_negPI_to_PI(tilt_axis*M_PI/180.0);
203  update_matrix = 1;
204  /* if ( ( tilt_axis = curropt->value.real() ) == 0 )
205  cerr << "-axis: The tilt axis angle must be specified." << endl;
206  else {
207  tilt_axis = angle_set_negPI_to_PI(tilt_axis*M_PI/180.0);
208  update_matrix = 1;
209  }*/
210  }
211  if ( curropt->tag == "tilt" ) {
212  if ( curropt->values(tilt_start, tilt_step) < 2 )
213  cerr << "-tilt: Three angles must be specified." << endl;
214  else {
215  tilt_start = angle_set_negPI_to_PI(tilt_start*M_PI/180.0);
216  tilt_step = angle_set_negPI_to_PI(tilt_step*M_PI/180.0);
217  update_matrix = 1;
218  }
219  }
220  if ( curropt->tag == "edge" )
221  if ( curropt->values(edge_width, gauss_width) < 1 )
222  cerr << "-edge: An edge width must be specified." << endl;
223  if ( curropt->tag == "goldradius" )
224  if ( ( gold_radius = curropt->value.real() ) < 1 )
225  cerr << "-goldradius: A gold marker radius must be specified." << endl;
226  if ( curropt->tag == "shiftlimit" )
227  if ( ( shift_limit = curropt->value.real() ) < 1 )
228  cerr << "-shiftlimit: A shift limit in pixels must be specified." << endl;
229  if ( curropt->tag == "thickness" )
230  if ( ( thickness = curropt->value.real() ) < 1 )
231  cerr << "-thickness: An estimated tomogram tickness must be specified." << endl;
232  if ( curropt->tag == "output" )
233  paramfile = curropt->filename();
234  if ( curropt->tag == "image" )
235  imgfile = curropt->filename();
236  if ( curropt->tag == "Postscript" )
237  psfile = curropt->filename();
238  }
239  option_kill(option);
240 
241  double ti = timer_start();
242 
243  // Read all the parameter files
244  Bstring* file_list = NULL;
245  while ( optind < argc ) string_add(&file_list, argv[optind++]);
246  if ( !file_list ) {
247  cerr << "Error: No parameter or image files specified!" << endl;
248  bexit(-1);
249  }
250 
251  Bproject* project = read_project(file_list);
252  string_kill(file_list);
253 
254  if ( !project || !project->field || !project->field->mg ) {
255  cerr << "Error: No micrographs in input file!" << endl;
256  bexit(-1);
257  }
258 
259  if ( verbose & VERB_PROCESS )
261 
263 
264  if ( origin[0] )
266 
267  if ( project->field->mg->origin[0] < 1 || project->field->mg->origin[1] < 1 )
269 
270  if ( mg_exclude.length() )
271  project_mg_exclude(project, mg_exclude);
272 
273  if ( deselect.length() )
275 
276  if ( tilt_axis )
277  project_set_tilt_axis(project, tilt_axis);
278 
279  if ( tilt_step )
280  project_set_tilt_angles(project, tilt_start, tilt_step);
281 
282  if ( project->field->mg->matrix.determinant() < 0.5 )
283  update_matrix = 1;
284 
285  if ( update_matrix )
287 
288  if ( sam[0] > 0 )
290 
291  double tlr(0);
292  Bplot* plot = NULL;
293  if ( adjust_tilt || lambda ) {
295  tlr = project_fit_intensities(project, plot, adjust_tilt);
296  if ( lambda ) {
297  if ( thickness < 100 ) thickness = lambda*tlr;
298  if ( verbose ) {
299  cout << "Thickness: " << lambda*tlr << " A" << endl;
300  cout << "Proportionality parameter: " << lambda << " A" << endl << endl;
301  }
302  }
303  }
304 
305  int i;
306  Bmicrograph* mg_ref = NULL;
307  if ( ref_img > -1 )
308  for ( i=0, mg_ref=project->field->mg; mg_ref && ( i<ref_img ); mg_ref=mg_ref->next, i++ ) ;
309 
310  if ( !mg_ref )
312 // cout << "Reference micrograph: " << mg_ref->id << " (" << mg_ref->img_num << ")" << endl;
313 
314  if ( !mg_ref->mark && !pickmarkers )
315  for ( mg_ref = project->field->mg; mg_ref && !mg_ref->mark; mg_ref = mg_ref->next ) ;
316 // cout << "Reference micrograph: " << mg_ref->id << " (" << mg_ref->img_num << ")" << endl;
317 
318  if ( !mg_ref ) {
320  if ( !pickmarkers ) pickmarkers = 1;
321  }
322 
323  if ( verbose )
324  cout << "Reference micrograph: " << mg_ref->id << " (" << mg_ref->img_num << ")" << endl;
325 
326  if ( pickmarkers == 1 )
327  mg_find_markers(mg_ref, edge, addmarkers);
328  else if ( pickmarkers == 2 )
329  project_find_markers(project, edge, addmarkers);
330 
331  if ( !project->rec )
333 
334  // Set a uniform voxel size
335  sam = mg_ref->pixel_size;
336  sam[2] = sam[1] = sam[0];
338 
339  if ( project->rec->origin.length() < 1 )
341 
342  if ( gold_radius ) {
343  project_set_marker_radius(project, gold_radius);
344  } else {
345  project->rec->mark_radius = mg_ref->mark_radius;
346  }
347 
348  if ( select_all )
350 
351  if ( findaxis )
352  project_find_tilt_axis(project, findaxis, axis_start, axis_end, axis_step, hi_res, lo_res, shift_limit);
353 
354  if ( !project->rec->mark )
356 
357  if ( genmarkers )
359 
360  if ( reset_model && project->rec->mark )
361  mg_reset_model(mg_ref, project->rec->mark);
362 
363  if ( checkmarkers )
365 
366  if ( fixmarkers && project->rec->mark )
368 
369  if ( trackmarkers > 0 )
370 // project_track_markers(project, hi_res, lo_res, shift_limit,
371 // thickness, trackmarkers, target, cc_type, recenter, paramfile);
372  project_track_markers_dual(project, hi_res, lo_res, shift_limit,
373  thickness, trackmarkers, target, cc_type, recenter, paramfile);
374 
375  if ( ref_iter && refop[0] == 'm' )
376  project_refine_markers(project, hi_res, lo_res);
377 
378  if ( ref_iter && project->rec->mark )
379  project_refine(project, ref_iter, ref_tol, refop);
380 
381  if ( calc_angles )
383 
384  if ( checkmarkers || fixmarkers || ref_iter ) {
387  }
388 
389  if ( error_cutoff )
390  project_show_errors(project, error_cutoff);
391 
392  if ( psfile.length() ) {
393  if ( verbose )
394  cout << "Writing " << psfile << endl;
395  ofstream* fps = NULL;
396  if ( plot ) {
397  fps = ps_open_and_init(psfile, plot);
398  ps_graph(fps, plot, 1);
399  } else {
400  fps = ps_open_and_init(psfile, psfile, 3, 600, 800);
401  }
402  ps_marker_plots(fps, psfile, project);
403  ps_close(fps);
404  }
405 
406  if ( paramfile.length() ) {
407  if ( verbose )
408  cout << "Writing " << paramfile << endl;
409  write_project(paramfile, project, 0, 0);
410  }
411 
412  if ( imgfile.length() ) {
413  if ( verbose )
414  cout << "Writing " << imgfile << endl;
415  project_write_aligned_images(project, NULL, imgfile, datatype);
416  }
417 
419 
420  if ( verbose & VERB_TIME )
421  timer_report(ti);
422 
423  bexit(0);
424 }
425 
Boption
A class for a command line input option.
Definition: options.h:26
project_kill
int project_kill(Bproject *project)
Frees a whole project.
Definition: mg_processing.cpp:429
project_mg_tilt_to_matrix
int project_mg_tilt_to_matrix(Bproject *project)
Sets the matrix from the tilt and axis angles for each micrograph.
Definition: mg_tomography.cpp:2177
Bmicrograph::id
Bstring id
Definition: mg_processing.h:203
Bmicrograph
Definition: mg_processing.h:201
ps_marker.h
Header file for postscript tools dealing with Bmarkers.
Breconstruction::mark
Bmarker * mark
Definition: mg_processing.h:310
project_mg_marker_select
int project_mg_marker_select(Bproject *project, double fom)
Selects markers.
Definition: mg_tomography.cpp:2058
Bstring::remove
Bstring remove(const char c)
Definition: Bstring.cpp:473
mg_find_markers
long mg_find_markers(Bmicrograph *mg, long edge, int add)
Finds markers in a micrograph.
Definition: mg_tomography.cpp:1419
Boption::scale
Vector3< double > scale()
Definition: options.h:190
Bproject::rec
Breconstruction * rec
Definition: mg_processing.h:347
project_check_markers
int project_check_markers(Bproject *project, int flags)
Checks if the markers in a project parameter structure fall within micrographs.
Definition: mg_tomography.cpp:2108
string_kill
int string_kill(Bstring *list)
Kills a string linked list.
Definition: Bstring.cpp:768
Bstring
Definition: Bstring.h:29
project_calculate_model
int project_calculate_model(Bproject *project)
Calculates the z-coordinates of the marker model.
Definition: mg_tomography.cpp:1083
micrograph_get_nominal_origin
Vector3< double > micrograph_get_nominal_origin(Bmicrograph *mg)
Gets the nominal origin for a micrograph.
Definition: mg_img_proc.cpp:741
Bproject::field
Bfield * field
Definition: mg_processing.h:346
Bstring::integer
long integer()
Definition: Bstring.cpp:547
project_sort_markers_by_id
int project_sort_markers_by_id(Bproject *project)
Sorts markers for each micrograph by ID number.
Definition: mg_tomography.cpp:844
Boption::datatype
DataType datatype()
Definition: options.h:93
project_set_nominal_mg_origins
int project_set_nominal_mg_origins(Bproject *project)
Sets micrograph origins to the centers of the micrographs.
Definition: mg_img_proc.cpp:770
Boption::next
Boption * next
Definition: options.h:28
Vector3< double >
bexit
int bexit(int value)
Exit function for cleanup and debugging.
Definition: utilities.cpp:280
mg_tomo_track.h
Functions to track fiducial markers in a tomographic series of images.
Bmicrograph::img_num
int img_num
Definition: mg_processing.h:212
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
Bplot
Definition: Bplot.h:146
Bstring::real
double real()
Definition: Bstring.cpp:553
options.h
Header file for option handlers.
Bfield::id
Bstring id
Definition: mg_processing.h:262
ps_marker_plots
int ps_marker_plots(ofstream *fps, Bstring &title, Bproject *project)
Postscript plot of the errors associated with fiducial markers.
Definition: ps_marker.cpp:24
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
Breconstruction::mark_radius
double mark_radius
Definition: mg_processing.h:304
Boption::origin
Vector3< double > origin()
Definition: options.h:180
VERB_PROCESS
#define VERB_PROCESS
Definition: utilities.h:111
project_set_marker_radius
int project_set_marker_radius(Bproject *project, double mark_radius)
Sets the marker radius in a project parameter structure.
Definition: mg_tomography.cpp:2079
angle_set_negPI_to_PI
double angle_set_negPI_to_PI(double angle)
Returns an angle between -PI and PI.
Definition: utilities.cpp:558
use
const char * use[]
Definition: btrack.cpp:27
Breconstruction::origin
Vector3< double > origin
Definition: mg_processing.h:296
project_calculate_angles
int project_calculate_angles(Bproject *project)
Calculates tilt and tilt axis angles from matrices in a project parameter structure.
Definition: mg_tomography.cpp:1966
project_set_rec_voxel_size
int project_set_rec_voxel_size(Bproject *project, Vector3< double > pixel_size)
Sets the pixel size for all the reconstructions.
Definition: mg_processing.cpp:2021
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_find_tilt_axis
double project_find_tilt_axis(Bproject *project, double tilt, double axis_start, double axis_end, double axis_step, double hi_res, double lo_res, double shift_limit)
Finds the tilt axis for a tomographic tilt series.
Definition: mg_tomo_track.cpp:154
ps_close
int ps_close(ofstream *fps)
Closes a postscript file.
Definition: ps_plot.cpp:105
ps_open_and_init
ofstream * ps_open_and_init(Bstring filename, Bstring title, int npages, int width, int height)
Opens and initializes a postscript file.
Definition: ps_plot.cpp:32
project_tomo_residuals
double project_tomo_residuals(Bproject *project, int show)
Calculates the residuals for an alignment solution.
Definition: mg_tomography.cpp:868
Bmicrograph::origin
Vector3< double > origin
Definition: mg_processing.h:223
Boption::value
Bstring value
Definition: options.h:30
project_fit_intensities
double project_fit_intensities(Bproject *project, Bplot *plot=NULL, int flag=0)
Determines the thickness to mean free path ratio from a tilt series.
Definition: mg_tomography.cpp:619
timer.h
Utilities for timing functions.
Bproject
Definition: mg_processing.h:336
Unknown_Type
@ Unknown_Type
Definition: utilities.h:151
project_write_aligned_images
double project_write_aligned_images(Bproject *project, Bimage *pgr, Bstring &imgfile, DataType datatype)
Calculates aligned micrograph images and write them to a file.
Definition: mg_align.cpp:952
project_intensity_plot
Bplot * project_intensity_plot(Bproject *project)
Transfers the micrograph intensities for a field into a plot.
Definition: mg_tomography.cpp:515
mg_img_proc.h
Header file for image processing from micrograph structures.
VERB_TIME
#define VERB_TIME
Definition: utilities.h:114
Bmicrograph::mark_radius
double mark_radius
Definition: mg_processing.h:238
project_track_markers_dual
int project_track_markers_dual(Bproject *project, double hi_res, double lo_res, double shift_limit, double thickness, int max_cycle, double target, int cc_type, int recenter, Bstring paramfile)
Aligns markers in a tomographic series.
Definition: mg_tomo_track.cpp:490
project_fix_markers
int project_fix_markers(Bproject *project)
Checks if the markers in a project parameter structure fall within micrographs.
Definition: mg_tomography.cpp:2143
ps_graph
int ps_graph(ofstream *fps, Bplot *plot, int page_number)
Generates postscript graphs.
Definition: ps_plot.cpp:247
timer_start
double timer_start()
Starts timer and prints the time.
Definition: timer.cpp:61
read_project
Bproject * read_project(const char *filename, int flags=0)
Reading micrograph parameters from files.
Definition: rwmg.cpp:141
M_PI
#define M_PI
Definition: utilities.h:63
utilities.h
Header file for general utilities.
Bstring::substr
Bstring substr(long start, long len)
Definition: Bstring.cpp:332
Bstring::length
long length() const
Definition: Bstring.cpp:263
Bmicrograph::matrix
Matrix3 matrix
Definition: mg_processing.h:225
project_set_tilt_axis
int project_set_tilt_axis(Bproject *project, double tilt_axis)
Sets the tilt axis angle in a project parameter structure.
Definition: mg_tomography.cpp:1889
timer_report
double timer_report(double lasttime)
Reports the time elapsed since a given time.
Definition: timer.cpp:76
field_find_zero_tilt_mg
Bmicrograph * field_find_zero_tilt_mg(Bfield *field)
Finds the micrograph closest to a zero degree tilt in a series.
Definition: mg_select.cpp:281
project_show_markers
long project_show_markers(Bproject *project)
Shows the markers in a project hierarchy.
Definition: mg_tomography.cpp:1535
project_refine
double project_refine(Bproject *project, int iter, double tol, Bstring refop)
Refines all the alignment parameters.
Definition: mg_tomo_track.cpp:870
project_set_tilt_angles
int project_set_tilt_angles(Bproject *project, double tilt_start, double tilt_step)
Sets the tilt and tilt axis angles in a project parameter structure.
Definition: mg_tomography.cpp:1936
rwimg.h
Header file for 2D and 3D image I/O.
project_tomo_errors
double project_tomo_errors(Bproject *project)
Analyzes marker errors.
Definition: mg_tomography.cpp:1040
write_project
int write_project(const char *filename, Bproject *project)
Writing micrograph parameters to a file.
Definition: rwmg.cpp:321
Bmicrograph::mark
Bmarker * mark
Definition: mg_processing.h:245
Matrix3::determinant
double determinant()
Definition: Matrix3.h:260
mg_processing.h
Header file for micrograph processing.
project_show_errors
long project_show_errors(Bproject *project, double error_cutoff)
Shows the errors in marker coordinates in a project hierarchy.
Definition: mg_tomography.cpp:1565
project_refine_markers
int project_refine_markers(Bproject *project, double hi_res, double lo_res)
Refines marker positions in a tomographic series.
Definition: mg_tomo_track.cpp:685
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
main
int main(int argc, char **argv)
Definition: btrack.cpp:88
Bmicrograph::pixel_size
Vector3< double > pixel_size
Definition: mg_processing.h:215
project_mg_exclude
long project_mg_exclude(Bproject *project, Bstring &mg_exclude)
Deselects micrographs in a project hierarchy.
Definition: mg_tomography.cpp:1839
mg_reset_model
int mg_reset_model(Bmicrograph *mg, Bmarker *model)
Resets the model x and y coordinates from the zero-tilt micrograph.
Definition: mg_tomography.cpp:1349
DataType
DataType
Base data type specifier.
Definition: utilities.h:150
Vector3::length
double length()
Definition: Vector3.h:222
reconstruction_add
Breconstruction * reconstruction_add(Breconstruction **rec, Bstring &rec_id)
Adds a reconstruction parameter structure to a linked list.
Definition: mg_processing.cpp:398
mg_align.h
Header file for functions to align micrographs or coordinates from micrographs and apply the resultan...
project_find_markers
long project_find_markers(Bproject *project, long edge, int add)
Finds all markers in a project.
Definition: mg_tomography.cpp:1394
project_generate_markers
int project_generate_markers(Bproject *project)
Generates missing micrograph and model markers.
Definition: mg_tomography.cpp:1204
Bmicrograph::next
Bmicrograph * next
Definition: mg_processing.h:202
Bstring::lower
Bstring lower()
Definition: Bstring.cpp:316
string_add
Bstring * string_add(Bstring **list, const char *string)
Adds a string to a linked list.
Definition: Bstring.cpp:713
Bfield::mg
Bmicrograph * mg
Definition: mg_processing.h:267
verbose
int verbose
mg_tomography.h
Header file for single particle image processing in Bsoft.
project_deselect_markers
long project_deselect_markers(Bproject *project, Bstring &deselect_list)
Deletes selected markers in a project hierarchy.
Definition: mg_tomography.cpp:1603