 |
Bsoft
2.1.0
Bernard's software package
|
Go to the documentation of this file.
23 "Usage: bseries [options] input.star [input.star]",
24 "------------------------------------------------",
25 "Aligns series of micrographs using consecutive pairwise cross-correlation.",
28 "-bin 3,2,1 Binning by the given kernel size - one value = isotropic binning.",
29 " (i.e., 2 = binning with a 2x2 kernel, changes the units).",
30 "-align 56 Align to this reference image (image numbers start at 0).",
31 "-filament 5.3,50 Box particles along filaments with this interval and mask width (voxels).",
32 "-extract 150,111,120 Extract particles with this size (voxels, one sets all).",
35 "-verbose 7 Verbosity of output.",
36 "-datatype u Force writing of a new data type.",
37 "-sampling 1.5,1.5,1.5 Sampling (A/pixel; a single value can be given).",
38 "-origin 110,50,44 Origin for tilt axis (default 0,0,0).",
40 "Parameters for alignment:",
41 "-frames Flag to align micrograph frames.",
42 "-dose 2.5 Weigh the amplitudes by accumulated dose using the given dose/frame (e/Å2).",
43 "-exposure 8.5 Exposure time to calculate drift rate from alignment (seconds)",
44 "-rate 4.5 Frame rate (frames/second)",
45 "-counts Flag to rescale images based on their counts histogram.",
46 "-resolution 900,300 High and low resolution limits for cross-correlation (default 0.1,1000 angstrom).",
47 "-shiftlimit 3.5 Limit on origin shift relative to nominal center (default 10% of box edge size).",
48 "-edge 23,12 Smooth the edge to a given width, with gaussian decay of a given width.",
49 "-subset 2-8,12 Subset of micrographs to align and average.",
51 "Parameters for particle extraction:",
52 "-fill 127 Fill value for particles extending beyond image (default background).",
53 "-partbase subvol Set the particle base file name (no extension).",
54 "-partpath dir/subdir Set the particle file paths.",
55 "-partextension pif Set the particle image file format extension.",
56 "-helix 16.2,39.5 Helical parameters for filament boxing: helical rise ",
57 " and angle per asymmetric unit (angstroms and degrees).",
58 "-background Correct background of extracted particles.",
59 "-normalize Normalize extracted particles.",
62 "-Gainreference gr.tif Gain reference to correct the input micrographs.",
63 "-Mask mask.tif Mask file to use for cross-correlation.",
66 "-output file.star Output parameter file, if -average, also output average parameter file.",
67 "-write sum Output either aligned frames, sum or avg.",
68 "-image file.pif Output multi-image file with aligned images.",
69 "-average file.pif Output average of aligned images.",
75 int main(
int argc,
char** argv)
87 double boxing_interval(0);
89 double helix_rise(0), helix_angle(0);
92 double hi_res(0), lo_res(1e10);
93 double shift_limit(-1);
95 double edge_width(0), gauss_width(0);
110 for ( curropt = option; curropt; curropt = curropt->
next ) {
111 if ( curropt->
tag ==
"datatype" )
113 if ( curropt->
tag ==
"sampling" )
114 sam = curropt->
scale();
115 if ( curropt->
tag ==
"align" )
117 cerr <<
"-align: A reference image number must be specified." << endl;
118 if ( curropt->
tag ==
"filament" )
119 if ( curropt->
values(boxing_interval, mask_width) < 1 )
120 cerr <<
"-filament: A boxing interval must be specified." << endl;
121 if ( curropt->
tag ==
"extract" ) {
122 if ( ( i=curropt->
values(box_size[0], box_size[1], box_size[2]) ) < 1 )
123 cerr <<
"-extract: A box size must be specified." << endl;
125 if ( i < 2 ) box_size[2] = box_size[1] = box_size[0];
127 if ( curropt->
tag ==
"background" )
129 if ( curropt->
tag ==
"normalize" )
131 if ( curropt->
tag ==
"frames" )
133 if ( curropt->
tag ==
"counts" )
135 if ( curropt->
tag ==
"dose" ) {
136 dose_frac[
"dose_per_frame"] = curropt->
value.
real();
137 if ( dose_frac[
"dose_per_frame"].real() < 0 )
138 cerr <<
"-dose: The dose per frame must be specified!" << endl;
142 if ( curropt->
tag ==
"exposure" ) {
143 dose_frac[
"exposure"] = curropt->
value.
real();
144 if ( dose_frac[
"exposure"].real() < 0 )
145 cerr <<
"-exposure: An exposure time in seconds must be specified." << endl;
147 if ( curropt->
tag ==
"rate" ) {
148 dose_frac[
"frame_rate"] = curropt->
value.
real();
149 if ( dose_frac[
"frame_rate"].real() < 0 )
150 cerr <<
"-rate: The number of frames per second must be specified." << endl;
152 if ( curropt->
tag ==
"resolution" ) {
153 if ( curropt->
values(hi_res, lo_res) < 1 )
154 cerr <<
"-resolution: Resolution limits must be specified." << endl;
155 else if ( hi_res > lo_res )
156 swap(hi_res, lo_res);
158 if ( curropt->
tag ==
"shiftlimit" )
159 if ( ( shift_limit = curropt->
value.
real() ) < 1 )
160 cerr <<
"-shiftlimit: A maximum shift in pixels must be specified!" << endl;
161 if ( curropt->
tag ==
"origin" )
162 origin = curropt->
origin();
163 if ( curropt->
tag ==
"edge" )
164 if ( curropt->
values(edge_width, gauss_width) < 1 )
165 cerr <<
"-edge: An edge width must be specified." << endl;
166 if ( curropt->
tag ==
"fill" )
167 fill = curropt->
fill(fill_type);
168 if ( curropt->
tag ==
"bin" ) {
169 if ( ( i = curropt->
values(bin[0], bin[1], bin[2]) ) < 1 )
170 cerr <<
"-bin: At least one bin size must be specified!" << endl;
172 if ( i < 2 ) bin[2] = bin[1] = bin[0];
174 if ( curropt->
tag ==
"partbase" ) {
175 partbase = curropt->
value;
176 if ( partbase.
length() < 1 )
177 cerr <<
"-partbase: The particle base file name must be specified!" << endl;
179 if ( curropt->
tag ==
"partpath" ) {
180 partpath = curropt->
value;
181 if ( partpath.
length() < 1 )
182 cerr <<
"-partpath: The particle file path must be specified!" << endl;
184 if ( curropt->
tag ==
"partextension" ) {
185 part_ext = curropt->
value;
186 if ( part_ext.
length() < 1 )
187 cerr <<
"-partextension: The particle file extension must be specified!" << endl;
189 if ( curropt->
tag ==
"helix" ) {
190 if ( curropt->
values(helix_rise, helix_angle) < 2 )
191 cerr <<
"-helix: Both helical rise and angle per unit must be specified." << endl;
193 helix_angle *=
M_PI/180.0;
195 if ( curropt->
tag ==
"subset" )
196 subset = curropt->
value;
197 if ( curropt->
tag ==
"Gainreference" )
199 if ( curropt->
tag ==
"Mask" )
201 if ( curropt->
tag ==
"output" )
203 if ( curropt->
tag ==
"write" ) {
204 if ( curropt->
value[0] ==
'f' ) flags |= 4;
205 if ( curropt->
value[0] ==
's' ) flags |= 8;
206 if ( curropt->
value[0] ==
'a' ) flags |= 8;
208 if ( curropt->
tag ==
"image" )
210 if ( curropt->
tag ==
"average" )
219 while ( optind < argc )
string_add(&file_list, argv[optind++]);
221 cerr <<
"Error: No parameter or image files specified!" << endl;
229 cerr <<
"Error: Input file not read!" << endl;
245 if ( ref_img > -1 ) {
248 shift_limit, edge_width, gauss_width, bin, dose_frac, subset, flags);
251 shift_limit, edge_width, gauss_width, bin, subset, flags);
256 if ( !frames && imgfile.
length() )
264 if ( box_size[0] > 0 )
267 if ( boxing_interval > 0 )
270 if ( box_size[0] > 0 )
272 fill_type, fill, mask_width, 0, partbase, partpath, part_ext);
A class for a command line input option.
int project_kill(Bproject *project)
Frees a whole project.
Vector3< double > scale()
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.
Header file for option handlers.
Vector3< double > origin()
int main(int argc, char **argv)
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.
double project_write_aligned_averages(Bproject *project, Bimage *pgr, Bstring &imgfile, DataType datatype, Bstring &subset)
Calculates aligned micrograph images and write them to a file.
int project_set_particle_path(Bproject *project, Bstring &path)
Sets the path to particle files for all the micrographs.
General image parameter class.
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 project_align_series(Bproject *project, int ref_img, Bimage *pgr, Bimage *pmask, Vector3< double > origin, double hi_res, double lo_res, double shift_limit, double edge_width, double gauss_width, Vector3< long > bin, Bstring &subset, int flag)
Aligns a series of micrographs by cross-correlation.
double project_align_frames(Bproject *project, int ref_img, Bimage *pgr, Bimage *pmask, Vector3< double > origin, double hi_res, double lo_res, double shift_limit, double edge_width, double gauss_width, Vector3< long > bin, JSvalue &dose_frac, Bstring &subset, int flag)
Aligns a series of micrographs by cross-correlation.
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 fill(int &fill_type)
double timer_report(double lasttime)
Reports the time elapsed since a given time.
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.
Header file for micrograph processing.
int option_kill(Boption *option)
Deallocates a linked list of option structures.
DataType
Base data type specifier.
Header file for functions to align micrographs or coordinates from micrographs and apply the resultan...
Bstring * string_add(Bstring **list, const char *string)
Adds a string to a linked list.