 |
Bsoft
2.1.0
Bernard's software package
|
Go to the documentation of this file.
23 "Usage: bfil [options] input.star [input2.star ...]",
24 "--------------------------------------------------",
25 "Extracts filaments from a micrograph as straightened filaments or boxed particles.",
28 "-reconstructions Operate on reconstruction parameters rather than micrographs.",
29 "-center 85 Center filament nodes with the given window width.",
30 "-density 25 Estimate filament density per length with the given filament width.",
31 "-extract 150,y Extract filaments with this width (voxels) along an axis (optional).",
32 "-split Split filaments into individual files.",
34 "Actions for boxing:",
35 "-box 125,125,1 Box particles along filaments with this size (voxels, one sets all).",
36 "-interval 25.5 Interval of boxes (default: box radius).",
37 "-maskwidth 50 Width to mask boxed images (voxels).",
38 "-background Correct background of extracted particles.",
39 "-normalize Normalize extracted particles.",
40 "-rotate y Rotate particles from filaments to align with an axis.",
41 "-powerspectrum 200 Calculates average power spectra from extracted particles with optional padding.",
44 "-verbose 7 Verbosity of output.",
45 "-sampling 1.5,1.5,1.5 Sampling (A/pixel; a single value can be given).",
46 "-base fil_001 Set the filament/particle base file name (no extension).",
47 "-path dir/subdir Set the filament/particle file paths.",
48 "-extension pif Set the filament/particle image file format.",
50 "Parameters for boxing:",
51 "-helix 16.2,39.5 Helical parameters for filament boxing: helical rise ",
52 " and angle per asymmetric unit (angstroms and degrees).",
53 "-fill 127 Fill value for particles extending beyond image (default background).",
56 "-output file.star Output parameter file.",
57 "-Densities img.mrc One dimensional image with filament densities.",
58 "-Postscript plot.ps Histogram of filament densities.",
63 int main(
int argc,
char* argv[])
73 int filament_density(0);
74 int filament_width(0);
77 double boxing_interval(0);
79 double helix_rise(0), helix_angle(0);
95 for ( curropt = option; curropt; curropt = curropt->
next ) {
96 if ( curropt->
tag ==
"reconstructions" ) use_rec = 1;
97 if ( curropt->
tag ==
"split" )
split = 1;
98 if ( curropt->
tag ==
"center" )
100 cerr <<
"-center: A filament width must be specified." << endl;
101 if ( curropt->
tag ==
"density" )
102 if ( ( filament_density = curropt->
value.
integer() ) < 1 )
103 cerr <<
"-density: A filament width must be specified." << endl;
104 if ( curropt->
tag ==
"extract" ) {
106 if ( filament_width < 1 )
107 cerr <<
"-extract: A filament width must be specified." << endl;
110 if ( axis_char ==
'1' || axis_char ==
'x' ) filament_axis = 1;
111 if ( axis_char ==
'2' || axis_char ==
'y' ) filament_axis = 2;
112 if ( axis_char ==
'3' || axis_char ==
'z' ) filament_axis = 3;
115 if ( curropt->
tag ==
"box" ) {
116 box_size = curropt->
size();
117 if ( box_size.
volume() < 1 )
118 cerr <<
"-box: A boxing size must be specified." << endl;
120 if ( curropt->
tag ==
"interval" )
121 if ( ( boxing_interval = curropt->
value.
real() ) < 1 )
122 cerr <<
"-interval: A boxing interval must be specified." << endl;
123 if ( curropt->
tag ==
"maskwidth" )
125 cerr <<
"-maskwidth: A mask width must be specified." << endl;
126 if ( curropt->
tag ==
"background" ) back_flag = 1;
127 if ( curropt->
tag ==
"normalize" ) norm_flag = 1;
128 if ( curropt->
tag ==
"powerspectrum" ) {
131 cerr <<
"-powerspectrum: A padding value must be specified!" << endl;
133 if ( curropt->
tag ==
"sampling" )
134 sam = curropt->
scale();
135 if ( curropt->
tag ==
"base" ) {
137 if (
base.length() < 1 )
138 cerr <<
"-base: The particle base file name must be specified!" << endl;
140 if ( curropt->
tag ==
"path" ) {
141 path = curropt->
value;
143 cerr <<
"-path: The particle file path must be specified!" << endl;
145 if ( path[-1] !=
'/' ) path +=
"/";
147 if ( curropt->
tag ==
"extension" ) {
148 ext = curropt->
value;
150 cerr <<
"-extension: The particle file extension must be specified!" << endl;
152 if ( curropt->
tag ==
"helix" ) {
153 if ( curropt->
values(helix_rise, helix_angle) < 2 )
154 cerr <<
"-helix: Both helical rise and angle per unit must be specified." << endl;
156 helix_angle *=
M_PI/180.0;
158 if ( curropt->
tag ==
"fill" )
159 fill = curropt->
fill(fill_type);
160 if ( curropt->
tag ==
"rotate" ) {
161 if ( ( axis_char = curropt->
value[0] ) < 1 )
162 cerr <<
"-rotate: An axis must be specified!" << endl;
164 if ( axis_char ==
'1' || axis_char ==
'x' ) rotation_axis = 1;
165 if ( axis_char ==
'2' || axis_char ==
'y' ) rotation_axis = 2;
166 if ( axis_char ==
'3' || axis_char ==
'z' ) rotation_axis = 3;
169 if ( curropt->
tag ==
"output" )
171 if ( curropt->
tag ==
"Densities" )
173 if ( curropt->
tag ==
"Postscript" )
182 while ( optind < argc )
string_add(&file_list, argv[optind++]);
184 cerr <<
"Error: No parameter files specified!" << endl;
192 cerr <<
"Error: No input file read!" << endl;
197 else box_size[2] = 1;
205 if ( box_size[0] > 0 )
208 if ( center_width > 0 )
211 if ( filament_density ) {
221 if ( filament_width > 0 )
224 if ( path.
length() && box_size[0] )
227 if ( boxing_interval > 0 )
230 if ( box_size[0] > 0 ) {
231 if ( rotation_axis > 0 ) {
247 if ( psfile.
length() && plot )
A class for a command line input option.
int project_kill(Bproject *project)
Frees a whole project.
int ps_plot(Bstring filename, Bplot *plot)
Generates postscript graphs.
Vector3< double > scale()
Bimage * project_filament_density(Bproject *project, int filament_width)
Extracts filament images from micrographs defined in a project and estimates their density per length...
int string_kill(Bstring *list)
Kills a string linked list.
string base(string &filename)
int main(int argc, char *argv[])
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.
double project_center_filaments(Bproject *project, int filament_width)
Centers filament nodes in all micrographs in a project.
long values(T1 &v1, T2 &v2)
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.
int write_img(const char *filename, Bimage *p, int compression)
General driver function to write multiple image formats.
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 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.
vector< string > split(const string &s)
Splits a string on whitespace.
double fill(int &fill_type)
double timer_report(double lasttime)
Reports the time elapsed since a given time.
Bplot * histogram_gauss_plot(long bins, long ngauss=1)
Fits a gaussian function to a histogram of an image.
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.
bool contains(const Bstring &s)
int project_filament_powerspectrum(Bproject *project, int pad, int rotated, Bstring &path)
Calculates and average power spectrum from filaments.
Header file for functions to process helical data.
Bstring * string_add(Bstring **list, const char *string)
Adds a string to a linked list.
long statistics()
Calculates the statistics for an image.