 |
Bsoft
2.1.0
Bernard's software package
|
Go to the documentation of this file.
20 "Usage: bdif [options] [input.img] output.img",
21 "--------------------------------------------",
22 "Analyzes diffraction patterns.",
25 "-findorigin Find the origin of the diffraction pattern.",
28 "-verbose 7 Verbosity of output.",
29 "-datatype u Force writing of a new data type.",
30 "-origin 60.4,-32.2,44 Origin of image (voxels).",
31 "-sampling 1.5,1.5,1.5 Sampling (A/pixel; a single value can be given).",
32 "-resolution 4.5,130 Resolution range for correlation (default 0 - 1e6 angstrom).",
33 "-angle 36.8 Angle for directional averages (default 0).",
38 int main(
int argc,
char* argv[])
47 double hires(0), lores(0);
52 for ( curropt = option; curropt; curropt = curropt->
next ) {
53 if ( curropt->
tag ==
"findorigin" )
55 if ( curropt->
tag ==
"datatype" )
57 if ( curropt->
tag ==
"sampling" )
58 sam = curropt->
scale();
59 if ( curropt->
tag ==
"origin" ) {
60 if ( curropt->
value[0] ==
'c' ) {
63 origin = curropt->
origin();
67 if ( curropt->
tag ==
"resolution" )
68 if ( curropt->
values(hires, lores) < 1 )
69 cerr <<
"-resolution: A high resolution limit must be specified" << endl;
70 if ( curropt->
tag ==
"angle" )
81 cerr <<
"Error: No input file read!" << endl;
96 if ( hires < p->sampling(0)[0] ) hires = p->
sampling(0)[0]*10;
97 if ( lores < hires ) lores = hires*100;
99 double radius(p->
sizeX()/4.0);
100 if ( find_origin ) p->
find_center(pmask, hires, lores, radius, 0, 1);
102 long i, len(p->
sizeX()/2);
109 cout <<
"Radius\ts\tAvg\tDir1\tDir2" << endl;
110 for ( i=1; i<prad->
sizeX(); i++ )
111 cout << i <<
tab << p->
sizeX()*p->
sampling(0)[0]/i <<
tab << (*prad)[i] <<
tab << (*pdir1)[i] <<
tab << (*pdir2)[i] << endl;
119 if ( optind < argc ) {
A class for a command line input option.
Vector3< double > scale()
int find_center(Bimage *pmask, double hires, double lores, double radius, double sigma, int refine_flag)
Finds the center of mass of an image by cross-correlation with its inverse.
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.
Bimage * radial(long minrad, long maxrad, double rad_step=1, int wrap=0)
Calculates the radial average of an image.
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 origin(double x, double y, double z)
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.
ostream & tab(ostream &out)
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 * extract_line(long nn, Vector3< double > start, Vector3< double > end, long width)
Extracts a line from an image into a new image.
int option_kill(Boption *option)
Deallocates a linked list of option structures.
void sampling(long nn, Vector3< double > u)
int main(int argc, char *argv[])
DataType
Base data type specifier.