 |
Bsoft
2.1.0
Bernard's software package
|
Go to the documentation of this file.
22 "Usage: btube [options] input.img output.img",
23 "-------------------------------------------",
24 "Symmetrizes helical tubes with hexagonal lattices.",
27 "-lattice 5,9 Lattice parameters (units along u and v vectors).",
28 "-normalize Normalize symmetrized output, use for maps close to symmetry (default not).",
29 "-background Calculate new background values.",
30 "-rescale -0.1,5.2 Rescale data to average and standard deviation.",
33 "-verbose 1 Verbosity of output.",
34 "-datatype u Force writing of a new data type.",
35 "-sampling 1.5,1.5,1.5 Sampling (A/pixel; a single value can be given).",
36 "-origin 110,50,44 Origin for tube (default 0,0,0 or from image).",
37 "-constant 95 Lattice constant: distance between units in angstrom (default 1).",
38 "-zlimits 8,47 Range of slices along the helical axis to use (default 0,inf).",
39 "-radius 22 Radial limit for symmetrization in pixels (default from image).",
47 int main(
int argc,
char **argv)
51 int calc_background(0);
53 double nuavg(0), nustd(0);
60 int zmin(0), zmax(1000000);
66 for ( curropt = option; curropt; curropt = curropt->
next ) {
67 if ( curropt->
tag ==
"lattice" )
68 if ( curropt->
values(h, k) < 2 )
69 cerr <<
"-lattice: Both lattice parameters must be specified" << endl;
70 if ( curropt->
tag ==
"normalize" ) norm_flag = 1;
71 if ( curropt->
tag ==
"background" ) calc_background = 1;
72 if ( curropt->
tag ==
"rescale" )
73 if ( curropt->
values(nuavg, nustd) < 2 )
74 cerr <<
"-rescale: Both average and standard deviation must be specified!" << endl;
75 if ( curropt->
tag ==
"datatype" )
77 if ( curropt->
tag ==
"sampling" ) {
78 sampling = curropt->
scale();
81 if ( curropt->
tag ==
"origin" ) {
82 if ( curropt->
value[0] ==
'c' ) {
85 origin = curropt->
origin();
89 if ( curropt->
tag ==
"constant" )
90 if ( ( latconst = curropt->
value.
real() ) < 0.001 )
91 cerr <<
"-constant: A lattice constant must be specified" << endl;
92 if ( curropt->
tag ==
"zlimits" )
93 if ( curropt->
values(zmin, zmax) < 2 )
94 cerr <<
"-zlimits: Both limits on the helical axis must be specified" << endl;
95 if ( curropt->
tag ==
"radius" )
96 if ( ( radius = curropt->
value.
real() ) < 0.001 )
97 cerr <<
"-radius: A radius must be specified" << endl;
106 cerr <<
"Error: No input file!" << endl;
111 if ( set_origin == 2 ) p->
origin(p->
size()/2);
115 if ( set_sampling ) p->
sampling(sampling);
119 if ( h ) p->
tube_symmetrize(h, k, latconst, zmin, zmax, radius, norm_flag);
121 if ( optind < argc ) {
A class for a command line input option.
double tube_symmetrize(int h, int k, double latconst, int zmin, int zmax, double radius, int norm_flag=1)
Symmetrizes an image given tubular lattice parameters.
Vector3< double > scale()
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.
Vector3< long > size() const
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 timer_start()
Starts timer and prints the time.
Header file for general utilities.
double timer_report(double lasttime)
Reports the time elapsed since a given time.
void origin(double ox, double oy, double oz)
int main(int argc, char **argv)
void change_type(char letter)
Get the data type indicated by a single letter code.
Header file for 2D and 3D image I/O.
int option_kill(Boption *option)
Deallocates a linked list of option structures.
void sampling(long nn, Vector3< double > u)
DataType
Base data type specifier.
int rescale_to_avg_std(double nuavg, double nustd)
Rescales the image data to a given average and standard deviation.