 |
Bsoft
2.1.0
Bernard's software package
|
Go to the documentation of this file.
25 "Usage: bmgalign [options] input.star [input2.star...]",
26 "-----------------------------------------------------",
27 "Aligns micrographs within sets such as focal series specified in parameter files.",
30 "-align mic Alignment type: par = particle coordinates, mic = micrograph images, fea = micrograph features.",
31 "-add Add micrograph coordinates and particle origins (default not).",
32 "-filterextremes Filter micrograph extremes before aligning.",
35 "-verbose 7 Verbosity of output.",
36 "-number 3 Number of micrographs per field-of-view (default 1).",
37 "-fieldID dbgd Set the field ID (multiple micrographs will get numbered ID's).",
38 "-reference 2 Reference micrograph in a series (default 1=first micrograph).",
39 "-datatype u Force writing of a new data type.",
40 "-sampling 1.5,1.5,1.5 Sampling (A/pixel; a single value can be given).",
41 "-correlate 1024,1024,5 Size of subimages for correlation (default 512,512,1, use with -align mic).",
42 "-resolution 900,300 High and low resolution limits for bandpass (default 0.1,1000 angstrom).",
43 "-maxshift 55 Maximum allowed shift (default 1/4 of tile).",
44 "-threshold -3.0 Threshold used to pick features (in std dev units; default -3, use with -align fea).",
45 "-features 1,55 Features type (1=mass, 2=area, 3=darkest pixel) and maximum number (default 1,unlimited).",
48 "-output file.star Output parameter file.",
49 "-image file.pif Output multi-image file with aligned images.",
52 "The set of input files reference a series of micrographs arranged in ",
53 "fields-of-view where each field contains a focal pair or set. The program then",
54 "calculates for each set the alignment of all other micrographs with respect",
55 "to the reference micrograph (typically the further-from-focus micrograph),",
56 "and outputs a new STAR format file with the alignment parameters and particle",
57 "coordinates corresponding to the alignment. The alignment can be done in",
58 "three different ways:",
59 "1. Alignment by cross-correlation (recommended):",
60 " bmgalign -v 7 -reference 2 -align mic -correlate 300,300,1 -out out.star input.star",
61 "2. Alignment by feature extraction:",
62 " bmgalign -v 7 -ref 2 -resol 300,1000 -align fea -thresh -2.8 -out out.star input.star",
63 "3. Alignment using picked particle coordinates:",
64 " bmgalign -v 7 -ref 2 -align part -output out.star input.star",
66 "All input is derived from a STAR format parameter file.",
67 "A series (such as a focal pair) is assumed to be consecutive data blocks in the STAR file.",
68 "Orientational parameters are calculated so that applying them to the first",
69 "data set or image produces the others in the focal series.",
70 "Angles are given with positive counter-clockwise.",
75 int main(
int argc,
char* argv[])
83 int add_coordinates(0);
88 int max_features(1000000000);
89 double resolution_low(1000);
90 double resolution_high(0.1);
93 int extract_method(0);
100 for ( curropt = option; curropt; curropt = curropt->
next ) {
101 if ( curropt->
tag ==
"align" ) {
106 cerr <<
"-align: An alignment method must be specified." << endl;
108 if ( curropt->
tag ==
"filterextremes" )
110 if ( curropt->
tag ==
"number" )
112 cerr <<
"-number: The number of micrographs in a field-of-view must be specified!" << endl;
115 if ( curropt->
tag ==
"datatype" )
117 if ( curropt->
tag ==
"sampling" )
118 sam = curropt->
scale();
119 if ( curropt->
tag ==
"fieldID" ) {
120 field_id = curropt->
value;
121 if ( field_id.
length() < 1 )
122 cerr <<
"-fieldID: A field ID must be specified!" << endl;
124 if ( curropt->
tag ==
"reference" )
126 cerr <<
"-reference: The reference micrograph number in a series must be specified." << endl;
127 if ( curropt->
tag ==
"add" )
129 if ( curropt->
tag ==
"correlate" ) {
130 tile_size = curropt->
size();
131 if ( tile_size.
volume() < 1 )
132 cerr <<
"-correlate: All three dimensions must be specified." << endl;
134 if ( curropt->
tag ==
"features" )
135 if ( curropt->
values(extract_method, max_features) < 1 )
136 cerr <<
"-features: A method for extraction must be specified." << endl;
137 if ( curropt->
tag ==
"threshold" )
138 if ( ( thresh = curropt->
value.
real() ) < -3 )
139 cerr <<
"-threshold: A threshold must be specified." << endl;
140 if ( curropt->
tag ==
"resolution" ) {
141 if ( curropt->
values(resolution_high, resolution_low) < 1 )
142 cerr <<
"-resolution: Resolution limits must be specified." << endl;
143 else if ( resolution_high > resolution_low )
144 swap(resolution_high, resolution_low);
146 if ( curropt->
tag ==
"maxshift" )
147 if ( ( max_shift = curropt->
value.
real() ) < 0.1 )
148 cerr <<
"-maxshift: A maximum shift in pixels must be specified." << endl;
149 if ( curropt->
tag ==
"output" )
151 if ( curropt->
tag ==
"image" )
160 while ( optind < argc )
string_add(&file_list, argv[optind++]);
162 cerr <<
"Error: No parameter files specified!" << endl;
170 cerr <<
"Error: No input file read!" << endl;
180 if ( add_coordinates )
183 switch ( set_align ) {
190 resolution_low, resolution_high, max_shift, filter_flag, set_align - 2);
194 resolution_low, resolution_high, thresh, extract_method);
A class for a command line input option.
int project_kill(Bproject *project)
Frees a whole project.
int main(int argc, char *argv[])
Vector3< double > scale()
int string_kill(Bstring *list)
Kills a string linked list.
int mg_align_micrographs(Bproject *project, int refset, Vector3< long > tile_size, double res_lo, double res_hi, double max_shift, int filter_flag, int refine_flag)
Aligns a focal series of micrographs.
int mg_align_feature_extraction(Bproject *project, int max_features, double res_low, double res_high, double thresh, int extract_method)
Aligns images by feature extraction.
int bexit(int value)
Exit function for cleanup and debugging.
Boption * get_option_list(const char *use[], int argc, char *argv[], int &optind)
Parses command line arguments based on a template.
Header file for single particle picking functions.
int project_set_field_id(Bproject *project, int nseries, Bstring &field_id)
Sets the field id's according to a regular series.
Header file for option handlers.
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.
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.
double timer_start()
Starts timer and prints the time.
Bproject * read_project(const char *filename, int flags=0)
Reading micrograph parameters from files.
int mg_align_coordinates(Bproject *project, int refset)
Aligns the particle coordinates of a series of micrographs.
Header file for general utilities.
double timer_report(double lasttime)
Reports the time elapsed since a given time.
Header file for 2D and 3D image I/O.
int write_project(const char *filename, Bproject *project)
Writing micrograph parameters to a file.
Generalized matrix class.
Header file for micrograph processing.
int option_kill(Boption *option)
Deallocates a linked list of option structures.
DataType
Base data type specifier.
bool contains(const Bstring &s)
Header file for functions to align micrographs or coordinates from micrographs and apply the resultan...
int project_add_origins_to_coords(Bproject *project)
Adds the particle origins to the micrograph coordinates.
Bstring * string_add(Bstring **list, const char *string)
Adds a string to a linked list.