 |
Bsoft
2.1.0
Bernard's software package
|
Go to the documentation of this file.
24 "Usage: bmultifit [options] input.img view.grd",
25 "---------------------------------------------",
26 "Searches orientation space for a set of solutions for the fit of a template within a 3D map.",
27 "Modes: Global: Search an asymmetric unit with a fixed angular step size.",
28 " Symmetry: Search all symmetry-related views using the view from the -View option.",
29 "The output image contains 4-valued views, only supported by the GRD format.",
30 "Only one image in a multi-image file will be used (see -image option).",
33 "-mode sym Mode: global (default) or symmetric.",
34 "-subset 25,5 View subset selection from a start offset and with a given size.",
35 "-fom 0.35 FOM cutoff to use (default set to FOMmax/2).",
38 "-verbose 7 Verbosity of output.",
39 "-sampling 1.5,1.5,1.5 Sampling (A/pixel; default from input file; a single value can be given).",
40 "-origin 110,50,44 Origin for rotations of the template (default taken from template image).",
41 "-angles 8.8,2.5,5.2 Step size for alpha, theta and phi, one value sets all (default 45 degrees).",
42 "-resolution 15.6,200 Resolution limits for cross-correlation (default 0).",
43 "-View 0.3,-0.5,0.8,33 View to initiate search: vector {xyz} and angle (use with -symmetry option).",
44 "-symmetry D6 Symmetry: Point group identifier (use with -View option).",
45 "-image 2 Image number in a multi-image file (default 0=first image).",
46 "-bin 3 Binning of input, template and mask by given kernel size,",
47 " output image remains same size as input.",
50 "-Template image.map Template to search for.",
51 "-Mask mask.tif Mask in reciprocal space to apply during cross-correlation.",
54 "-output file.star Model output file with best orientations.",
55 "-Postscript plot.ps Output postscript file with a plot of projection vectors.",
56 "-FOM cc.map Output correlation coefficient map.",
61 int main(
int argc,
char **argv)
73 double alpha_step =
M_PI_4;
74 double theta_step =
M_PI_4;
77 double hires(0), lores(0);
78 View currview(0,0,-10,0);
90 for ( curropt = option; curropt; curropt = curropt->
next ) {
91 if ( curropt->
tag ==
"mode" ) {
94 cerr <<
"-mode: A mode must be specified" << endl;
96 if ( curropt->
tag ==
"subset" )
97 if ( curropt->
values(view_start, view_subset) < 2 )
98 cerr <<
"-subset: A view subset start and size must be specified" << endl;
99 if ( curropt->
tag ==
"fom" )
100 if ( ( cutoff = curropt->
value.
real() ) < 0.0001 )
101 cerr <<
"-fom: A cutoff value must be specified!" << endl;
102 if ( curropt->
tag ==
"image" )
104 cerr <<
"-image: An image number must be specified" << endl;
105 if ( curropt->
tag ==
"sampling" )
106 sam = curropt->
scale();
107 if ( curropt->
tag ==
"origin" ) {
108 if ( curropt->
value[0] ==
'c' ) {
111 origin = curropt->
origin();
115 if ( curropt->
tag ==
"angles" ) {
116 if ( ( i = curropt->
values(alpha_step, theta_step, phi_step) ) < 1 )
117 cerr <<
"-angles: An angle step size must be specified" << endl;
119 if ( i < 2 ) phi_step = theta_step = alpha_step;
120 else if ( i < 3 ) phi_step = theta_step;
121 alpha_step *=
M_PI/180.0;
122 theta_step *=
M_PI/180.0;
123 phi_step *=
M_PI/180.0;
126 if ( curropt->
tag ==
"resolution" )
127 if ( curropt->
values(hires, lores) < 1 )
128 cerr <<
"-resolution: A resolution must be specified!" << endl;
129 if ( curropt->
tag ==
"View" )
130 currview = curropt->
view();
131 if ( curropt->
tag ==
"symmetry" )
133 if ( curropt->
tag ==
"bin" ) {
135 cerr <<
"-bin: A bin size must be specified!" << endl;
137 bin[2] = bin[1] = bin[0];
139 if ( curropt->
tag ==
"Template" )
140 template_file = curropt->
filename();
141 if ( curropt->
tag ==
"Mask" )
143 if ( curropt->
tag ==
"output" )
145 if ( curropt->
tag ==
"Postscript" )
147 if ( curropt->
tag ==
"FOM" )
159 for ( i=0; i<sym->
n; i++ )
164 }
else if ( mode.
contains(
"sym") ) {
165 if ( currview[2] < -1 ) currview[2] = 1;
170 if ( view_subset > 0 )
if (
view_list_subset(&view, view_start, view_subset) < 1 ) {
171 cerr <<
"Error: At least one view must be selected!" << endl;
179 cout <<
"Number of views: " <<
count_list((
char *) view) << endl;
188 if ( optind < argc ) {
189 p =
read_img(argv[optind++], 1, img_num);
191 if ( bin[0]*bin[1]*bin[2] > 1 ) p->bin(bin);
195 cerr <<
"Error: No input file given!" << endl;
199 if ( template_file.
length() ) {
200 ptemp =
read_img(template_file, 1, 0);
203 if ( set_origin == 2 ) ptemp->
origin(ptemp->
size()/2);
204 else ptemp->
origin(origin);
206 if ( bin[0]*bin[1]*bin[2] > 1 ) ptemp->bin(bin);
209 if ( mask_file.
length() ) {
211 if ( bin[0]*bin[1]*bin[2] > 1 ) pmask->bin(bin);
218 if ( model_file.
length() ) {
224 pfit = p->
search_volume(ptemp, view, alpha, alpha_step, hires, lores, pmask, cutoff);
240 cerr <<
"Error: No output file generated!" << endl;
A class for a command line input option.
int view_list_subset(View **view_list, int start, int size)
Replaces a view list with a subset of it.
Vector3< double > scale()
View * symmetry_get_all_views(Bsymmetry *sym, View asu_view)
Get all symmetry-related views of one given view.
long kill_list(char *list, unsigned long size)
Frees all the items in a linked list.
int bexit(int value)
Exit function for cleanup and debugging.
Bmodel * model_from_densities(Bimage *p, Bimage *ptemp, View *view, double alpha, double alpha_step, double hires, double lores, Bimage *pmask, double threshold)
Searches a 2D/3D density map for a template.
Boption * get_option_list(const char *use[], int argc, char *argv[], int &optind)
Parses command line arguments based on a template.
Vector3< long > size() const
int main(int argc, char **argv)
Header file for option handlers.
View * asymmetric_unit_views(Bsymmetry *sym, double theta_step, double phi_step, int flag)
Initializes a well-distributed set of views in an asymmetric unit.
Vector3< double > origin()
long count_list(char *list)
Counts the number of items in a linked list.
long values(T1 &v1, T2 &v2)
Bimage * read_img(char *filename, int readdata, int img_select)
General driver function to read multiple image formats.
void origin(double x, double y, double z)
int write_img(const char *filename, Bimage *p, int compression)
General driver function to write multiple image formats.
int model_kill(Bmodel *model)
Deallocates all memory in the list.
General image parameter class.
Utilities for timing functions.
Bstring symmetry_string()
Header file for searching for a template in a map and returning multiple hits in a model.
int ps_views(Bstring &filename, Bstring &symmetry_string, View *view, int flags)
Generates postscript plot of views on the unit sphere.
double timer_start()
Starts timer and prints the time.
Header file for general utilities.
int write_model(Bstring &filename, Bmodel *model)
Writes model parameters.
Bsymmetry * init_point_group_symmetry(Bstring symmetry_string)
Sets up a symmetry structure from a string identifier.
double timer_report(double lasttime)
Reports the time elapsed since a given time.
void origin(double ox, double oy, double oz)
int kill_symmetry(Bsymmetry *sym)
Deallocates a symmetry structure.
Header file for generalized linked list functions.
int option_kill(Boption *option)
Deallocates a linked list of option structures.
void sampling(long nn, Vector3< double > u)
Bimage * search_volume(Bimage *ptemp, View *view, double alpha, double alpha_step, double hires, double lores, Bimage *pmask, double threshold)
Searches a 2D/3D density map for a template.
bool contains(const Bstring &s)
Header file for postscript tools dealing with views.