 |
Bsoft
2.1.0
Bernard's software package
|
Go to the documentation of this file.
29 "Usage: jave [options] input.images",
30 "----------------------------------",
31 "Averages multiple images together.",
32 "The average can be weighed with a weighting function,",
33 "either in real or Fourier space.",
36 "-sum Sum input files (default is to average).",
37 "-rescale -0.1,5.2 Rescale input images to average and standard deviation.",
38 "-divide Values / amplitudes are divided with the weighting function (default).",
39 "-multiply Values / amplitudes are multiplied with the weighting function.",
42 "-verbose 7 Verbosity of output.",
43 "-datatype u Force writing of a new data type.",
44 "-sampling 1.5,1.5,1.5 Sampling (A/pixel; a single value can be given).",
46 "-translate Translate images to a common origin.",
47 "-origin 0.8,-10,15.7 Set the origin.",
48 "-wiener 0.1 Wiener factor for dividing (default 0.2).",
51 "-weight input.img Real space weighting function.",
52 "-Weight input.img Fourier space weighting function.",
55 "-output output.img Output image.",
59 int main(
int argc,
char **argv)
66 int divide(1), multiply(0);
70 double nuavg(0), nustd(0);
80 for ( curropt = option; curropt; curropt = curropt->
next ) {
81 if ( curropt->
tag ==
"datatype")
83 if ( curropt->
tag ==
"sampling")
84 sampling = curropt->
scale();
85 if ( curropt->
tag ==
"origin") {
86 if ( curropt->
value[0] ==
'c' ) {
89 origin = curropt->
origin();
93 if ( curropt->
tag ==
"rescale")
94 if ( curropt->
values(nuavg, nustd) < 2 )
95 cerr <<
"-rescale: Both average and standard deviation must be specified" << endl;
96 if ( curropt->
tag ==
"wiener" )
97 if ( ( wiener = curropt->
value.
real() ) < 1e-10 )
98 cerr <<
"-wiener: Wiener factor larger than 0 must be specified" << endl;
99 if ( curropt->
tag ==
"Weight") {
103 if ( curropt->
tag ==
"weight") {
107 if ( curropt->
tag ==
"size") {
108 size = curropt->
size();
110 cerr <<
"-size: A box size must be specified." << endl;
112 if ( curropt->
tag ==
"sum") {
115 if ( curropt->
tag ==
"divide") {
119 if ( curropt->
tag ==
"multiply") {
123 if ( curropt->
tag ==
"translate") {
126 if ( curropt->
tag ==
"output")
133 cerr <<
"Error: No input files given!" << endl << endl;
139 if ( optind >= argc ) {
140 cerr <<
"No input files!" << endl;
147 while ( optind < argc ) {
153 vector<double> weight;
157 if ( setweight > 0 ) {
161 if ( setweight == 1 ) {
165 if ( divide ) psum->
divide(pw, wiener);
171 if ( setweight == 2 ) {
173 if ( divide ) psum->
divide(pw, wiener);
180 if ( sampling > 0 ) psum->
sampling(sampling);
182 if ( set_origin ) psum->
origin(origin);
184 if ( set_origin == 2 ) psum->
origin(psum->
size()/2);
185 else psum->
origin(origin);
A class for a command line input option.
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.
int main(int argc, char **argv)
Vector3< long > size() const
Header file for option handlers.
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.
void multiply(long j, Complex< double > cv)
int write_img(const char *filename, Bimage *p, int compression)
General driver function to write multiple image formats.
Bimage * img_add_weighed(Bstring *file_list, vector< double > weight, double newavg=0, double newstd=0, int flags=0)
Adds multiple images together with given weights.
void divide(Bimage *p, double scale=1, double shift=0)
Divides the first image by the second.
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.
Header file for combining two images in various ways.
void sampling(long nn, Vector3< double > u)
DataType
Base data type specifier.
Header file for functions finding particles (subtomograms) in a tomogram.
Bstring * string_add(Bstring **list, const char *string)
Adds a string to a linked list.