 |
Bsoft
2.1.0
Bernard's software package
|
Go to the documentation of this file.
20 "Usage: bphase [options] file1.img file2.img outfile.img",
21 "-------------------------------------------------------",
22 "Calculates the phase difference between two images.",
25 "-cosine Calculate the cosine of the phase angle difference.",
26 "-amplitude Weight the phase difference with the amplitude product.",
27 "-center Center phase difference map and output it.",
28 "-flip Flip phases based on phase difference map and modify second image.",
31 "-verbose 7 Verbosity of output.",
32 "-datatype short Force writing of a new data type (default float).",
33 "-origin 0.8,-10,15.7 Set the origin of both images (default from input images).",
34 "-resolution 4.5,130 Resolution (default 0 - 10000 angstrom).",
39 int main(
int argc,
char* argv[])
48 double hires(0), lores(1e4);
53 for ( curropt = option; curropt; curropt = curropt->
next ) {
54 if ( curropt->
tag ==
"cosine" ) pd_type |= 1;
55 if ( curropt->
tag ==
"amplitude" ) pd_type |= 2;
56 if ( curropt->
tag ==
"center" ) center = 1;
57 if ( curropt->
tag ==
"flip" ) flip = 1;
58 if ( curropt->
tag ==
"datatype" )
60 if ( curropt->
tag ==
"origin" ) {
61 if ( curropt->
value[0] ==
'c' ) {
64 origin = curropt->
origin();
68 if ( curropt->
tag ==
"resolution" )
69 if ( curropt->
values(hires, lores) < 1 )
70 cerr <<
"-resolution: A high resolution limit must be specified" << endl;
77 if ( optind < argc - 1 ) dataflag = 1;
80 cerr <<
"Error: No first input file read!" << endl;
84 cerr <<
"Error: Data missing from image " << p1->
file_name() << endl;
90 cerr <<
"Error: No second input file read!" << endl;
94 cerr <<
"Error: Data missing from image " << p2->
file_name() << endl;
101 if ( set_origin == 2 ) {
123 if ( optind < argc ) {
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.
Vector3< long > size() const
Bimage * phase_difference(Bimage *p, int type=0, double res_hi=0, double res_lo=0)
Calculates the cosine of the phase difference between two images.
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.
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 center_wrap()
Centers an image with wrapping.
int main(int argc, char *argv[])
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.
unsigned char * data_pointer()
int phase_flip(Bimage *pd)
Flips the phases of an image based on a phase difference map.
DataType
Base data type specifier.
bool check_if_same_size(Bimage *p)
Check if two images are the same size.