| Bsoft 2.0.5 Bernard's software package

bproject.cpp
Go to the documentation of this file.
1
9 #include "rwimg.h"
10 #include "matrix_util.h"
11 #include "symmetry.h"
12 #include "ps_views.h"
13 #include "linked_list.h"
14 #include "options.h"
15 #include "utilities.h"
16 #include "timer.h"
17
18 // Declaration of global variables
19 extern int verbose; // Level of output to the screen
20
21 // Function prototypes
22 Matrix img_compare_projections(Bimage* p, double SNR, double hires, double lores, double shift_limit);
23 int img_compare_projections_lowpass(Bimage* p, double SNR, double shift_limit);
24
25 // Usage assistance
26 const char* use[] = {
27 " ",
28 "Usage: bproject [options] input.img output.img",
29 "----------------------------------------------",
30 "Projects a 3D map and calculating comparison statistics of the projections.",
31 "If the input is a 2D image, it is assumed to be projections.",
32 " ",
33 "Actions:",
34 "-axis y,2 Project down a major axis (x, y, z).",
35 " and a flag for minimum (1) or maximum (2).",
36 "-kernel 6,2 Reciprocal space projection: kernel size and power.",
37 "-average 7,5,3 Averaging/smoothing filter before projection: kernel size.",
38 "-rescale -0.1,5.2 Rescale data to average and standard deviation (after -truncate).",
39 "-View 0.3,-0.5,0.8,33 View to generate symmetry-related projections.",
40 "-Tilt -65,72,2.5,55 Tilt series of projections with angle min, max, step and axis angle.",
41 "-side 15 Generate side view projections within the given angle from the equator.",
42 "-compare 0.02,15 Compare projections, with the given SNR imposed and shift limit (default off).",
43 "-random 24 Generate a number of random projections.",
44 "-asu Change to views to fit into the asymmetric unit.",
45 "-edgewidth 80 Gaussian width of edge to background (default 0).",
46 " ",
47 "Parameters:",
48 "-verbose 7 Verbosity of output.",
49 "-datatype u Force writing of a new data type.",
50 "-origin 10,-10,20 Origin for rotation (voxels, default 0,0,0).",
51 "-sampling 2,3.5,1 Sampling (angstrom/voxel, a single value sets all three).",
52 "-resolution 15.6,200 High and low resolution limits (default 0,1e30).",
53 "-fill 127 Fill value for resizing: average (default), background, or value.",
54 "-symmetry D6 Symmetry: Point group identifier.",
55 "-angles 8,6 Step sizes for theta and phi in the asymmetric unit, one value sets both.",
56 "-noinplanerotation No in-plane rotations applied to projections (default applied).",
57 "-nonormalization No normalization applied to projections (default applied).",
58 "-unitcell 10,23,77,90,90,90 Unit cell parameters.",
59 " ",
60 "Output:",
61 "-Plotviews plot.ps Output postscript file with a plot of projection vectors.",
62 "-Matrix cc.dat Projection comparison matrix.",
63 "-Map cc.map Projection comparison matrix in an image.",
64 " ",
65 NULL
66 };
67
68 int main(int argc, char **argv)
69 {
70 // Initialize variables
71 DataType nudatatype(Unknown_Type); // Conversion to new type
72 char axis('n'); // Projection axis
73 int flags(1); // Flags to modify axis-projection
74 int kernel_width(0); // Reciprocal space kernel width
75 int kernel_power(2); // Reciprocal space kernel power
76 Vector3<long> average_kernel; // Average filter kernel size
77 double nuavg(0), nustd(0); // Rescaling to average and stdev
78 Vector3<double> origin; // Origin
79 int set_origin(0); // Flag to set origin
80 Vector3<double> sam; // Units for the three axes (A/pixel)
81 double hires(0), lores(1e30); // High resolution limit
82 Bstring symmetry_string("C1"); // Default: asymmetric or C1 point group
83 double theta_step(0); // Angular step size for theta
84 double phi_step(0); // Angular step size for phi
85 double ang_min(0), ang_max(0), ang_step(0), ang_axis(0); // Tilt series
86 double side_ang(-1); // Side view variation angle
87 double edge_width(0); // Gaussian width of edge
88 int setfill(0);
89 double fill(0);
90 int fill_type(FILL_BACKGROUND); // Fill type for resizing
91 double compare_snr(0); // SNR to compare projections
92 double shift_limit(-1); // Shift limit for projection comparison
93 int lowpass(0); // Flag to do low-pass range comparison
94 int asu(0); // Flag to change views to ASU
95 int nviews(0); // Number of views
96 int spacegroup(0); // Spacegroup
97 UnitCell uc(0,0,0,M_PI_2,M_PI_2,M_PI_2);
98 int view_flag(1); // Flag for projection generation
99 View theview; // View to generate symmetry-related projections
100 int symviews(0); // Flag to generate symmetry-related projections
101 int ps_flag(0); // Flag for postscript output
102 Bstring ps_file;
103 Bstring matrix_file;
104 Bstring map_file;
105
106 int i, optind;
107 Boption* option = get_option_list(use, argc, argv, optind);
108 Boption* curropt;
109 for ( curropt = option; curropt; curropt = curropt->next ) {
110 if ( curropt->tag == "axis" ) {
111 if ( ( axis = curropt->value[0] ) < 'a' )
112 cerr << "-axis: An axis for projection must be specified!" << endl;
113 if ( curropt->value.post(',').length() ) {
114 i = 2 * curropt->value.post(',').integer();
115 flags |= i;
116 }
117 }
118 if ( curropt->tag == "kernel" )
119 if ( curropt->values(kernel_width, kernel_power) < 1 )
120 cerr << "-kernel: At least the kernel size must be specified!" << endl;
121 if ( curropt->tag == "average" ) {
122 if ( ( i = curropt->values(average_kernel[0],
123 average_kernel[1], average_kernel[2]) ) < 1 )
124 cerr << "-average: The kernel edge size must be specified!" << endl;
125 else
126 if ( i < 2 ) average_kernel[2] = average_kernel[1] = average_kernel[0];
127 }
128 if ( curropt->tag == "rescale" )
129 if ( curropt->values(nuavg, nustd) < 2 )
130 cerr << "-rescale: Both average and standard deviation must be specified!" << endl;
131 if ( curropt->tag == "datatype" )
132 nudatatype = curropt->datatype();
133 if ( curropt->tag == "origin" ) {
134 if ( curropt->value[0] == 'c' ) {
135 set_origin = 2;
136 } else {
137 origin = curropt->origin();
138 set_origin = 1;
139 }
140 }
141 if ( curropt->tag == "sampling" )
142 sam = curropt->sampling();
143 if ( curropt->tag == "resolution" )
144 if ( curropt->values(hires, lores) < 1 )
145 cerr << "-resolution: A resolution limit must be specified!" << endl;
146 if ( curropt->tag == "fill" ) {
147 if ( ! ( fill = curropt->value.real() ) )
148 cerr << "-fill: A fill value must be specified!" << endl;
149 else
150 setfill = 1;
151 }
152 if ( curropt->tag == "compare" )
153 if ( curropt->values(compare_snr, shift_limit, lowpass) < 1 )
154 cerr << "-compare: A SNR value must be specified!" << endl;
155 if ( curropt->tag == "asu" )
156 asu = 1;
157 if ( curropt->tag == "edgewidth" )
158 if ( ( edge_width = curropt->value.real() ) < 0.001 )
159 cerr << "-edgewidth: An edge width must be specified!" << endl;
160 if ( curropt->tag == "random" )
161 if ( ( nviews = curropt->value.integer() ) < 1 )
162 cerr << "-random: A number of views must be specified!" << endl;
163 if ( curropt->tag == "symmetry" )
164 symmetry_string = curropt->symmetry_string();
165 if ( curropt->tag == "angles" ) {
166 if ( ( i = curropt->values(theta_step, phi_step) ) < 1 )
167 cerr << "-angles: An angle step size must be specified!" << endl;
168 else {
169 theta_step *= M_PI/180.0;
170 if ( i < 2 ) phi_step = theta_step;
171 else phi_step *= M_PI/180.0;
172 }
173 }
174 if ( curropt->tag == "unitcell" )
175 uc = curropt->unit_cell();
176 if ( curropt->tag == "noinplanerotation" )
177 view_flag |= 2;
178 if ( curropt->tag == "nonormalization" )
179 view_flag |= 4;
180 if ( curropt->tag == "View" ) {
181 theview = curropt->view();
182 symviews = ps_flag = 1;
183 }
184 if ( curropt->tag == "Tilt" ) {
185 if ( curropt->values(ang_min, ang_max, ang_step, ang_axis) < 3 )
186 cerr << "-Tilt: Three angles must be specified!" << endl;
187 else {
188 ang_min *= M_PI/180.0;
189 ang_max *= M_PI/180.0;
190 ang_step *= M_PI/180.0;
191 ang_axis *= M_PI/180.0;
192 }
193 }
194 if ( curropt->tag == "side" ) {
195 if ( ( side_ang = curropt->value.real() ) < 0.001 )
196 cerr << "-side: One angle must be specified!" << endl;
197 else
198 side_ang *= M_PI/180.0;
199 }
200 if ( curropt->tag == "Plotviews" )
201 ps_file = curropt->filename();
202 if ( curropt->tag == "Matrix" )
203 matrix_file = curropt->filename();
204 if ( curropt->tag == "Map" )
205 map_file = curropt->filename();
206 }
207 option_kill(option);
208
209 double ti = timer_start();
210
211 #ifdef HAVE_GCD
212 fftwf_init_threads();
213 // fftwf_plan_with_nthreads(system_processors());
214 #endif
215 if ( verbose )
216 cout << "Number of threads: " << system_processors() << endl;
217
218 Bsymmetry* sym = init_point_group_symmetry(symmetry_string);
219 View* views = NULL;
220
221 if ( axis == 'n' ) {
222 if ( nviews ) {
223 views = random_views(nviews);
224 } else if ( side_ang > -1 ) {
225 views = side_views(sym, side_ang, theta_step, phi_step);
226 } else if ( ang_step ) {
227 views = tilt_views(ang_min, ang_max, ang_step, ang_axis);
228 } else if ( symviews ) {
229 views = symmetry_get_all_views(sym, theview);
230 } else if ( theta_step && phi_step ) {
231 views = asymmetric_unit_views(sym, theta_step, phi_step, view_flag);
232 ps_flag = 1;
233 }
234 if ( views ) {
235 nviews = count_list((char *) views);
236 if ( verbose )
237 cout << "Generating " << nviews << " projections" <<endl << endl;
238 if ( asu ) change_views_to_asymmetric_unit(sym, views);
239 if ( ps_file.length() )
240 ps_views(ps_file, symmetry_string, views, ps_flag);
241 }
242 } else if ( axis == 'z' ) {
243 views = new View(0,0,1,0);
244 } else if ( axis == 'y' ) {
245 views = new View(0,1,0,0);
246 } else if ( axis == 'x' ) {
247 views = new View(1,0,0,0);
248 }
249
250 kill_symmetry(sym);
251
252 if ( optind >= argc ) {
253 if ( views ) kill_list((char *) views, sizeof(View));
254 bexit(0);
255 }
256
257 FSI_Kernel* kernel = NULL;
258 if ( kernel_width > 1 )
259 kernel = new FSI_Kernel(kernel_width, kernel_power);
260
261 // Read image file
262 int dataflag(0);
263 if ( optind < argc - 1 ) dataflag = 1;
264 if ( compare_snr ) dataflag = 1;
265
266 Bimage* p = read_img(argv[optind++], dataflag, -1);
267 if ( p == NULL ) bexit(-1);
268
269 if ( nudatatype == Unknown_Type )
270 nudatatype = p->data_type(); // Preserve the old type
271
272 if ( spacegroup ) p->space_group(spacegroup);
273
274 if ( sam.volume() ) p->sampling(sam);
275
276 if ( set_origin ) {
277 if ( set_origin == 2 ) p->origin(p->size()/2);
278 else p->origin(origin);
279 }
280
281 p->calculate_background();
282 if ( setfill ) p->background(fill);
283
284 if ( uc.check() ) p->unit_cell(uc);
285
286 if ( average_kernel[0] > 0 ) p->filter_average(average_kernel);
287
288 Bimage* proj = p;
289 if ( axis != 'n' ) {
290 proj = p->project(axis, flags);
291 } else if ( p->sizeZ() > 1 && views ) {
292 if ( kernel )
293 proj = p->project(views, hires, kernel);
294 else
295 proj = p->project(views, !(view_flag&4));
296 }
297
298 if ( views ) kill_list((char *) views, sizeof(View));
299
300 Vector3<long> size((int)(proj->sizeX() - 2*edge_width),
301 (int)(proj->sizeY() - 2*edge_width), (int)(proj->sizeZ() - 2*edge_width));
302 origin[0] = origin[1] = origin[2] = edge_width;
303 if ( edge_width ) proj->edge(1, size, origin, edge_width, fill_type, fill);
304
305 if ( nustd > 0 ) proj->rescale_to_avg_std(nuavg, nustd);
306
307 Matrix cc;
308 Bimage* pmat;
309 if ( compare_snr > 0 ) {
310 if ( lowpass ) {
311 img_compare_projections_lowpass(proj, compare_snr, shift_limit);
312 } else {
313 cc = img_compare_projections(proj, compare_snr, hires, lores, shift_limit);
314 if ( matrix_file.length() ) cc.write(matrix_file);
315 if ( map_file.length() ) {
316 pmat = img_from_matrix(cc, 1);
317 pmat->label(get_cmd_line(argc, argv));
318 write_img(map_file, pmat, 0);
319 delete pmat;
320 }
321 }
322 }
323
324 if ( optind < argc ) {
325 proj->change_type(nudatatype);
326 proj->label(get_cmd_line(argc, argv));
327 write_img(argv[optind], proj, 0);
328 }
329
330 if ( p != proj ) delete p;
331 delete proj;
332 if ( kernel ) delete kernel;
333
334 #ifdef HAVE_GCD
335 fftwf_cleanup_threads();
336 #endif
337
338 if ( verbose & VERB_TIME )
339 timer_report(ti);
340
341 bexit(0);
342 }
343
344 /*
345 Compares all test images against one reference projection (i)
346 */
347 double img_compare_one_projection(Bimage* p, Bimage* pref, long i,
348 double hires, double lores, double radius, double sigma,
349 Matrix* cc, fft_plan planf, fft_plan planb)
350 {
351 long j;
352 double cc1(0);
353 Bimage* px;
354
355 Bimage* prefx = pref->extract(i);
356
357 for ( j=0; j<p->images(); j++ ) {
358 px = p->extract(j);
359 px->find_shift(prefx, NULL, hires, lores, radius, sigma, 0, planf, planb, cc1);
360 (*cc)[i][j] = cc1;
361 // cc[j] = (px->image->origin() - prefx->image->origin()).length();
362 // cout << "Shift: " << (px->image->origin() - prefx->image->origin()).length() << endl;
363 delete px;
364 }
365
366 delete prefx;
367
368 return 0;
369 }
370
371 Matrix* img_compare_projections_driver(Bimage* p, double SNR, double hires, double lores, double shift_limit)
372 {
373 if ( lores <= 0 ) lores = 1e30;
374 if ( hires < p->sampling()[0] ) hires = p->sampling()[0];
375 if ( hires > lores ) swap(hires, lores);
376 if ( shift_limit < 0 ) shift_limit = 1e30;
377
378 p->change_type(Float);
379
380 Bimage* pt = p->copy();
381
382 if ( SNR < 101 ) pt->noise_gaussian(0, pt->standard_deviation()/sqrt(SNR));
383
384 // write_img("pt.pif", pt);
385
386 long n(p->images());
387 double sigma(0);
388
389 Matrix* cc = new Matrix(n, n);
390
391 fft_plan planf = p->fft_setup(FFTW_FORWARD, 1);
392 fft_plan planb = p->fft_setup(FFTW_BACKWARD, 1);
393
394 #ifdef HAVE_GCD
395 dispatch_apply(n, dispatch_get_global_queue(0, 0), ^(size_t i){
396 img_compare_one_projection(pt, p, i, hires, lores, shift_limit, sigma, cc, planf, planb);
397 });
398 #else
399 #pragma omp parallel for
400 for ( long i=0; i<n; i++ )
401 img_compare_one_projection(pt, p, i, hires, lores, shift_limit, sigma, cc, planf, planb);
402 #endif
403
404 fft_destroy_plan(planf);
405 fft_destroy_plan(planb);
406
407 delete pt;
408
409 return cc;
410 }
411
412
422 Matrix img_compare_projections(Bimage* p, double SNR, double hires, double lores, double shift_limit)
423 {
424 Matrix* ccp = img_compare_projections_driver(p, SNR, hires, lores, shift_limit);
425 Matrix cc = *ccp;
426
427 long i, j, m, n(p->images()), nw(0), im;
428 double ccmax(0), ccmax1, ccavg(0), ccstd(0);
429
430 if ( verbose & VERB_FULL )
431 cout << "Image1\tImage2\tCC" << endl;
432 for ( j=0; j<n; ++j ) {
433 im = 0;
434 ccmax1 = -1;
435 for ( i=0; i<n; ++i ) {
436 if ( ccmax1 < cc[i][j] ) {
437 ccmax1 = cc[i][j];
438 im = i;
439 }
440 if ( i == j ) ccmax += cc[i][j];
441 else {
442 ccavg += cc[i][j];
443 ccstd += cc[i][j]*cc[i][j];
444 }
445 if ( verbose & VERB_FULL )
446 cout << setprecision(5) << i << tab << j << tab << cc[i][j] << endl;
447 }
448 if ( j != im ) nw++;
449 if ( verbose )
450 cout << j << tab << im << tab << ccmax1 << endl;
451 }
452
453 m = n*(n-1);
454 ccmax /= n;
455 ccavg /= m;
456 ccstd = ccstd/m - ccavg * ccavg;
457 if ( ccstd > 0 ) ccstd = sqrt(ccstd);
458 else ccstd = 0;
459
460 if ( verbose ) {
461 cout << "Correlating all projections:" << endl;
462 cout << "Imposed SNR: " << SNR << endl;
463 cout << "Resolution limits: " << hires << " " << lores << endl;
464 cout << "Shift limit: " << shift_limit << endl;
465 cout << "CC maximum: " << ccmax << endl;
466 cout << "CC average: " << ccavg << endl;
467 cout << "CC standard deviation: " << ccstd << endl;
468 cout << "Fraction incorrect: " << nw*1.0/n << endl;
469 cout << "Relative maximum sigma units: " << (ccmax - ccavg)/ccstd << endl;
470 cout << "Fisher's z-transform: " << fishers_z_transform(ccmax) << endl;
471 if ( verbose & VERB_PROCESS )
472 cout << cc << endl;
473 }
474
475 return cc;
476 }
477
485 int img_compare_projections_lowpass(Bimage* p, double SNR, double shift_limit)
486 {
487
488 unsigned long i, j, k, m, n(p->images());
489 double hires, lores(p->real_size()[0]);
490 double ccmax, ccavg, ccstd, cct;
491 Matrix* ccp;
492 Matrix cc;
493
494 if ( verbose )
495 cout << "ResLim\tk\tCCmax\tCCavg\tCCstd\tCCth" << endl;
496 for ( hires = p->sampling()[0]; hires < lores; hires *= 2 ) {
497 ccp = img_compare_projections_driver(p, SNR, hires, lores, shift_limit);
498 cc = *ccp;
499
500 ccmax = ccavg = ccstd = 0;
501 for ( m=i=0; i<n; i++ ) {
502 for ( j=0; j<n; j++, m++ ) {
503 if ( i == j ) ccmax += cc[i][j];
504 else {
505 ccavg += cc[i][j];
506 ccstd += cc[i][j]*cc[i][j];
507 }
508 if ( verbose & VERB_FULL )
509 cout << setprecision(5) << i << tab << j << tab << cc[i][j] << endl;
510 }
511 }
512
513 m -= n;
514 ccmax /= n;
515 ccavg /= m;
516 ccstd = ccstd/m - ccavg * ccavg;
517 if ( ccstd > 0 ) ccstd = sqrt(ccstd);
518 else ccstd = 0;
519
520 k = (unsigned long) (p->real_size()[0]/hires);
521 cct = p->sampling()[0]/hires;
522 cct *= M_PI*cct;
523 if ( cct > 1 ) cct = 1;
524 cct = sqrt(SNR/(SNR + cct));
525
526 delete ccp;
527
528 if ( verbose )
529 cout << hires << tab << k << tab << ccmax << tab << ccavg << tab << ccstd << tab << cct << endl;
530 }
531
532 return 0;
533 }
Bimage::change_type
void change_type(char letter)
Get the data type indicated by a single letter code.
Definition: Bimage.cpp:1743
Boption::unit_cell
UnitCell unit_cell()
Definition: options.h:291
M_PI_2
#define M_PI_2
Definition: utilities.h:62
UnitCell
Definition: UnitCell.h:22
Bstring::real
double real()
Definition: Bstring.cpp:545
FILL_BACKGROUND
#define FILL_BACKGROUND
Definition: utilities.h:174
Bstring::post
Bstring post(char c)
Definition: Bstring.cpp:394
DataType
DataType
Base data type specifier.
Definition: utilities.h:146
Bimage::sampling
Vector3< double > sampling()
Definition: Bimage.h:505
img_compare_projections_driver
Matrix * img_compare_projections_driver(Bimage *p, double SNR, double hires, double lores, double shift_limit)
Definition: bproject.cpp:371
Boption::symmetry_string
Bstring symmetry_string()
Definition: options.h:245
planb
fft_plan planb
Definition: bico.cpp:24
verbose
int verbose
symmetry.h
Header file for general symmetry functions.
utilities.h
Header file for general utilities.
Boption::sampling
Vector3< double > sampling()
Definition: options.h:202
Boption::value
Bstring value
Definition: options.h:30
Boption::tag
Bstring tag
Definition: options.h:29
system_processors
size_t system_processors()
Returns the number of processors.
Definition: utilities.cpp:186
planf
fft_plan planf
Definition: bico.cpp:24
kill_list
long kill_list(char *list, unsigned long size)
Frees all the items in a linked list.
Definition: linked_list.cpp:214
Bimage::edge
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.
Definition: Bimage_edit.cpp:319
Bstring::length
long length() const
Definition: Bstring.cpp:263
count_list
long count_list(char *list)
Counts the number of items in a linked list.
Definition: linked_list.cpp:235
kill_symmetry
int kill_symmetry(Bsymmetry *sym)
Deallocates a symmetry structure.
Definition: symmetry.cpp:207
VERB_PROCESS
#define VERB_PROCESS
Definition: utilities.h:107
img_compare_projections
Matrix img_compare_projections(Bimage *p, double SNR, double hires, double lores, double shift_limit)
Compares a set of projections from a 3D density map.
Definition: bproject.cpp:422
FSI_Kernel
Definition: FSI_Kernel.h:14
img_compare_projections_lowpass
int img_compare_projections_lowpass(Bimage *p, double SNR, double shift_limit)
Compares a set of projections from a 3D density map.
Definition: bproject.cpp:485
get_option_list
Boption * get_option_list(const char *use[], int argc, char *argv[], int &optind)
Parses command line arguments based on a template.
Definition: options.cpp:40
read_img
Bimage * read_img(char *filename, int readdata, int img_select)
General driver function to read multiple image formats.
Definition: rwimg.cpp:76
get_cmd_line
string get_cmd_line(int argc, char **argv)
Returns the command line as a string.
Definition: utilities.cpp:36
Boption::filename
Bstring filename()
Definition: options.h:85
random_views
View * random_views(int nviews)
Calculates a set of random views.
Definition: View.cpp:147
Bimage::noise_gaussian
int noise_gaussian(double ravg=0, double rstd=1)
Generates an image with a gaussian random distribution of densities.
Definition: Bimage_noise.cpp:72
timer.h
Utilities for timing functions.
Float
Definition: utilities.h:157
Bimage
General image parameter class.
Definition: Bimage.h:163
Bimage::real_size
Vector3< double > real_size()
Definition: Bimage.h:487
tilt_views
View * tilt_views(double ang_min, double ang_max, double ang_step, double axis)
Initializes a set of views tilted around the y axis.
Definition: View.cpp:70
matrix_util.h
Utility functions for matrices.
M_PI
#define M_PI
Definition: utilities.h:59
linked_list.h
Header file for generalized linked list functions.
Bimage::extract
Bimage * extract(long nn)
Extracts one sub-image into new image structure.
Definition: Bimage_extract.cpp:21
side_views
View * side_views(Bsymmetry *sym, double side_ang, double theta_step, double phi_step)
Initializes a set of views around the z-axis for helical projection.
Definition: symmetry.cpp:769
Bimage::filter_average
int filter_average(long kernel_size)
Applies an averaging filter to an image.
Definition: Bimage_filter.cpp:208
Boption::view
View view()
Definition: options.h:259
ps_views
int ps_views(Bstring &filename, Bstring &symmetry_string, View *view, int flags)
Generates postscript plot of views on the unit sphere.
Definition: ps_views.cpp:34
Boption
A class for a command line input option.
Definition: options.h:26
Bimage::label
void label(string s)
Definition: Bimage.h:235
VERB_TIME
#define VERB_TIME
Definition: utilities.h:110
fft_plan
fftwf_plan fft_plan
Definition: fft.h:16
Bimage::rescale_to_avg_std
int rescale_to_avg_std(double nuavg, double nustd)
Rescales the image data to a given average and standard deviation.
Definition: Bimage_rescale.cpp:163
init_point_group_symmetry
Bsymmetry * init_point_group_symmetry(Bstring symmetry_string)
Sets up a symmetry structure from a string identifier.
Definition: symmetry.cpp:39
Bimage::unit_cell
void unit_cell(UnitCell uc)
Definition: Bimage.h:601
main
int main(int argc, char **argv)
Definition: bproject.cpp:68
Bimage::project
Bimage * project(char axis, int flags=1)
Projects a 3D image to a 2D image down one of the three major axes.
Definition: Bimage_project.cpp:31
asymmetric_unit_views
View * asymmetric_unit_views(Bsymmetry *sym, double theta_step, double phi_step, int flag)
Initializes a well-distributed set of views in an asymmetric unit.
Definition: symmetry.cpp:570
change_views_to_asymmetric_unit
int change_views_to_asymmetric_unit(Bsymmetry *sym, View *view)
Change the views to those in the asymmetric unit.
Definition: symmetry.cpp:834
write_img
int write_img(const char *filename, Bimage *p, int compression)
General driver function to write multiple image formats.
Definition: rwimg.cpp:280
Bimage::size
Vector3< long > size() const
Definition: Bimage.h:373
Bimage::calculate_background
int calculate_background(long nn, int flag)
Calculates the background for one sub-image.
Definition: Bimage_background.cpp:27
Bimage::standard_deviation
double standard_deviation()
Definition: Bimage.h:537
Bimage::space_group
long space_group()
Definition: Bimage.h:591
Bsymmetry
Definition: symmetry.h:38
img_from_matrix
Bimage * img_from_matrix(Matrix &matrix, long scale)
Converts a matrix to an image.
Definition: matrix_util.cpp:298
Boption::datatype
DataType datatype()
Definition: options.h:93
Boption::next
Boption * next
Definition: options.h:28
Matrix
Definition: Matrix.h:21
Bstring
Definition: Bstring.h:29
use
const char * use[]
Definition: bproject.cpp:26
Bimage::copy
Bimage * copy()
Copies the header information and data of an image into a new image structure.
Definition: Bimage.cpp:2695
Bimage::sizeX
void sizeX(long nx)
Definition: Bimage.h:377
Bimage::fft_setup
fft_plan fft_setup(fft_direction dir, int opt=0)
Sets up a plan for fast Fourier transforms.
Definition: Bimage_fft.cpp:29
Matrix::write
void write(Bstring &filename)
Definition: Matrix.h:95
Bimage::sizeZ
void sizeZ(long nz)
Definition: Bimage.h:379
Vector3< long >
fft_destroy_plan
int fft_destroy_plan(fft_plan plan)
Deallocates a plan for fast Fourier transforms.
Definition: fft.cpp:87
Boption::origin
Vector3< double > origin()
Definition: options.h:180
timer_report
double timer_report(double lasttime)
Reports the time elapsed since a given time.
Definition: timer.cpp:67
fishers_z_transform
double fishers_z_transform(double value)
Calculates Fisher's z-transform.
Definition: math_util.cpp:249
View
Definition: View.h:26
img_compare_one_projection
double img_compare_one_projection(Bimage *p, Bimage *pref, long i, double hires, double lores, double radius, double sigma, Matrix *cc, fft_plan planf, fft_plan planb)
Definition: bproject.cpp:347
Bimage::find_shift
int find_shift(Bimage *pref, Bimage *pmask, double hires, double lores, double radius, double sigma, int refine_flag)
Calculates a cross-correlation map to find the shift for the pair of images.
Definition: Bimage_correlate.cpp:932
option_kill
int option_kill(Boption *option)
Deallocates a linked list of option structures.
Definition: options.cpp:109
Bstring::integer
long integer()
Definition: Bstring.cpp:539
Unknown_Type
Definition: utilities.h:147
rwimg.h
Header file for 2D and 3D image I/O.
options.h
Header file for option handlers.
kernel
Definition: kernlut.h:13
UnitCell::check
bool check()
Definition: UnitCell.h:34
Bimage::images
long images()
Definition: Bimage.h:491
ps_views.h
Header file for postscript tools dealing with views.
Vector3::volume
double volume()
Definition: Vector3.h:235
VERB_FULL
#define VERB_FULL
Definition: utilities.h:109
Bimage::background
double background(long nn)
Definition: Bimage.h:542
Bimage::sizeY
void sizeY(long ny)
Definition: Bimage.h:378
Bimage::data_type
DataType data_type()
Definition: Bimage.h:349
Boption::values
long values(T1 &v1, T2 &v2)
Definition: options.h:115
bexit
int bexit(int value)
Exit function for cleanup and debugging.
Definition: utilities.cpp:273
timer_start
double timer_start()
Starts timer and prints the time.
Definition: timer.cpp:52
symmetry_get_all_views
View * symmetry_get_all_views(Bsymmetry *sym, View asu_view)
Get all symmetry-related views of one given view.
Definition: symmetry.cpp:448
tab
ostream & tab(ostream &out)
Definition: utilities.cpp:21
Bimage::origin
void origin(double ox, double oy, double oz)
Definition: Bimage.h:563