 |
Bsoft
2.1.0
Bernard's software package
|
Go to the documentation of this file.
24 "Usage: bhead [options] input.img output.img",
25 "-------------------------------------------",
26 "Reports on and modifies image parameters in the image header.",
27 "Image format extensions supported:",
28 "BioRad (pic), Brix (brx), CCP4 (map), Digital Instruments (di)",
29 "EM (em), Goodford (pot), GRD (grd), Imagic (img), MFF (mff)",
30 "Image Magick (miff), MRC (mrc), PIC (bp), PIF (pif), Spider (spi)",
31 "Suprim (spm), TIFF (tif), RAW (raw)",
32 "Background calculation flag:",
33 " 1=outside enclosing circle",
34 " 2=inside enclosing circle",
35 " 3=inside half-radius circle",
38 "-information Show sub-image information.",
39 "-moments 6 Show sub-image moments up to the indicated order.",
40 "-get size Show selected information.",
41 "-recalculate Force recalculation of statistics.",
42 "-slices Interpret multiple 2D images as z-slices of a single 3D image.",
43 "-images Interpret slices of a single 3D image as 2D images.",
44 "-background 1 Calculate new background values (image not modified).",
45 "-Background 2 Calculate new background values and mask the background.",
46 "-subtractbackground Subtract the background.",
47 "-shiftbackground 1.6 Shift the background to this value.",
50 "-verbose 7 Verbosity of output.",
51 "-datatype u Force writing of a new data type.",
52 "-select 1 Select an image (first image = 0; default: all images).",
53 "-origin 0,-10.5,30 Set the origin.",
54 "-sampling 1.5,1.5,1.5 Sampling (A/pixel; a single value can be given).",
55 "-Sampling 1.5,1.5,1.5 Sets sampling and unit cell dimensions to fill image (A/pixel).",
56 "-setbackground 0.5 Set the background to this value.",
57 "-symmetry D6 Point group identifier.",
58 "-spacegroup 90 Set space group.",
59 "-unitcell 82,82.3,100,90,66.7,70 Set unit cell parameters (A and degrees).",
60 "-View 0.3,0.5,-0.2,35 Sets the view parameters for every image.",
61 "-label \"New title\" Give a new title or label in the header.",
62 "-fixtype 8 or 16 bit integer types are switched between signed and unsigned.",
67 int main(
int argc,
char **argv)
71 int show_sub_images(0);
83 int calc_background(0);
84 int correct_background(0);
85 int set_background(0);
86 int subtract_background(0);
87 int shift_background(0);
88 double newbackground(0);
99 for ( curropt = option; curropt; curropt = curropt->
next ) {
100 if ( curropt->
tag ==
"datatype" )
102 if ( curropt->
tag ==
"information" )
104 if ( curropt->
tag ==
"moments" )
106 cerr <<
"-moments: A number of orders must be specified!" << endl;
107 if ( curropt->
tag ==
"get" )
109 if ( curropt->
tag ==
"recalculate" )
110 set_stats = dataflag = 1;
111 if ( curropt->
tag ==
"select" )
113 cerr <<
"-select: An image number must be specified!" << endl;
114 if ( curropt->
tag ==
"origin" ) {
115 if ( curropt->
value[0] ==
'c' ) {
118 origin = curropt->
origin();
122 if ( curropt->
tag ==
"sampling" ) {
123 sam = curropt->
scale();
126 if ( curropt->
tag ==
"Sampling" ) {
127 sam = curropt->
scale();
128 if ( sam[0] > 0 ) set_sampling = 2;
130 if ( curropt->
tag ==
"symmetry" )
132 if ( curropt->
tag ==
"spacegroup" )
134 cerr <<
"-spacegroup: A valid space group must be specified!" << endl;
135 if ( curropt->
tag ==
"unitcell" )
137 if ( curropt->
tag ==
"background" ) {
139 if ( ( calc_background = curropt->
value.
integer() ) < 1 )
140 cerr <<
"-background: A calculation type must be specified!" << endl;
142 if ( curropt->
tag ==
"Background" ) {
144 if ( ( correct_background = curropt->
value.
integer() ) < 1 )
145 cerr <<
"-Background: A calculation type must be specified!" << endl;
147 if ( curropt->
tag ==
"setbackground" ) {
151 if ( curropt->
tag ==
"subtractbackground" )
152 subtract_background = dataflag = 1;
153 if ( curropt->
tag ==
"shiftbackground" ) {
155 shift_background = dataflag = 1;
157 if ( curropt->
tag ==
"View" ) {
158 view = curropt->
view();
161 if ( curropt->
tag ==
"label" )
162 label = curropt->
value;
163 if ( curropt->
tag ==
"slices" )
165 if ( curropt->
tag ==
"images" )
167 if ( curropt->
tag ==
"fixtype" )
180 if ( optind >= argc )
bexit(0);
183 if ( set_stats || show_moments || calc_background || optind < argc - 1 ) dataflag = 1;
197 if (
verbose ) show_sub_images = 1;
200 if ( calc_background ) {
202 if (
verbose ) show_sub_images = 1;
205 if ( optind < argc ) {
206 if ( correct_background ) {
208 if (
verbose ) show_sub_images = 1;
211 if ( set_background ) {
213 if (
verbose ) show_sub_images = 1;
216 if ( shift_background ) {
218 if (
verbose ) show_sub_images = 1;
221 if ( subtract_background ) {
223 if (
verbose ) show_sub_images = 1;
226 if ( set_view ) p->
view(view);
233 if ( set_sampling ) {
258 if ( show_moments ) p->
moments(show_moments);
A class for a command line input option.
Library functions to encode versions of all included packages.
Vector3< double > scale()
double get(long nn, long xx, long yy, long zz, long cc=0)
Returns the data value at the given coordinates.
size_t system_processors()
Returns the number of processors.
SysType systype(int show)
Finds the system type - mostly just for byte order.
void unit_cell(UnitCell uc)
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.
double background(long nn)
Header file for option handlers.
int calculate_background(long nn, int flag)
Calculates the background for one sub-image.
Vector3< double > origin()
int correct_background(long nn, int flag)
Corrects the background for one sub-image.
int images_to_slices()
Changes the 2D images to slices in a 3D image.
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.
int shift_background(double bkg)
Sets the background for each sub-image to a given value.
int slices_to_images()
Changes the slices in a 3D image into a set of 2D images.
General image parameter class.
Utilities for timing functions.
int main(int argc, char **argv)
void fix_type()
Determines the replacement data type.
Bstring symmetry_string()
double timer_start()
Starts timer and prints the time.
Header file for general utilities.
int moments(long max_order)
Prints out moments for all sub-images.
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 subimage_information()
Prints out header information for all sub-images.
int option_kill(Boption *option)
Deallocates a linked list of option structures.
void sampling(long nn, Vector3< double > u)
int subtract_background()
Subtracts the background for each sub-image.
DataType
Base data type specifier.
bool contains(const Bstring &s)
int show_library_versions()
Displaying library versions.
void view(double vx, double vy, double vz, double va)
long statistics()
Calculates the statistics for an image.