 |
Bsoft
2.1.0
Bernard's software package
|
Go to the documentation of this file.
24 "Usage: bhelcross [options] input.img output.img",
25 "-----------------------------------------------",
26 "Calculates the 2D cross section for a helical filament.",
27 "The helix axis must coincide with the y axis.",
30 "-crosssection Calculate a cross section based on helical parameters.",
31 "-extrude 254 Extrude the cross section to the indicated length.",
32 "-symmetry C5 Apply point group symmetry.",
33 "-rescale -0.1,5.2 Rescale data to average and standard deviation.",
36 "-verbose 1 Verbosity of output.",
37 "-datatype u Force writing of a new data type.",
38 "-sampling 1.5,1.5,1.5 Sampling (A/pixel; a single value can be given).",
39 "-origin 110,50,44 Origin for helix (default 0,0,0 or from image).",
40 "-helix 25.3,67 Helical rise and angle (default 10 angstrom, 45 degrees).",
42 "Parameters for calculating the cross section:",
43 "-resolution 15.6 High resolution limit for reconstruction (default 0).",
44 "-scale 1.5 Reconstruction scale (default 1).",
45 "-snradius 36 Radius to distinguish signal from noise (alternative to -kernel).",
46 "-kernel 9 Local variance kernel size for generating a foreground mask (default 11).",
48 "Parameters for alignment:",
49 "-alignresolution 20,360 High and low resolution limits (angstrom).",
50 "-annuli 12,60 Real space annular limits (default 0,inf pixels).",
51 "-shiftlimit 3.5 Limit on origin shift relative to nominal center (default 10% of box edge size).",
53 "Parameter for extrusion:",
54 "-fill 1.77 Fill value for background: average (default), background, or value.",
57 "-reference file.map 2D reference image file name.",
62 int main(
int argc,
char **argv)
71 double helix_rise(10);
72 double helix_angle(
M_PI/8);
75 double nuavg(0), nustd(0);
78 int calc_background(0);
86 double shift_limit(-1);
94 for ( curropt = option; curropt; curropt = curropt->
next ) {
95 if ( curropt->
tag ==
"crosssection" )
cross = 1;
96 if ( curropt->
tag ==
"extrude" )
98 cerr <<
"-extrude: An extrusion length must be specified!" << endl;
99 if ( curropt->
tag ==
"symmetry" )
101 if ( curropt->
tag ==
"rescale" )
102 if ( curropt->
values(nuavg, nustd) < 2 )
103 cerr <<
"-rescale: Both average and standard deviation must be specified!" << endl;
104 if ( curropt->
tag ==
"background" )
108 if ( curropt->
tag ==
"origin" ) {
109 if ( curropt->
value[0] ==
'c' ) {
112 origin = curropt->
origin();
116 if ( curropt->
tag ==
"datatype" )
118 if ( curropt->
tag ==
"sampling" ) {
119 sam = curropt->
scale();
122 if ( curropt->
tag ==
"helix" ) {
123 if ( curropt->
values(helix_rise, helix_angle) < 2 )
124 cerr <<
"-helix: Both rise and angle must be specified" << endl;
126 helix_angle *=
M_PI/180.0;
128 if ( curropt->
tag ==
"resolution" )
129 if ( ( hires = curropt->
value.
real() ) < 0.001 )
130 cerr <<
"-resolution: A resolution limit must be specified!" << endl;
131 if ( curropt->
tag ==
"scale" )
132 if ( ( scale = curropt->
value.
real() ) < 0.0001 )
133 cerr <<
"-scale: A scale must be specified!" << endl;
134 if ( curropt->
tag ==
"snradius" )
135 if ( ( snradius = curropt->
value.
real() ) < 1 )
136 cerr <<
"-snradius: A radius must be specified!" << endl;
137 if ( curropt->
tag ==
"kernel" )
139 cerr <<
"-kernel: The kernel edge size must be specified!" << endl;
140 if ( curropt->
tag ==
"alignresolution" ) {
141 if ( curropt->
values(res_hi, res_lo) < 1 )
142 cerr <<
"-resolution: At least one resolution limit must be specified!" << endl;
144 if ( res_lo < res_hi ) swap(res_hi, res_lo);
146 if ( curropt->
tag ==
"annuli" )
147 if ( curropt->
values(ann_min, ann_max) < 1 )
148 cerr <<
"-annuli: At least a minimum annulus must be specified!" << endl;
149 if ( curropt->
tag ==
"shiftlimit" )
150 if ( ( shift_limit = curropt->
value.
real() ) < 0.001 )
151 cerr <<
"-shiftlimit: A maximum shift in pixels must be specified!" << endl;
152 if ( curropt->
tag ==
"fill" )
153 fill = curropt->
fill(fill_type);
154 if ( curropt->
tag ==
"reference" )
166 cerr <<
"Error: No input file!" << endl;
175 if ( set_sampling ) p->
sampling(sam);
177 double snr(0), nsam(fabs(p->
real_size()[1]*helix_angle/(
TWOPI*helix_rise)));
193 cout <<
"Adjusted signal-to-noise ratio: " << snr << endl << endl;
198 if ( ref_file.
length() ) {
200 p->
align2D(pref, ann_min, ann_max, res_lo, res_hi, shift_limit, 0);
212 if ( optind < argc ) {
A class for a command line input option.
Vector3< double > real_size()
vector< T1 > cross(vector< T1 > &v1, vector< T2 > &v2)
double symmetrize(Bstring &symmetry_string, int flag)
Vector3< double > scale()
Header file for general symmetry functions.
int bexit(int value)
Exit function for cleanup and debugging.
Vector3< double > default_origin()
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.
int calculate_background(long nn, int flag)
Calculates the background for one sub-image.
Vector3< double > origin()
long values(T1 &v1, T2 &v2)
Bimage * read_img(char *filename, int readdata, int img_select)
General driver function to read multiple image formats.
int write_img(const char *filename, Bimage *p, int compression)
General driver function to write multiple image formats.
General image parameter class.
Utilities for timing functions.
double align2D(Bimage *pref, double res_polar, int ann_min, int ann_max, Bimage *prs_mask, double shift_limit, double angle_limit, fft_plan planf_1D, fft_plan planb_1D, fft_plan planf_2D, fft_plan planb_2D)
Finds the best in-plane alignment for two 2D images using polar power spectra.
int extrude_cross_section(long length, double helix_rise, double helix_angle, int fill_type, double fill)
Extrudes a 2D cross section into a 3D continuous helix.
double timer_start()
Starts timer and prints the time.
Header file for general utilities.
double fill(int &fill_type)
double timer_report(double lasttime)
Reports the time elapsed since a given time.
void origin(double ox, double oy, double oz)
void change_type(char letter)
Get the data type indicated by a single letter code.
Header file for 2D and 3D image I/O.
Bimage * variance_mask(long kernel_size, double lowvar=1e-6, int bkg_flag=0)
Calculates a mask based on local variance.
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)
double snvariance(double snradius)
Calculates the ratio of variance inside and outside a given radius.
int main(int argc, char **argv)
DataType
Base data type specifier.
Bimage * helical_cross_section(double helix_rise, double helix_angle, double scale, double hires)
Calculates a helical cross section from line transforms of a filament.
int rescale_to_avg_std(double nuavg, double nustd)
Rescales the image data to a given average and standard deviation.