 |
Bsoft
2.1.0
Bernard's software package
|
Go to the documentation of this file.
20 "Usage: bconvert [options] input.images",
21 "--------------------------------------",
22 "Converts a list of images into a new format, using the original names and replacing the extension.",
23 "Any number of input images may be given and may include the wild card \"*\".",
24 "(However, VMS does not support Unix style usage of wild cards).",
27 "-rescale -0.1,5.2 Rescale input images to average and standard deviation.",
28 "-extension zyx Change the file extension after writing.",
31 "-verbose 3 Verbosity of output.",
32 "-datatype u Force writing of a new data type.",
33 "-sampling 1.5,1.5,1.5 Sampling (A/pixel; a single value can be given).",
34 "-origin 0.8,-10,15.7 Set the origin (default from input image).",
35 "-raw d=f#x=120,120,1 Formatting to reinterpret image files.",
38 "-output mrc Output format (default pif).",
43 int main(
int argc,
char **argv)
54 double nuavg(0), nustd(0);
59 for ( curropt = option; curropt; curropt = curropt->
next ) {
60 if ( curropt->
tag ==
"rescale" ) {
61 if ( curropt->
values(nuavg, nustd) < 2 )
62 cerr <<
"-rescale: Both averge and standard deviation must be specified!" << endl;
65 if ( nustd <= 0 ) setrescale = 0;
67 if ( curropt->
tag ==
"extension" ) nuext = curropt->
value;
68 if ( curropt->
tag ==
"datatype" )
70 if ( curropt->
tag ==
"sampling" )
71 sam = curropt->
scale();
72 if ( curropt->
tag ==
"origin" ) {
73 if ( curropt->
value[0] ==
'c' ) {
76 origin = curropt->
origin();
80 if ( curropt->
tag ==
"raw" ) {
81 rawstring = curropt->
value;
82 if ( rawstring.
length() < 1 )
83 cerr <<
"-raw: A valid format reinterpretation string must be specified!" << endl;
85 if ( curropt->
tag ==
"output" ) {
86 nuformat = curropt->
value;
87 if ( nuformat.
length() < 1 )
88 cerr <<
"-output: An output format must be specified!" << endl;
94 cerr <<
"Error: No input files given!" << endl;
104 if ( nuformat[0] !=
'.' ) nuformat =
"." + nuformat;
105 if ( nuext.
length() && nuext[0] !=
'.' ) nuext =
"." + nuext;
106 if ( rawstring.
length() > 0 && rawstring[0] !=
'#' ) rawstring =
"#" + rawstring;
108 while ( optind < argc ) {
109 filename = argv[optind++];
110 filename += rawstring;
126 filename = filename.
pre_rev(
'.') + nuformat;
131 nuname = filename.
pre_rev(
'.') + nuext;
132 if ( rename(filename.
c_str(), nuname.
c_str()) )
133 cerr <<
"File " << filename <<
" not renamed to " << nuname << endl;
A class for a command line input option.
Vector3< double > scale()
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.
int main(int argc, char **argv)
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)
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.
long statistics()
Calculates the statistics for an image.
int rescale_to_avg_std(double nuavg, double nustd)
Rescales the image data to a given average and standard deviation.