 |
Bsoft
2.1.0
Bernard's software package
|
Go to the documentation of this file.
26 "Usage: bpick [options] input.star [input2.star ...]",
27 "---------------------------------------------------",
28 "Picks and extracts single particles from 2D (micrograph) or 3D (tomogram) images.",
31 "-pick cc Picking type: cc, var, ring, background (default none).",
32 "-orient ref.pif Orient using a reference map.",
33 " High resolution and symmetry determine number of projections.",
34 "-center Center each particle image (specify resolution limits).",
35 "-axis 5,13.6 Pick on a symmetry axis and distance along the axis (voxels, specify -symmetry).",
36 "-extract 0.5 Extract particles into new images at the given scale.",
37 "-split Split particles into individual files on extraction.",
38 "-reconstructions Operate on reconstruction parameters rather than micrographs.",
39 "-project Project 3D particles to 2D and assign to zero-tilt micrograph.",
40 "-add Adjust micrograph coordinates to particle origins.",
41 "-filterextremes Filter extremes before picking or centering.",
42 "-background Correct background of extracted particles.",
43 "-normalize Normalize extracted particles.",
44 "-delete Delete all non-selected particles.",
47 "-verbose 7 Verbosity of output.",
48 "-sampling 1.5,1.5,1.5 Sampling (A/pixel; a single value can be given).",
49 "-origin 0.8,-10,15.7 Set the origin (default from input image).",
50 "-box 123,145,130 Particle box size (voxels, one sets all).",
51 "-resolution 23.5,200 Resolution limits for picking and centering (default 0 - 1e6 angstrom).",
52 "-fill 127 Fill value for particles extending beyond image (default background).",
53 "-mgpath dir/subdir Set the micrograph file paths.",
54 "-pspath dir/subdir Set the power spectrum file paths.",
55 "-partpath dir/subdir Set the particle file paths.",
56 "-base subvol Set the particle base file name (no extension).",
57 "-extension pif Set the particle image file format.",
59 "Parameters for picking particles:",
60 "-average 11 Averaging/smoothing kernel size.",
61 "-exclusion 210 Minimum distance between particles (default 0.8*x-size).",
62 "-bin 2 Binning to apply (default 1).",
63 "-fom 0.1,0.8 Selecting picked particles based on an FOM range (default 0,1e30).",
65 "Parameters for picking particles in variance map:",
66 "-variance 51 Calculate a local variance image using the given size kernel.",
67 "-sigma 2.5 Sigma units above average to select particles (default 5).",
68 "-maximum 241 Maximum number of background areas to pick (default 1000000).",
70 "Parameters for picking particles by ring pattern:",
71 "-diameters 115,130 Particle and background ring diameters.",
72 "-contrast black Foreground (particles) are white or black (default).",
73 "-angle 2.5 Angular increment (default 1 degree).",
75 "Parameter for orienting and selecting a symmetry axis:",
76 "-symmetry C5 Point group symmetry (used with -orient and -axis).",
79 "-Template file.map Input template file for picking by cross-correlation.",
80 "-Mask file.map Input frequency space mask file.",
81 "-compare file.star Input parameter file for comparison.",
84 "-output file.star Output parameter file.",
89 int main(
int argc,
char* argv[])
96 int delete_deselected(0);
102 int add_coordinates(0);
105 double hires(0), lores(0);
108 double fommin(0), fommax(1e30);
109 long average_kernel(0);
112 long maxnum(1000000);
113 double rp_din(0), rp_dout(0);
114 double rp_anginc(
M_PI/180);
136 for ( curropt = option; curropt; curropt = curropt->
next ) {
137 if ( curropt->
tag ==
"pick" ) {
138 if ( curropt->
value[0] ==
'c' ) pick_type = 1;
139 if ( curropt->
value[0] ==
'v' ) pick_type = 2;
140 if ( curropt->
value[0] ==
'r' ) pick_type = 3;
141 if ( curropt->
value[0] ==
'b' ) pick_type = 4;
143 if ( curropt->
tag ==
"axis" )
144 if ( curropt->
values(sym_axis, axis_dist) < 2 )
145 cerr <<
"-axis: Both an axis and distance must be specified!" << endl;
146 if ( curropt->
tag ==
"orient" )
148 if ( curropt->
tag ==
"delete" )
149 delete_deselected = 1;
150 if ( curropt->
tag ==
"extract" )
151 if ( ( ext_scale = curropt->
value.
real() ) < 0.01 )
152 cerr <<
"-extract: An extraction scale must be specified! (usually 1)" << endl;
153 if ( curropt->
tag ==
"reconstructions" ) use_rec = 1;
154 if ( curropt->
tag ==
"project" ) use_rec = 2;
155 if ( curropt->
tag ==
"add" ) add_coordinates = 1;
156 if ( curropt->
tag ==
"diameters" )
157 if ( curropt->
values(rp_din, rp_dout) < 2 )
158 cerr <<
"-diameters: Two diameters must be specified!" << endl;
159 if ( curropt->
tag ==
"contrast" )
if ( curropt->
value[0] ==
'w' ) contrast = 1;
160 if ( curropt->
tag ==
"filterextremes" ) flags |= 1;
161 if ( curropt->
tag ==
"center" ) center = 1;
162 if ( curropt->
tag ==
"background" ) back_flag = 1;
163 if ( curropt->
tag ==
"normalize" ) norm_flag = 1;
164 if ( curropt->
tag ==
"split" )
split = 1;
165 if ( curropt->
tag ==
"sampling" )
166 sampling = curropt->
scale();
167 if ( curropt->
tag ==
"origin" ) {
168 if ( curropt->
value[0] ==
'c' ) {
171 origin = curropt->
origin();
175 if ( curropt->
tag ==
"box" ) box_size = curropt->
size();
176 if ( curropt->
tag ==
"symmetry" )
178 if ( curropt->
tag ==
"resolution" )
179 if ( curropt->
values(hires, lores) < 1 )
180 cerr <<
"-resolution: A resolution limit must be specified!" << endl;
181 if ( curropt->
tag ==
"exclusion" )
182 if ( ( excl_dist = curropt->
value.
real() ) <= 0 )
183 cerr <<
"-exclusion: An separation distance must be specified!" << endl;
184 if ( curropt->
tag ==
"bin" )
186 cerr <<
"-bin: An integer must be specified!" << endl;
187 if ( curropt->
tag ==
"fom" )
188 if ( curropt->
values(fommin, fommax) < 1 )
189 cerr <<
"-fom: A FOM cutoff must be specified!" << endl;
190 if ( curropt->
tag ==
"average" )
191 if ( ( average_kernel = curropt->
integer() ) < 1 )
192 cerr <<
"-average: The kernel edge size must be specified!" << endl;
193 if ( curropt->
tag ==
"variance" )
194 if ( ( var_kernel = curropt->
integer() ) < 1 )
195 cerr <<
"-variance: The kernel edge size must be specified!" << endl;
196 if ( curropt->
tag ==
"sigma" )
197 if ( ( sigma = curropt->
value.
real() ) <= 0 )
198 cerr <<
"-sigma: A value must be specified!" << endl;
199 if ( curropt->
tag ==
"maximum" )
200 if ( ( maxnum = curropt->
integer() ) < 1 )
201 cerr <<
"-maximum: The maximum number of background areas must be specified!" << endl;
202 if ( curropt->
tag ==
"angle" ) {
203 if ( ( rp_anginc = curropt->
value.
real() ) < 0.01 )
204 cerr <<
"-angle: An angular increment must be specified!" << endl;
206 rp_anginc *=
M_PI/180.0;
208 if ( curropt->
tag ==
"fill" )
209 fill = curropt->
fill(fill_type);
210 if ( curropt->
tag ==
"mgpath" ) {
211 mgpath = curropt->
value;
212 if ( mgpath.
length() < 1 )
213 cerr <<
"-mgpath: The micrograph file path must be specified!" << endl;
215 if ( mgpath[-1] !=
'/' ) mgpath +=
"/";
217 if ( curropt->
tag ==
"pspath" ) {
218 pspath = curropt->
value;
219 if ( pspath.
length() < 1 )
220 cerr <<
"-pspath: The power spectrum file path must be specified!" << endl;
222 if ( pspath[-1] !=
'/' ) pspath +=
"/";
224 if ( curropt->
tag ==
"partpath" ) {
225 partpath = curropt->
value;
226 if ( partpath.
length() < 1 )
227 cerr <<
"-partpath: The particle file path must be specified!" << endl;
229 if ( partpath[-1] !=
'/' ) partpath +=
"/";
231 if ( curropt->
tag ==
"base" ) {
232 partbase = curropt->
value;
233 if ( partbase.
length() < 1 )
234 cerr <<
"-base: The particle base file name must be specified!" << endl;
236 if ( curropt->
tag ==
"extension" ) {
237 partext = curropt->
value;
238 if ( partext.
length() < 1 )
239 cerr <<
"-extension: The particle file extension must be specified!" << endl;
241 if ( curropt->
tag ==
"Template" )
243 if ( curropt->
tag ==
"Mask" )
245 if ( curropt->
tag ==
"compare" )
247 if ( curropt->
tag ==
"output" )
256 while ( optind < argc )
string_add(&file_list, argv[optind++]);
258 cerr <<
"Error: No parameter files specified!" << endl;
266 cerr <<
"Error: No input file read!" << endl;
275 if ( compfile.
length() ) {
277 if ( use_rec ) projcomp->
select = 1;
288 if ( sampling[0] > 0 )
291 if ( box_size[0] > 0 )
294 if ( add_coordinates )
298 if ( tempfile.
length() ) {
301 if ( set_origin == 2 ) ptemp->
origin(ptemp->
size()/2);
302 else ptemp->
origin(origin);
307 if ( origin.
length() < 1 ) origin = box_size/2;
313 if ( ptemp && excl_dist < 1 ) excl_dist = 0.8*ptemp->
sizeX();
315 if ( pick_type == 1 ) {
319 cerr <<
"Error: Picking particles by cross-correlation requires a template!" << endl;
320 }
else if ( pick_type == 2 ) {
322 }
else if ( pick_type == 3 ) {
324 }
else if ( pick_type == 4 ) {
330 if ( sym && sym_axis > 1 )
336 if ( orientfile.
length() ) {
356 fill_type, fill, 0,
split, partbase, partpath, partext);
A class for a command line input option.
int project_kill(Bproject *project)
Frees a whole project.
Manipulates single particle images.
Vector3< double > scale()
long project_pick_background(Bproject *project, long number, long average_kernel, long var_kernel, double excl_dist)
Picks background areas not overlapping existing particles.
int project_set_powerspectrum_path(Bproject *project, Bstring &path)
Sets the path to powerspectrum files for all the micrographs.
long project_find_part_centers_in_mgs(Bproject *project, double hires, double lores, int filter_flag)
Finds the centers of picked particles within a micrograph.
int string_kill(Bstring *list)
Kills a string linked list.
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.
long project_pick_sym_axis(Bproject *project, Bsymmetry *sym, int sym_axis, double axis_dist)
Picks subregions in 3D particles on the given symmetry axis.
Vector3< long > size() const
Header file for single particle picking functions.
Header file for option handlers.
int main(int argc, char *argv[])
Vector3< double > origin()
long part_deselect_redundant(Bparticle *partlist, double excl_dist, int part_select, int fom_index)
Deselects particles overlapping with better ones.
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.
long project_compare_particles(Bproject *project, Bproject *projcomp)
Compares the coordinates of particles between two files.
void origin(double x, double y, double z)
int project_set_mg_pixel_size(Bproject *project, Vector3< double > pixel_size)
Sets the pixel size for all the micrographs.
long project_show_selected(Bproject *project)
Shows the selected particles in a project.
int project_set_particle_path(Bproject *project, Bstring &path)
Sets the path to particle files for all the micrographs.
long part_deselect(Bproject *project, int fom_index, double fommin, double fommax=1e30)
Deselects particles below a given FOM cutoff.
General image parameter class.
Utilities for timing functions.
double project_extract_orient_particles(Bproject *project, Bstring &tempfile, Bsymmetry *sym, double hires, double lores, long bin)
Picks particles using cross-correlation.
Header file for image processing from micrograph structures.
long project_set_part_links(Bproject *project)
Sets the links from particles back to the micrographs and reconstructions.
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.
long project_delesect_edge_particles(Bproject *project)
Deselects particles that are too close to the image edges.
vector< string > split(const string &s)
Splits a string on whitespace.
double fill(int &fill_type)
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 project_set_particle_box_size(Bproject *project, Vector3< long > box_size)
Sets particle box size to the given value.
int write_project(const char *filename, Bproject *project)
Writing micrograph parameters to a file.
double project_pick_particles(Bproject *project, Bimage *ptemp, Bimage *pmask, double hires, double lores, double fommin, double fommax, double excl_dist, long bin)
Picks particles using cross-correlation.
Header file for micrograph processing.
int kill_symmetry(Bsymmetry *sym)
Deallocates a symmetry structure.
long part_delete_deselected(Bproject *project)
Deletes deselected particles and renumber the remaining.
int option_kill(Boption *option)
Deallocates a linked list of option structures.
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.
int project_set_micrograph_path(Bproject *project, Bstring &path)
Sets the path to micrograph files for all the micrographs.