 |
Bsoft
2.1.0
Bernard's software package
|
Go to the documentation of this file.
29 "Usage: btrack [options] input.star [input.star]",
30 "-----------------------------------------------",
31 "Track fiducial markers in a tomographic tilt series of micrographs.",
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.",
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).",
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.",
88 int main(
int argc,
char** argv)
101 double axis_start(-180);
102 double axis_end(180);
109 double ref_tol(1e-4);
114 double error_cutoff(0);
117 double gold_radius(0);
121 double hi_res(0), lo_res(1000);
124 double tilt_start(0);
126 double edge_width(0), gauss_width(0);
127 double shift_limit(-1);
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;
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;
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" ) {
165 if ( ref_iter < 1 ) {
171 if ( refop.
length() < 1 ) {
172 cerr <<
"-refine: The option is misformed! (" << curropt->
value <<
")" << endl;
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" )
187 if ( curropt->
tag ==
"sampling" )
188 sam = curropt->
scale();
189 if ( curropt->
tag ==
"reference" )
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);
198 if ( curropt->
tag ==
"origin" )
199 origin = curropt->
origin();
200 if ( curropt->
tag ==
"axis" ) {
211 if ( curropt->
tag ==
"tilt" ) {
212 if ( curropt->
values(tilt_start, tilt_step) < 2 )
213 cerr <<
"-tilt: Three angles must be specified." << endl;
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" )
234 if ( curropt->
tag ==
"image" )
236 if ( curropt->
tag ==
"Postscript" )
245 while ( optind < argc )
string_add(&file_list, argv[optind++]);
247 cerr <<
"Error: No parameter or image files specified!" << endl;
255 cerr <<
"Error: No micrographs in input file!" << endl;
270 if ( mg_exclude.
length() )
293 if ( adjust_tilt || lambda ) {
297 if ( thickness < 100 ) thickness = lambda*tlr;
299 cout <<
"Thickness: " << lambda*tlr <<
" A" << endl;
300 cout <<
"Proportionality parameter: " << lambda <<
" A" << endl << endl;
308 for ( i=0, mg_ref=
project->
field->
mg; mg_ref && ( i<ref_img ); mg_ref=mg_ref->
next, i++ ) ;
314 if ( !mg_ref->
mark && !pickmarkers )
320 if ( !pickmarkers ) pickmarkers = 1;
324 cout <<
"Reference micrograph: " << mg_ref->
id <<
" (" << mg_ref->
img_num <<
")" << endl;
326 if ( pickmarkers == 1 )
328 else if ( pickmarkers == 2 )
336 sam[2] = sam[1] = sam[0];
369 if ( trackmarkers > 0 )
373 thickness, trackmarkers, target, cc_type, recenter, paramfile);
375 if ( ref_iter && refop[0] ==
'm' )
384 if ( checkmarkers || fixmarkers || ref_iter ) {
394 cout <<
"Writing " << psfile << endl;
395 ofstream* fps = NULL;
406 if ( paramfile.
length() ) {
408 cout <<
"Writing " << paramfile << endl;
414 cout <<
"Writing " << imgfile << endl;
A class for a command line input option.
int project_kill(Bproject *project)
Frees a whole project.
int project_mg_tilt_to_matrix(Bproject *project)
Sets the matrix from the tilt and axis angles for each micrograph.
Header file for postscript tools dealing with Bmarkers.
int project_mg_marker_select(Bproject *project, double fom)
Selects markers.
Bstring remove(const char c)
long mg_find_markers(Bmicrograph *mg, long edge, int add)
Finds markers in a micrograph.
Vector3< double > scale()
int project_check_markers(Bproject *project, int flags)
Checks if the markers in a project parameter structure fall within micrographs.
int string_kill(Bstring *list)
Kills a string linked list.
int project_calculate_model(Bproject *project)
Calculates the z-coordinates of the marker model.
Vector3< double > micrograph_get_nominal_origin(Bmicrograph *mg)
Gets the nominal origin for a micrograph.
int project_sort_markers_by_id(Bproject *project)
Sorts markers for each micrograph by ID number.
int project_set_nominal_mg_origins(Bproject *project)
Sets micrograph origins to the centers of the micrographs.
int bexit(int value)
Exit function for cleanup and debugging.
Functions to track fiducial markers in a tomographic series of images.
Boption * get_option_list(const char *use[], int argc, char *argv[], int &optind)
Parses command line arguments based on a template.
Header file for option handlers.
int ps_marker_plots(ofstream *fps, Bstring &title, Bproject *project)
Postscript plot of the errors associated with fiducial markers.
int project_set_micrograph_origins(Bproject *project, Vector3< double > origin)
Sets micrograph origins to the given origin.
Vector3< double > origin()
int project_set_marker_radius(Bproject *project, double mark_radius)
Sets the marker radius in a project parameter structure.
double angle_set_negPI_to_PI(double angle)
Returns an angle between -PI and PI.
int project_calculate_angles(Bproject *project)
Calculates tilt and tilt axis angles from matrices in a project parameter structure.
int project_set_rec_voxel_size(Bproject *project, Vector3< double > pixel_size)
Sets the pixel size for all the reconstructions.
long values(T1 &v1, T2 &v2)
Header file for reading and writing micrograph parameters.
int project_set_mg_pixel_size(Bproject *project, Vector3< double > pixel_size)
Sets the pixel size for all the micrographs.
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.
int ps_close(ofstream *fps)
Closes a postscript file.
ofstream * ps_open_and_init(Bstring filename, Bstring title, int npages, int width, int height)
Opens and initializes a postscript file.
double project_tomo_residuals(Bproject *project, int show)
Calculates the residuals for an alignment solution.
double project_fit_intensities(Bproject *project, Bplot *plot=NULL, int flag=0)
Determines the thickness to mean free path ratio from a tilt series.
Utilities for timing functions.
double project_write_aligned_images(Bproject *project, Bimage *pgr, Bstring &imgfile, DataType datatype)
Calculates aligned micrograph images and write them to a file.
Bplot * project_intensity_plot(Bproject *project)
Transfers the micrograph intensities for a field into a plot.
Header file for image processing from micrograph structures.
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.
int project_fix_markers(Bproject *project)
Checks if the markers in a project parameter structure fall within micrographs.
int ps_graph(ofstream *fps, Bplot *plot, int page_number)
Generates postscript graphs.
double timer_start()
Starts timer and prints the time.
Bproject * read_project(const char *filename, int flags=0)
Reading micrograph parameters from files.
Header file for general utilities.
Bstring substr(long start, long len)
int project_set_tilt_axis(Bproject *project, double tilt_axis)
Sets the tilt axis angle in a project parameter structure.
double timer_report(double lasttime)
Reports the time elapsed since a given time.
Bmicrograph * field_find_zero_tilt_mg(Bfield *field)
Finds the micrograph closest to a zero degree tilt in a series.
long project_show_markers(Bproject *project)
Shows the markers in a project hierarchy.
double project_refine(Bproject *project, int iter, double tol, Bstring refop)
Refines all the alignment parameters.
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.
Header file for 2D and 3D image I/O.
double project_tomo_errors(Bproject *project)
Analyzes marker errors.
int write_project(const char *filename, Bproject *project)
Writing micrograph parameters to a file.
Header file for micrograph processing.
long project_show_errors(Bproject *project, double error_cutoff)
Shows the errors in marker coordinates in a project hierarchy.
int project_refine_markers(Bproject *project, double hi_res, double lo_res)
Refines marker positions in a tomographic series.
int option_kill(Boption *option)
Deallocates a linked list of option structures.
int main(int argc, char **argv)
Vector3< double > pixel_size
long project_mg_exclude(Bproject *project, Bstring &mg_exclude)
Deselects micrographs in a project hierarchy.
int mg_reset_model(Bmicrograph *mg, Bmarker *model)
Resets the model x and y coordinates from the zero-tilt micrograph.
DataType
Base data type specifier.
Breconstruction * reconstruction_add(Breconstruction **rec, Bstring &rec_id)
Adds a reconstruction parameter structure to a linked list.
Header file for functions to align micrographs or coordinates from micrographs and apply the resultan...
long project_find_markers(Bproject *project, long edge, int add)
Finds all markers in a project.
int project_generate_markers(Bproject *project)
Generates missing micrograph and model markers.
Bstring * string_add(Bstring **list, const char *string)
Adds a string to a linked list.
Header file for single particle image processing in Bsoft.
long project_deselect_markers(Bproject *project, Bstring &deselect_list)
Deletes selected markers in a project hierarchy.