 |
Bsoft
2.1.0
Bernard's software package
|
Go to the documentation of this file.
20 "Usage: bsurf [options] input.tif output.map",
21 "--------------------------------------------",
22 "Calculates a 3D surface from an AFM image.",
25 "-expand 10 Surface expansion: value = new z dimension.",
26 "-threshold 1.6,1 Calculate a 2D height image using this threshold",
27 " and direction: 0=bottom up, 1=top down.",
28 "-invert Invert inside & outside (default not).",
31 "-verbose 7 Verbosity of output.",
32 "-datatype u Force writing of a new data type.",
33 "-positions 2.5,6.3 Z positions of surface minimum and maximum (angstrom).",
34 "-origin 0.8,-10,15.7 Set the origin (default from input image).",
35 "-sampling 1.5,1.5,1.5 Dimension scaling (default 1,1,1 A/pixel).",
36 "-resolution 0.5,2.3 Upper & lower sigma bounds (default 3.236,3.236).",
37 "-Density 0.74 Density within the surface (default 0.81 Da/A3).",
40 "-Stdev sd.map Standard deviation map (default no map).",
45 int main(
int argc,
char **argv)
53 double threshold(-1e37);
56 double resmin(1+sqrt(5.0));
57 double resmax(1+sqrt(5.0));
58 double posmin(0), posmax(0);
65 for ( curropt = option; curropt; curropt = curropt->
next ) {
66 if ( curropt->
tag ==
"expand" )
67 if ( curropt->
values(nz, dir) < 1 )
68 cerr <<
"-expand: A z dimension must be specified!" << endl;
69 if ( curropt->
tag ==
"threshold" )
70 if ( ( threshold = curropt->
value.
real() ) < -1e36 )
71 cerr <<
"-threshold: A threshold must be specified!" << endl;
72 if ( curropt->
tag ==
"invert" )
74 if ( curropt->
tag ==
"datatype" )
76 if ( curropt->
tag ==
"origin" ) {
77 if ( curropt->
value[0] ==
'c' ) {
80 origin = curropt->
origin();
84 if ( curropt->
tag ==
"sampling" )
85 sam = curropt->
scale();
86 if ( curropt->
tag ==
"positions" )
87 if ( curropt->
values(posmin, posmax) < 2 )
88 cerr <<
"-positions: Minimum and maximum positions must be specified!" << endl;
89 if ( curropt->
tag ==
"resolution" ) {
90 if ( curropt->
values(resmin, resmax) < 1 )
91 cerr <<
"-resolution: A resolution must be specified!" << endl;
92 if ( resmax < resmin ) resmax = resmin;
94 if ( curropt->
tag ==
"Density" ) {
95 if ( ( density = curropt->
value.
real() ) < 0.001 )
96 cerr <<
"-Density: A density must be specified!" << endl;
97 if ( density < 1e-10 ) density = 0.74;
99 if ( curropt->
tag ==
"Stdev" )
129 cerr <<
"Error: Dimensions of the standard deviation file " << sdfile <<
" incorrect!" << endl;
140 if ( threshold > -1e36 && p->
sizeZ() > 1 ) {
147 if ( setinvert ) p->
invert();
150 if ( set_origin == 2 ) p->
origin(p->
size()/2);
155 if ( argc > optind && strspn(argv[optind],
"-") != 1 ) {
A class for a command line input option.
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.
Bimage * surface_to_topograph(double threshold, int dir=0)
Converts a 3D image to a 2D height image.
Vector3< double > origin()
int main(int argc, char **argv)
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.
Bimage * topograph_to_surface(Bimage *psd, long nz, double density, double resolution)
Converts a 2D AFM image to a 3D density map.
int option_kill(Boption *option)
Deallocates a linked list of option structures.
void invert()
Inverts the data in the image.
void sampling(long nn, Vector3< double > u)
DataType
Base data type specifier.