 |
Bsoft
2.1.0
Bernard's software package
|
Go to the documentation of this file.
24 "Usage: brefine [options] input.star [input.star]",
25 "------------------------------------------------",
26 "Refines the orientations of particle images with respect to a reference map.",
27 "Defocus refinement on non-CTF corrected images is turned on by the -defocus option.",
30 "-all Reset selection to all particles before other selections (default not).",
31 "-symmetry C5 Search for the best symmetry-related orientations.",
32 "-magnification 0.01 Turns on magnification refinement: Maximum adjustment (default 0).",
33 "-defocus 0.002 Turns on defocus refinement: Standard deviation for Monte Carlo,",
34 " Step size for grid search (default 0 um).",
36 "Actions for the type of refinement:",
37 "-monte 80 Monte Carlo with a maximum number of iterations.",
38 "-grid 2.5,0.3 Grid search with angular step size and accuracy (both in degrees).",
41 "-verbose 7 Verbosity of output.",
42 "-select 14 Selection number of particles to process (default all selected).",
43 "-fomtype dpr Resolution measurement type: frc (default), dpr.",
44 "-resolution 20,250 High and low resolution limits (angstrom).",
45 "-kernel 11,3 Interpolation kernel width and power (default 8,2)",
46 "-edge 125 Edge mask radius using previous particle origins (default not used).",
48 "-nothreads Do not use threads (default parallel processing).",
50 "Parameters only for Monte Carlo refinement:",
51 "-shift 0.4 Random origin shift standard deviation (default 0.1 pixels).",
52 "-view 0.02 Random view shift standard deviation (default 0.01).",
53 "-angle 0.7 Random rotation angle maximum adjustment (default 0.5 degrees).",
55 "Parameters only for grid search:",
56 "-step 1.5,0.3 Grid search shift step size and accuracy (default 0.4,0.1 pixels).",
59 "-reference file.ext Input 3D reference map file.",
60 "-mask mask.map Real space 2D mask to be applied to particles.",
61 "-FSC file.xml FSC curve used to weigh FOM contributions.",
64 "-output file.star Output parameter file.",
65 "-ppx Write temporary particle parameter files to directory \"ppx\".",
71 int main(
int argc,
char** argv)
79 double shift_step(0.4);
80 double shift_accuracy(0.1);
81 double edge_radius(0);
83 double shift_std(0.1);
84 double view_std(0.01);
85 double max_angle(
M_PI/360);
88 double hi_res(0), lo_res(0);
103 for ( curropt = option; curropt; curropt = curropt->
next ) {
104 if ( curropt->
tag ==
"all" ) reset = 1;
105 if ( curropt->
tag ==
"select" )
107 cerr <<
"-select: A selection number must be specified!" << endl;
108 if ( curropt->
tag ==
"symmetry" )
110 if ( curropt->
tag ==
"monte" )
112 cerr <<
"-monte: A number of iterations must be specified!" << endl;
113 if ( curropt->
tag ==
"grid" ) {
114 if ( curropt->
values(alpha_step, accuracy) < 1 )
115 cerr <<
"-grid: An angular step size must be specified!" << endl;
117 alpha_step *=
M_PI/180.0;
118 accuracy *=
M_PI/180.0;
121 if ( curropt->
tag ==
"fomtype" ) {
122 if ( curropt->
value[0] ==
'f' ) fom_type = 0;
123 if ( curropt->
value[0] ==
'd' ) fom_type = 1;
125 if ( curropt->
tag ==
"resolution" ) {
126 if ( curropt->
values(hi_res, lo_res) < 1 )
127 cerr <<
"-resolution: At least one resolution limit must be specified!" << endl;
129 if ( lo_res > 0 && lo_res < hi_res ) swap(hi_res, lo_res);
131 if ( curropt->
tag ==
"kernel" )
132 if ( curropt->
values(kernel_width, kernel_power) < 1 )
133 cerr <<
"-kernel: A kernel width must be specified!" << endl;
134 if ( curropt->
tag ==
"edge" )
135 if ( ( edge_radius = curropt->
value.
real() ) < 0 )
136 cerr <<
"-edge: An edge radius must be specified!" << endl;
137 if ( curropt->
tag ==
"defocus" ) {
138 if ( ( def_std = curropt->
value.
real() ) < 0.00001 )
139 cerr <<
"-defocus: An defocus standard deviation must be specified!" << endl;
141 if ( def_std < 10 ) def_std *= 1e4;
143 if ( curropt->
tag ==
"magnification" )
144 if ( ( max_mag = curropt->
value.
real() ) < 0 )
145 cerr <<
"-magnification: A maximum magnification adjustment must be specified!" << endl;
146 if ( curropt->
tag ==
"shift" )
147 if ( ( shift_std = curropt->
value.
real() ) < 0.001 )
148 cerr <<
"-shift: An origin shift standard deviation must be specified!" << endl;
149 if ( curropt->
tag ==
"view" )
150 if ( ( view_std = curropt->
value.
real() ) < 0.001 )
151 cerr <<
"-view: A view shift standard deviation must be specified!" << endl;
152 if ( curropt->
tag ==
"angle" ) {
153 if ( ( max_angle = curropt->
value.
real() ) < 0.1 )
154 cerr <<
"-angle: A maximum rotation angle adjustment must be specified!" << endl;
156 max_angle *=
M_PI/180.0;
158 if ( curropt->
tag ==
"step" )
159 if ( curropt->
values(shift_step, shift_accuracy) < 1 )
160 cerr <<
"-step: A shift step size must be specified!" << endl;
161 if ( curropt->
tag ==
"threads" ) {
162 if ( curropt->
value[0] ==
'm' ) nthreads = 1000;
164 cerr <<
"-threads: A number of threads must be specified!" << endl;
166 if ( curropt->
tag ==
"nothreads" ) nothreads = 1;
168 if ( curropt->
tag ==
"reference" )
170 if ( curropt->
tag ==
"mask" )
172 if ( curropt->
tag ==
"FSC" )
174 if ( curropt->
tag ==
"output" )
183 fftwf_init_threads();
192 while ( optind < argc )
string_add(&file_list, argv[optind++]);
194 cerr <<
"Error: No parameter files specified!" << endl;
202 cerr <<
"Error: No input file read!" << endl;
211 vector<double> weight;
217 cerr <<
"Error: The FSC file " << fscfile <<
" was not read!" << endl;
220 weight.resize(plot->
rows());
221 for ( i=0, j=plot->
rows(); i<plot->rows(); i++, j++ )
222 weight[i] = sqrt((*plot)[j]);
227 if ( reffile.
length() && ( max_iter || alpha_step > 0 ) ) {
231 alpha_step, accuracy, shift_step,
232 shift_accuracy, fom_type, weight,
233 hi_res, lo_res, kernel_width, kernel_power,
234 edge_radius, def_std, shift_std,
235 view_std, max_angle, max_mag, flags) < 0 )
240 alpha_step, accuracy, shift_step,
241 shift_accuracy, fom_type, weight,
242 hi_res, lo_res, kernel_width, kernel_power,
243 edge_radius, def_std, shift_std,
244 view_std, max_angle, max_mag, flags) < 0 )
255 if ( !nothreads ) fftwf_cleanup_threads();
A class for a command line input option.
int project_kill(Bproject *project)
Frees a whole project.
int string_kill(Bstring *list)
Kills a string linked list.
int main(int argc, char **argv)
size_t system_processors()
Returns the number of processors.
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 option handlers.
long values(T1 &v1, T2 &v2)
Header file for reading and writing micrograph parameters.
long part_reset_selection(Bproject *project, int flag=0)
Resets selection to all particles.
Bplot * xml_read_fsc(Bstring &filename, Bstring &xsdfile)
Function prototypes.
Utilities for timing functions.
long mg_refine_orientations(Bproject *project, Bstring &reffile, Bstring &maskfile, Bstring &sym_string, int part_select, int max_iter, double alpha_step, double accuracy, double shift_step, double shift_accuracy, int fom_type, vector< double > weight, double hi_res, double lo_res, int kernel_width, int kernel_power, double edge_radius, double def_std, double shift_std, double view_std, double max_angle, double max_mag, int flags)
Refine the orientation and origin with respect to a reference map.
Tcl_Obj * part_select(Bparticle *part, int objc, Tcl_Obj *CONST objv[])
Bstring symmetry_string()
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.
double timer_report(double lasttime)
Reports the time elapsed since a given time.
int write_project(const char *filename, Bproject *project)
Writing micrograph parameters to a file.
Header file for micrograph processing.
Reciprocal space refinement of orientation parameters of particle images.
int option_kill(Boption *option)
Deallocates a linked list of option structures.
long project_refine_orientations(Bproject *project, Bstring &reffile, Bstring &maskfile, Bstring &sym_string, int part_select, int max_iter, double alpha_step, double accuracy, double shift_step, double shift_accuracy, int fom_type, vector< double > weight, double hi_res, double lo_res, int kernel_width, int kernel_power, double edge_radius, double def_std, double shift_std, double view_std, double max_angle, double max_mag, int flags)
Library routines to read and write FSC curves.
Bstring * string_add(Bstring **list, const char *string)
Adds a string to a linked list.