 |
Bsoft
2.1.0
Bernard's software package
|
Go to the documentation of this file.
21 "Usage: bcc [options] file.spi file.mrc",
22 "--------------------------------------",
23 "Calculates cross-correlation using fast Fourier transforms.",
26 "-Autocorrelate Auto-correlate, output auto-correlation map.",
27 "-Crosscorrelate file.mrc Cross-correlate with reference file.mrc, output shifted image.",
28 "-Validate file.mrc Cross-correlate and cross-validate with reference file.mrc, output shifted image.",
29 "-Center Find center by cross-correlation with an inverted copy.",
30 "-halfshift Shift correlation map by half the size to put the origin in the middle.",
33 "-verbose 7 Verbosity of output.",
34 "-datatype u Force writing of a new data type.",
35 "-resolution 4.5,130 Resolution range for correlation (default 0 - 1e6 angstrom).",
36 "-origin 0,-10,30 Set origin, used with -size option (default 0,0,0).",
37 "-size 22,33,14 Size for extraction or hkl input (voxels, default from data).",
38 "-sampling 2,3.5,1 Sampling (angstrom/voxel, a single value sets all three).",
39 "-limit 25 Shift search limit in cross-correlation map (voxels, default: quarter of x-dimension).",
43 "-Mask mask.tif Reciprocal space mask to use for cross-correlation.",
46 "-Map ccmap.tif Cross-correlation map.",
51 int main(
int argc,
char **argv)
58 double search_limit(-1);
69 double hires(0), lores(0);
74 for ( curropt = option; curropt; curropt = curropt->
next ) {
75 if ( curropt->
tag ==
"datatype" )
77 if ( curropt->
tag ==
"Autocorrelate" )
79 if ( curropt->
tag ==
"Center" )
81 if ( curropt->
tag ==
"halfshift" ) halfshift = 1;
82 if ( curropt->
tag ==
"resolution" )
83 if ( curropt->
values(hires, lores) < 1 )
84 cerr <<
"-resolution: A high resolution limit must be specified" << endl;
85 if ( curropt->
tag ==
"origin" ) {
86 if ( curropt->
value[0] ==
'c' ) {
89 origin = curropt->
origin();
93 if ( curropt->
tag ==
"sampling" )
94 sam = curropt->
scale();
95 if ( curropt->
tag ==
"limit" )
96 if ( ( search_limit = curropt->
value.
real() ) < 0 )
97 cerr <<
"-limit: A search limit must be specified" << endl;
100 if ( curropt->
tag ==
"Map" )
102 if ( curropt->
tag ==
"Crosscorrelate" )
104 if ( curropt->
tag ==
"Validate" )
106 if ( curropt->
tag ==
"Mask" )
120 if ( ( p =
read_img(argv[optind++], 1, -1) ) == NULL ) {
121 cerr <<
"File not read!" << endl;
140 if ( search_limit < 0 ) search_limit = p->
sizeX()/4.0;
144 double v, ccavg(0), ccstd(0);
147 if ( !pref )
bexit(-1);
156 for ( n=0; n<pcc->
images(); n++ ) {
161 cout <<
"Image\t dx\t dy\t dz\t CC\t P" << endl;
162 for ( n=0; n<p->
images(); n++ ) {
166 cout << n+1 <<
tab << fixed << setprecision(4) <<
173 ccstd -= ccavg*ccavg;
174 if ( ccstd > 1 ) ccstd = sqrt(ccstd);
175 cout <<
"Correlation avg & stdev: " << ccavg <<
tab << ccstd << endl << endl;
179 }
else if ( valfile.
length() ) {
181 if ( !pref )
bexit(-1);
186 for ( n=0; n<pcc->
images(); n++ )
190 cout <<
"Image\t dx\t dy\t dz\t CC\t P" << endl;
191 for ( n=0; n<p->
images(); n++ ) {
192 cout << n+1 <<
tab << fixed << setprecision(4) <<
199 }
else if ( setauto ) {
206 }
else if ( findcenter ) {
207 p->
find_center(pmask, hires, lores, search_limit, 0, 1);
212 if ( pcc && ccfile.
length() ) {
215 cout <<
"DEBUG bcc: writing pcc to " << ccfile << endl;
220 cout <<
"DEBUG bcc: writing pcc->next to " << ccfile << endl;
226 if ( optind < argc ) {
231 if ( p != pcc )
delete pcc;
232 if ( pmask )
delete pmask;
A class for a command line input option.
Vector3< double > scale()
Bimage * cross_correlate(Bimage *p, double hires, double lores, fft_plan planf, fft_plan planb)
Calculates a cross-correlation map by Fast Fourier transformation.
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 find_peak(double radius=1e30, double sigma=0)
Finds the peak in an image to the nearest voxel.
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 * cross_correlate_validate(Bimage *p, Bimage *pmask)
Calculates a masked cross-correlation map by Fast Fourier transformation.
Header file for option handlers.
Vector3< double > origin()
double ccmap_confidence(long nn)
Calculates a confidence level to associate with a cross-correlation peak.
int refine_peak()
Refines the position of a peak to sub-voxel resolution.
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.
int center_wrap()
Centers an image with wrapping.
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)
int main(int argc, char **argv)
void change_type(char letter)
Get the data type indicated by a single letter code.
Header file for 2D and 3D image I/O.
Generalized matrix class.
int option_kill(Boption *option)
Deallocates a linked list of option structures.
void sampling(long nn, Vector3< double > u)
DataType
Base data type specifier.
int auto_correlate(double hires, double lores)
Calculates an autocorrelation map by Fast Fourier transformation.