 |
Bsoft
2.1.0
Bernard's software package
|
Go to the documentation of this file.
27 "Usage: dhand [options] input1.star [input2.star...]",
28 "----------------------------------------------------------------------------",
29 "Compares projections of two oppositely handed reconstructions to images",
30 "of tilted specimens. The orientation of the second view is predicted",
31 "from the first view's orientation and from the tilt-axis direction and the",
32 "rotation angle. For particles from the two views, output selection values",
33 "are set to 1 (hand A), 2 (hand B), or 0 (unassigned, FOM < min. value or ",
34 "|FOMA-FOMB| < min. acceptable difference). Particles with input selection",
35 "values of zero are ignored unless option '-all' is used.",
38 "-difference 1 Compute |difference| between measured (input) and predicted",
39 " orientations, 0=do not (default), 1=pred. orient. and avg",
40 " |difference|, 2=#1 + individual values.",
41 "-org2 cross Get particle origins of second view by cross-correlation",
42 " with projections of predicted view (cross), from image",
43 " files (image), or from parameter files (param, default).",
44 "-selconsist Sets selection values in unused micrographs to be consistent",
45 " with those in views 1 and 2.",
48 "-verbose 1 Verbosity of output.",
49 "-all Include all particles (default sel>0).",
50 "-numberperfield 3 Number of micrographs per field-of-view (default 1).",
51 "-fieldID dbgd Set the field ID (multiple micrographs will get numbered ID's).",
52 "-axis 74.7 Tilt axis angle relative to x-axis (default from parameter file).",
54 "-origin 50,5.3,50.4 Set the x,y,z origin of 3D map, in pixel units.",
55 "-mindiff 0.05 minimum acceptable |difference| between hand A & B ",
56 " correlation coefficients, default = 0.050.",
57 "-minfom 0.1 min. acceptable value for FOM of correct hand, default=0.",
58 "-radii 5,65 Radial limits (in pixels), default = all radii.",
59 "-resolution 100,17 Resolution limits in angs. (low,high), default = 400,20.",
60 "-sampling 2.54 x,y,z pixel sampling (input map and all micrographs).",
62 "Parameters for selecting first and second views (use mgsel or both mg1 & mg2):",
63 "-mgsel angle,0,-5.0 Criterion, value for first view, value for second view",
64 "-mg1 index,1 Micrograph in each set that is the first view",
65 "-mg2 angle,-5.0 Micrograph in each set that is the second view",
67 " angle,a (tilt angle)",
68 " index,n (index within a series, beginning with 1)",
69 " near,n (nth nearest-to-focus, beginning with 1)",
70 " far,n (nth farthest-from-focus, beginning with 1)",
73 "-map input.img Reference map.",
76 "-output output.star Outputs data in STAR format to output.star",
77 "-outprj output.img Outputs projections to output_field#_img#_imgID.img",
84 int main(
int argc,
char* argv[])
90 double tilt_axis(-1000);
94 long count,mcount,fcount;
111 double rad_max(-1.0);
121 for ( curropt = option; curropt; curropt = curropt->
next ) {
122 if ( curropt->
tag ==
"all" )
124 if ( curropt->
tag ==
"numberperfield" )
126 cerr <<
"-numberperfield: The number of micrographs in a field-of-view must be specified!" << endl;
129 if ( curropt->
tag ==
"fieldID" ) {
130 field_id = curropt->
value;
131 if ( field_id.
length() < 1 )
132 cerr <<
"-fieldID: A field ID must be specified!" << endl;
134 if ( curropt->
tag ==
"axis" ) {
135 if ( ( tilt_axis = curropt->
value.
real() ) < 0.00001 )
136 cerr <<
"-axis: The tilt axis angle must be specified." << endl;
140 if ( curropt->
tag ==
"angle" ) {
141 if ( ( tilt_angle = curropt->
value.
real() ) < 0.00001 )
142 cerr <<
"-angle: The tilt angle must be specified." << endl;
146 if ( curropt->
tag ==
"difference" ) {
148 if ( (diff_out < 0) || (diff_out > 2) ) {
149 cerr <<
"Error: -difference, a difference output option (0-2) must be specified!" << endl;
153 if ( curropt->
tag ==
"map" )
155 if ( curropt->
tag ==
"origin" ) {
156 origind = curropt->
origin();
159 if ( curropt->
tag ==
"mgsel" ||
160 curropt->
tag ==
"mg1" ||
161 curropt->
tag ==
"mg2" ) {
162 if ( curropt->
tag ==
"mgsel" ) mgsel += 2;
165 cerr <<
"Error: too many micrograph selection choices were entered!" << endl;
170 if ( curropt->
tag ==
"minfom" ) {
171 if ( ( AB_min = curropt->
value.
real() ) < 0.0001 ) {
172 cerr <<
"Error: -minfom, threshold value must be specified!" << endl;
176 if ( curropt->
tag ==
"mindiff" ) {
177 if ( ( AmB_min = curropt->
value.
real() ) < 0.0001 ) {
178 cerr <<
"Error: -mindiff, threshold value must be specified!" << endl;
182 if ( curropt->
tag ==
"org2" ) {
187 cerr <<
"Error: -org2, " << curropt->
value <<
" is an improper value for this option" << endl;
191 if ( curropt->
tag ==
"outprj" ) {
194 if ( curropt->
tag ==
"output" )
196 if ( curropt->
tag ==
"radii" ) {
197 if ( curropt->
values(rad_min, rad_max) < 2 ) {
198 cerr <<
"Error: -radii, radial limits (min,max) in pixels must be specified!" << endl;
202 if ( curropt->
tag ==
"resolution" ) {
203 if ( curropt->
values(res_min, res_max) < 2 ) {
204 cerr <<
"Error: -resolution, two resolution parameters must be specified!" << endl;
208 if ( res_max > res_min) {
209 swap(res_min, res_max);
210 if (
verbose) cout <<
"Resolution max > resolution min, so the two were swapped" << endl;
214 if ( curropt->
tag ==
"sampling" )
215 sam = curropt->
scale();
216 if ( curropt->
tag ==
"selconsist" )
224 cerr <<
"Error: no or not enough micrograph selection input was entered." << endl;
230 while ( optind < argc )
string_add(&file_list, argv[optind++]);
232 cerr <<
"Error: No parameter files specified!" << endl;
238 cerr <<
"Error: No input file read!" << endl;
254 if ( mcount < 2*fcount ) {
255 cerr <<
"Error: there must be at least two micrographs in each field-of-view:" << endl;
256 cerr <<
"Number of micrographs = " << mcount <<
" Number of fields-of-view = " << fcount << endl;
260 cout <<
"Fields-of-view: " << fcount << endl;
261 cout <<
"Micrographs: " << mcount << endl;
263 cout <<
"Particles in all micrographs: " << count << endl;
265 cout <<
"Selected particles: " << count << endl << endl;
270 if (
verbose) cout <<
"Map file name (hand A): \"" << inmap <<
"\"" << endl;
271 penantiomer =
read_img(inmap, 1, -1);
276 penantiomer->
origin(origind);
280 if ( sam.
volume() > 0.0 ) {
293 res_min, res_max, AmB_min, AB_min, diff_out, origins2, outimg);
340 if ( tag ==
"mgsel" ) {
342 mg_select[0] = mg_select[1] = 4;
348 if ( tagvalue.
contains(
"near") ) mg_select[0] = mg_select[1] = 0;
349 else if ( tagvalue.
contains(
"far") ) mg_select[0] = mg_select[1] = 1;
350 else if ( tagvalue.
contains(
"ind") ) mg_select[0] = mg_select[1] = 2;
352 }
else if ( tag ==
"mg1" ) {
358 if ( tagvalue.
contains(
"near") ) mg_select[0] = 0;
359 else if ( tagvalue.
contains(
"far") ) mg_select[0] = 1;
360 else if ( tagvalue.
contains(
"ind") ) mg_select[0] = 2;
362 }
else if ( tag ==
"mg2" ) {
368 if ( tagvalue.
contains(
"near") ) mg_select[1] = 0;
369 else if ( tagvalue.
contains(
"far") ) mg_select[1] = 1;
370 else if ( tagvalue.
contains(
"ind") ) mg_select[1] = 2;
A class for a command line input option.
int project_kill(Bproject *project)
Frees a whole project.
long project_count_mg_particles(Bproject *project)
Counts all the particles in the project structure.
Vector3< double > scale()
int string_kill(Bstring *list)
Kills a string linked list.
long project_count_fields(Bproject *project)
Counts all the fields in the project structure.
int bexit(int value)
Exit function for cleanup and debugging.
int main(int argc, char *argv[])
Boption * get_option_list(const char *use[], int argc, char *argv[], int &optind)
Parses command line arguments based on a template.
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.
Vector3< double > origin()
double angle_set_negPI_to_PI(double angle)
Returns an angle between -PI and PI.
long values(T1 &v1, T2 &v2)
Bimage * read_img(char *filename, int readdata, int img_select)
General driver function to read multiple image formats.
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.
long part_reset_selection(Bproject *project, int flag=0)
Resets selection to all particles.
long project_count_mg_part_selected(Bproject *project)
Counts the number of particles in a project.
General image parameter class.
Utilities for timing functions.
int hand_select_consist(Bproject *project, double *mg_ang, int *mg_index, int *mg_select, int sel_consist)
Sets consistent selection values in all (including unused) micrographs.
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.
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.
void origin(double ox, double oy, double oz)
int project_get_handedness(Bimage *penantiomer, Bproject *project, double *mg_ang, int *mg_index, int *mg_select, double rad_min, double rad_max, double res_min, double res_max, double AmB_min, double AB_min, int diff_out, int origins2, Bstring outimg)
Determines handedness for all selected particles (sel > 0) in a project.
int write_project(const char *filename, Bproject *project)
Writing micrograph parameters to a file.
int option_kill(Boption *option)
Deallocates a linked list of option structures.
void sampling(long nn, Vector3< double > u)
int hand_get_options_mgselect(Bstring &tag, Bstring &tagvalue, int *mg_select, int *mg_index, double *mg_ang)
bool contains(const Bstring &s)
double maximum_included_radius()
Returns the radius of the enclosed sphere or circle.
Bstring * string_add(Bstring **list, const char *string)
Adds a string to a linked list.
long project_count_micrographs(Bproject *project)
Counts all the micrographs in the project structure.
Header file for single particle image processing in Bsoft.