 |
Bsoft
2.1.0
Bernard's software package
|
Go to the documentation of this file.
20 "Usage: bedge [options] infile.mrc outfile.mrc",
21 "---------------------------------------------",
22 "Smooths the edge of an image to a uniform background.",
25 "-verbose 7 Verbosity of output.",
26 "-datatype u Force writing of a new data type.",
27 "-truncate -0.5,1.2 Truncate data to minimum and maximum before edge operation.",
28 "-size 4000,4000,10 Size of region inside edge (default 90% of image size).",
30 "-start 2500,1500,5 Start of edge (default 5% from image origin).",
32 "-width 8 Gaussian width (default 0.1, sharp edge, <0 inverts selection).",
34 "-shape oval Edge shape: rectangular (default), oval, cylindrical.",
35 "-fill 150 Fill value for background: average (default), background, or value.",
40 int main(
int argc,
char* argv[])
44 double cutmin(0), cutmax(0);
57 for ( curropt = option; curropt; curropt = curropt->
next ) {
58 if ( curropt->
tag ==
"datatype" )
60 if ( curropt->
tag ==
"truncate" )
61 if ( curropt->
values(cutmin, cutmax) < 2 )
62 cerr <<
"-truncate: Both min and max must be specified!" << endl;
63 if ( curropt->
tag ==
"size" )
64 if ( curropt->
values(size[0], size[1], size[2]) < 3 )
65 cerr <<
"-size: All three dimensions must be specified!" << endl;
66 if ( curropt->
tag ==
"start" || curropt->
tag ==
"origin" ) {
67 if ( curropt->
values(start[0], start[1], start[2]) < 3 )
68 cerr <<
"-start: All three dimensions must be specified!" << endl;
71 if ( curropt->
tag ==
"width" || curropt->
tag ==
"gausswidth" ) {
73 if ( fabs(width) < 0.001 )
74 cerr <<
"-width: The Gaussian width must be specified." << endl;
76 if ( curropt->
tag ==
"shape" || curropt->
tag ==
"edgeshape" ) {
77 shape = curropt->
value;
78 if ( shape.
length() < 1 ) {
79 cerr <<
"-shape: An edge shape must be specified." << endl;
81 if ( tolower(shape[0]) ==
'o' ) setedge = 1;
82 if ( tolower(shape[0]) ==
'c' ) setedge = 2;
85 if ( curropt->
tag ==
"fill" )
86 fill = curropt->
fill(fill_type);
97 if ( cutmin < cutmax )
103 if ( size.
volume() < 1 ) {
104 sz = sz * 0.95 - start;
105 size = {long(sz[0]), long(sz[1]), long(sz[2])};
109 p->
edge(setedge, size, start, width, fill_type, fill);
112 if ( argc > optind ) {
A class for a command line input option.
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.
Header file for option handlers.
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.
int truncate_to_min_max(double minim, double maxim)
Truncates image data to a given minimum and maximum.
double timer_start()
Starts timer and prints the time.
Header file for general utilities.
double fill(int &fill_type)
double timer_report(double lasttime)
Reports the time elapsed since a given time.
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.
DataType
Base data type specifier.
int edge(int type, Vector3< long > rect, Vector3< double > start, double width, int fill_type=0, double fill=0)
Smooths the image edge with a soft rectangular function.