| Bsoft 2.0.5 Bernard's software package

dimgstats.cpp
Go to the documentation of this file.
1
9 #include "Bstring.h"
10 #include "rwimg.h"
11 #include "img_combine.h"
12 #include "math_util.h"
13 #include "utilities.h"
14 #include "options.h"
15 #include "timer.h"
16 #include "Vector3.h"
17
18 // Declaration of global variables
19 extern int verbose; // Level of output to the screen
20
21 // Function prototypes
22 int img_fom_sqrt(Bimage* p);
23 Bimage* img_students_t_test(int n, Bimage* p, vector<double>& weight);
24 Bimage* img_students_t_test_equal(int set1, int set2, Bimage* p1, Bimage* p2, vector<double>& weight);
25 Bimage* img_students_t_test_unequal(int set1, int set2, Bimage* p1, Bimage* p2, vector<double>& weight);
26 Bimage* img_f_test(int set1, int set2, Bimage* p1, Bimage* p2, vector<double>& weight);
27
28 // Usage assistence
29 const char* use[] = {
30 " ",
31 "Usage: dimgstats [options] input.images",
32 "---------------------------------------",
33 "Calculates statistical measures within a set of images or between sets of images.",
34 "Corresponding pixels are compared--i.e. pixel m in image 1 is compared to pixel m",
35 "in image 2.",
36 " ",
37 "Definitions: ",
38 " Variance var = Sum[ (rho - avg_rho)(rho - avg_rho) ] / (n - 1)",
39 " numerator portion Vn = Sum[ (rho - avg_rho)(rho - avg_rho) ]",
40 " Standard deviation std = sqrt( var )",
41 " Student's t-test (t) SD = sqrt[(Vn1 + Vn2)(1/m + 1/n) / (m + n - 2) ]",
42 " approx. equal var t = ( avg1 - avg2 ) / SD",
43 " unequal var t = ( avg1 - avg2 ) / sqrt[ var1/m + var2/n ]",
44 " F-test F = var1 / var2",
45 "avg = average (mean), m = number of data points in set 1, n = number in set 2,",
46 "rho = value of a given pixel at a given (x,y,z) coordinate",
47 "SD = standard error of the difference of the means, sqrt = square root",
48 "Sum = summation of.",
49 " ",
50 "See Milligan and Flicker (1987) J. Cell Biol. 105:29-39 for a reference",
51 "to the use of the Student's t-test in 3D electron microscopy.",
52 " ",
53 "Any number of input images may be given and may include the wild card \"*\".",
54 "(However, VMS does not support Unix style usage of wild cards)",
55 "All images are converted to floating point.",
56 " ",
57 "Actions:",
58 "-Ttest equal Do a Student's t-test to compare two sets (equal/unequal).",
59 "-Ftest Do a F-test to compare two sets.",
60 "-average Compute an average image for each set.",
61 "-stdev Compute a standard deviation image for each set.",
62 "-variance Compute a variance image for each set.",
63 "-significance Compute significance-level (probability) image.",
64 "-rescale -0.1,5.2 Rescale input images to average, standard deviation.",
65 " ",
66 "Parameters:",
67 "-datatype u Force writing of a new data type",
68 "-sampling 1.5,1.5,1.5 Sampling (A/pixel; a single value can be given).",
69 "-sets 10,12 Number of input files in each set (default = single set).",
70 "-verbose 7 Verbosity of output",
71 "-weights 0.1,0.3,0.9 Weights for input files (default 1 for every file)",
72 " ",
73 "Output:",
74 "-output name.img base name for output image(s), suffix added based on action",
75 " ",
76 NULL
77 };
78
79
80
81 int main(int argc, char **argv)
82 {
83 // Initialize variables
84 Bstring filebase; // Output file base name
85 Bstring* file_list = NULL; // List of file names for first and second sets
86 Bstring* file_list2 = NULL; // List of file names for second set
87 Bstring outfile; // Name of output file
88 Bstring weight_string; // input weights
89
90 int avgflag(0); // Flag to output average image
91 int avgvar(0); // Flag indicating that average and variance need to be calculated
92 int fflag(0); // Flag for F-test
93 int nfiles; // Number of files entered
94 int set1(0), set2(0); // Number of images in sets 1 and 2, for Student's t-test image
95 int setweight(0); // Weight flag, default weights are 1
96 int signif(0); // Flag to calculate significance-level image
97 int stdev(0); // Flag to calculate and output standard deviation
98 int sttflag[2] = {0,0}; // Flags for Student's t-test equal or unequal variance
99 int variance(0); // Flag to output variance
100
101 double nuavg(0), nustd(0); // Average and standard deviation for rescaling
102 vector<double> weight, weight2; // Weights for each image file (default = 1)
103
104 DataType nudatatype(Unknown_Type); // Conversion to new data type
105 Bimage *p1 = NULL, *p2 = NULL; // Average images for sets 1 and 2
106 long i; // Index
107 Vector3<double> sam; // Units for the three axes (A/pixel)
108
109
110 // Command-line options
111 int optind;
112 Boption* option = get_option_list(use, argc, argv, optind);
113 Boption* curropt;
114 for ( curropt = option; curropt; curropt = curropt->next ) {
115 if ( curropt->tag == "Ttest" ) {
116 avgvar = 1;
117 if ( curropt->value[0] == 'e' ) sttflag[0] = 1;
118 if ( curropt->value[0] == 'u' ) sttflag[1] = 1;
119 }
120 if ( curropt->tag == "Ftest" ) {
121 fflag = 1; avgvar = 1;
122 }
123 if ( curropt->tag == "average" ) {
124 avgflag = 1; avgvar = 1;
125 }
126 if ( curropt->tag == "stdev" ) {
127 stdev = 1; avgvar = 1;
128 }
129 if ( curropt->tag == "variance" ) {
130 variance = 1; avgvar = 1;
131 }
132 if ( curropt->tag == "significance" )
133 signif = 1;
134 if ( curropt->tag == "rescale" )
135 if ( curropt->values(nuavg, nustd) < 2 )
136 cerr << "-rescale: Both average and standard deviation must be specified" << endl;
137 if ( curropt->tag == "datatype" )
138 nudatatype = curropt->datatype();
139 if ( curropt->tag == "sampling" )
140 sam = curropt->sampling();
141 if ( curropt->tag == "sets" ) {
142 if ( curropt->values(set1, set2) < 2 )
143 cerr << "-sets: Two integers must be specified" << endl;
144 else if ( set1<=0 || set2<=0 )
145 cerr << "-sets: Each set must have at least one member." << endl;
146 }
147 if ( curropt->tag == "weights" ) {
148 weight_string = curropt->value;
149 if ( weight_string.length() < 1 )
150 cerr << "-weights: Weights for all files must be specified" << endl;
151 else
152 setweight = 1;
153 }
154 if ( curropt->tag == "output" )
155 filebase = curropt->filename();
156 }
157 option_kill(option);
158
159 double ti = timer_start();
160
161 if ( optind >= argc ) {
162 cerr << "No input files!" << endl;
163 bexit(-1);
164 }
165 if ( (sttflag[0] || sttflag[1] || fflag) && (set1 == 0) ) {
166 cerr << "You must designate two image sets (option \"-sets\") for the t-test or F-test!" << endl;
167 bexit(-1);
168 }
169
170
171 // Set up image file names
172 nfiles = 0;
173 while ( optind < argc ) {
174 if ( !set1 || ( set1 && nfiles < set1 ) )
175 string_add(&file_list, argv[optind++]);
176 else
177 string_add(&file_list2, argv[optind++]);
178 nfiles++;
179 }
180
181 if ( set1 < 1 && set2 < 1 ) // If set option unused, assume only one set
182 set1 = nfiles;
183 else // If two sets, check that number of files and numbers for sets are in agreement
184 if ( (set1+set2) != nfiles ) {
185 cerr << "The number of files (" << nfiles << ") does not agree with the numbers designated for sets 1 ("
186 << set1 << ") and 2 (" << set2 << ")." << endl;
187 bexit(-1);
188 }
189
190 // Set weights for each input file, default is 1.0
191 i = 0;
192 if ( setweight ) {
193 weight = weight_string.split_into_doubles(",");
194 if ( weight.size() < nfiles ) {
195 cerr << "Error: The number of weights must be equal to the number of input files" << endl;
196 bexit(-1);
197 }
198 } else {
199 for ( i=0; i<nfiles; i++ ) weight.push_back(1.0);
200 }
201
202 if ( set2 )
203 for ( i=set1; i<nfiles; i++ ) weight2.push_back(weight[i]);
204
205 // Compute average and variance images
206 if ( avgvar ) {
207 p1 = img_add_weighed(file_list, weight, nuavg, nustd, 3);
208 if ( set2 )
209 p2 = img_add_weighed(file_list2, weight2, nuavg, nustd, 3);
210
211 if ( filebase.length() ) { // write image(s) to file
212 if ( sam.volume() > 0 ) {
213 p1->sampling(sam);
214 p2->sampling(sam);
215 }
216 p1->change_type(nudatatype);
217 p1->label(get_cmd_line(argc, argv));
218 if ( p2 ) {
219 p2->change_type(nudatatype);
220 p2->label(get_cmd_line(argc, argv));
221 }
222 if ( avgflag ) {
223 if ( set2 )
224 outfile = filebase.pre_rev('.') + "_avg1." + filebase.post_rev('.');
225 else
226 outfile = filebase.pre_rev('.') + "_avg." + filebase.post_rev('.');
227 write_img(outfile, p1, 0);
228 if ( p2 ) {
229 outfile = filebase.pre_rev('.') + "_avg2." + filebase.post_rev('.');
230 write_img(outfile, p2, 0);
231 }
232 }
233 if ( variance ) {
234 if ( set2 )
235 outfile = filebase.pre_rev('.') + "_var1." + filebase.post_rev('.');
236 else
237 outfile = filebase.pre_rev('.') + "_var." + filebase.post_rev('.');
238 write_img(outfile, p1->next, 0);
239 if ( p2 ) {
240 outfile = filebase.pre_rev('.') + "_var2." + filebase.post_rev('.');
241 write_img(outfile, p2->next, 0);
242 }
243 }
244 }
245 }
246
247 string_kill(file_list);
248
249 // F-test image
250 if ( fflag ) {
251
252 Bimage* pf = img_f_test(set1, set2, p1, p2, weight);
253
254 if ( filebase.length() ) {
255 outfile = filebase.pre_rev('.') + "_ftest." + filebase.post_rev('.');
256 if ( sam.volume() > 0 ) pf->sampling(sam);
257 pf->change_type(nudatatype);
258 pf->label(get_cmd_line(argc, argv));
259 write_img(outfile, pf, 0);
260 if ( signif ) {
261 outfile = filebase.pre_rev('.') + "_ftest_sig." + filebase.post_rev('.');
262 write_img(outfile, pf->next, 0);
263 }
264 }
265
266 delete pf;
267 }
268
269 // Student's t-test image, equal or unequal variance
270 Bimage* pt = NULL;
271 for ( i=0; i<2; i++ ) if ( sttflag[i] ) {
272 if ( i == 0 ) // equal variance
273 pt = img_students_t_test_equal(set1, set2, p1, p2, weight);
274 else if ( i == 1 ) // unequal variance
275 pt = img_students_t_test_unequal(set1, set2, p1, p2, weight);
276 if ( filebase.length() ) {
277 if ( i == 0 ) outfile = filebase.pre_rev('.') + "_stte." + filebase.post_rev('.');
278 if ( i == 1 ) outfile = filebase.pre_rev('.') + "_sttu." + filebase.post_rev('.');
279 if ( sam.volume() > 0 ) pt->sampling(sam);
280 pt->change_type(nudatatype);
281 pt->label(get_cmd_line(argc, argv));
282 write_img(outfile, pt, 0);
283 if ( signif ) {
284 if ( i == 0 ) outfile = filebase.pre_rev('.') + "_stte_sig." + filebase.post_rev('.');
285 if ( i == 1 ) outfile = filebase.pre_rev('.') + "_sttu_sig." + filebase.post_rev('.');
286 write_img(outfile, pt->next, 0);
287 }
288 }
289 delete pt;
290 }
291
292 // Compute standard deviation image from variance
293 if ( stdev ) {
294 img_fom_sqrt(p1);
295 if ( p2 ) img_fom_sqrt(p2);
296 if ( filebase.length() ) {
297 if ( set2 )
298 outfile = filebase.pre_rev('.') + "_std1." + filebase.post_rev('.');
299 else
300 outfile = filebase.pre_rev('.') + "_std." + filebase.post_rev('.');
301 write_img(outfile, p1->next, 0);
302 if ( p2 ) {
303 outfile = filebase.pre_rev('.') + "_std2." + filebase.post_rev('.');
304 write_img(outfile, p2->next, 0);
305 }
306 }
307 }
308
309 delete p1;
310 delete p2;
311
312 if ( verbose & VERB_TIME )
313 timer_report(ti);
314
315 bexit(0);
316 }
317
318 /************************************************************************
319 @brief Calculates the square root of the FOM portion of an image.
320 @param *p image.
321 @return Bimage* square root of the FOM of the input image.
322
323 The new data is calculated as:
324 new_datum = sqrt(datum)
325 FOM min. must be 0 or greater.
326
327 **/
328 int img_fom_sqrt(Bimage* p)
329 {
330 if ( !p->next ) {
331 cerr << "Error: No FOM block found in " << p->file_name() << endl;
332 return -1;
333 }
334
335 long i, datasize = (long) p->size().volume()*p->images();
336 float* fom = (float *) p->next->data_pointer();
337
338 for ( i=0; i<datasize; i++ ) {
339 if ( fom[i] < 0 ) {
340 cerr << "Cannot take the square root of the FOM of this image because a value is less than zero." << endl;
341 return -1;
342 }
343 else
344 fom[i] = sqrt(fom[i]);
345 }
346
347 return 0;
348 }
349
371 Bimage* img_students_t_test(int n, Bimage* p, vector<double>& weight)
372 {
373 Bimage* pt = new Bimage(Float, TSimple, p->size(), 1);
374 pt->origin(p->image->origin());
375 pt->sampling(p->sampling());
376
377 float* var = (float *) p->next->data_pointer();
378
379 pt->next = new Bimage(Float, TSimple, pt->size(), 1);
380 float* siglev = (float *) pt->next->data_pointer();
381
382 long i, datasize = p->data_size();
383 double ws(0), d;
384
385 for ( i=0; i<n; i++ ) ws += weight[i];
386
387 double dof = ws*(1 - 1.0L/n);
388 double hdof = 0.5*dof;
389 double avg_var = 0;
390
391 for ( i=0; i<datasize; i++ ) avg_var += var[i];
392 avg_var /= datasize;
393
394 if ( verbose ) {
395 cout << "Student's t test:" << endl;
396 cout << "Number: " << n << endl;
397 cout << "Average variance: " << avg_var << endl;
398 cout << "Degrees of freedom: " << dof << endl << endl;
399 }
400
401 avg_var *= avg_var;
402
403 for ( i=0; i<datasize; i++ ) {
404 d = var[i]/n;
405 if ( d < avg_var ) d = avg_var;
406 d = sqrt(d);
407 pt->set(i, (*p)[i]/d);
408 siglev[i] = betai(hdof, 0.5, dof/(dof + (*pt)[i]*(*pt)[i]));
409 }
410
411 return pt;
412 }
413
439 Bimage* img_students_t_test_equal(int set1, int set2, Bimage* p1, Bimage* p2, vector<double>& weight)
440 {
441 // Set arrays and image parameters
442 Bimage* pt = new Bimage(Float, TSimple, p1->size(), 1);
443 pt->origin(p1->image->origin());
444 pt->sampling(p1->sampling());
445 pt->next = new Bimage(Float, TSimple, pt->size(), 1);
446
447 long i, j, datasize = p1->sizeX()*p1->sizeY()*p1->sizeZ()*p1->images();
448
449 float* var1 = (float *) p1->next->data_pointer(); // pointers to variance data
450 float* var2 = (float *) p2->next->data_pointer();
451 float* sig = (float *) pt->next->data_pointer();
452
453 // Compute Student's t-test
454 if ( verbose ) {
455 cout << endl << "Student's t-test, assuming same variance in sets 1 and 2" << endl;
456 cout << "Set 1 contains " << set1 << " images" << endl;
457 cout << "Set 2 contains " << set2 << " images" << endl;
458 }
459
460 double ws1, ws2;
461 for ( i=0, j=0, ws1=0; i<set1; i++, j++ ) ws1 += weight[j];
462 for ( i=0, ws2=0; i<set2; i++, j++ ) ws2 += weight[j];
463
464 double inv_weight_sum = (1.0L / ws1) + (1.0L / ws2);
465
466 double dof1 = ws1*(1.0L - 1.0L/set1); // degrees of freedom
467 double dof2 = ws2*(1.0L - 1.0L/set2);
468 double dof = dof1 + dof2;
469 double hdof = 0.5*dof;
470 double SD;
471 double Vn1, Vn2;
472
473 long zero_count1 = 0, zero_count2 = 0; // Counts numbers of zero values in t-test
474 for ( i=0; i<datasize; i++ ) {
475 Vn1 = var1[i] * dof1; // Compute numerator of variance from the variance
476 Vn2 = var2[i] * dof2;
477 SD = sqrt( ( (Vn1 + Vn2) / dof ) * inv_weight_sum ); // Standard error of the difference of the means
478 if ( SD > 0 ) { // test for zero in denominator
479 pt->set(i, ( (*p1)[i] - (*p2)[i] ) / SD); // t-test value
480 if ( (*pt)[i] == 0 ) zero_count2++;
481 sig[i] = betai(hdof, 0.5L, dof/(dof + (*pt)[i]*(*pt)[i]) ); // significance level
482 } else {
483 pt->set(i, 0);
484 sig[i] = 1;
485 zero_count1++;
486 }
487 }
488
489 if ( verbose & VERB_FULL ) {
490 cout << zero_count1 << " pixels had a zero value for the standard error of the differences of the means, and t was set to zero." << endl;
491 cout << zero_count2 << " pixels had standard deviation > 0 and t = 0." << endl;
492 cout << datasize << " = total pixels in image" << endl;
493 }
494
495 return pt;
496 }
497
498
499
521 Bimage* img_students_t_test_unequal(int set1, int set2, Bimage* p1, Bimage* p2, vector<double>& weight)
522 {
523 // Set arrays and image parameters
524 Bimage* pt = new Bimage(Float, TSimple, p1->sizeX(), p1->sizeY(), p1->sizeZ(), 1);
525 pt->origin(p1->image->origin());
526 pt->sampling(p1->sampling());
527 pt->next = new Bimage(Float, TSimple, pt->size(), 1);
528
529 long i, j, datasize = p1->sizeX()*p1->sizeY()*p1->sizeZ()*p1->images();
530
531 float* var1 = (float *) p1->next->data_pointer(); // pointers to variance data
532 float* var2 = (float *) p2->next->data_pointer();
533 float* sig = (float *) pt->next->data_pointer(); // initialize figure-of-merit subimage structure, for significance level
534
535 // Compute Student's t-test
536 if ( verbose ) {
537 cout << endl << "Student's t-test, assuming unequal variance in sets 1 and 2" << endl;
538 cout << "Set 1 contains " << set1 << " images" << endl;
539 cout << "Set 2 contains " << set2 << " images" << endl;
540 }
541
542 double ws1, ws2;
543 for ( i=0, j=0, ws1=0; i<set1; i++, j++ ) ws1 += weight[j];
544 for ( i=0, ws2=0; i<set2; i++, j++ ) ws2 += weight[j];
545
546 double dof1 = ws1*(1.0L - 1.0L/set1); // degrees of freedom
547 double dof2 = ws2*(1.0L - 1.0L/set2);
548 double dof;
549 double Vn1, Vn2;
550
551 long zero_count1 = 0, zero_count2 = 0; // Counts numbers of zero values in t-test
552 for ( i=0; i<datasize; i++ ) {
553 if ( var1[i] > 0 || var2[i] > 0 ) { // test for zero in denominator
554 Vn1 = var1[i]/ws1;
555 Vn2 = var2[i]/ws2;
556 pt->set(i, ( (*p1)[i] - (*p2)[i] ) / sqrt(Vn1 + Vn2));
557 if ( (*pt)[i] == 0 ) zero_count2++;
558 dof = (Vn1 + Vn2)*(Vn1 + Vn2) / (Vn1*Vn1/dof1 + Vn2*Vn2/dof2);
559 sig[i] = betai(0.5L*dof, 0.5L, dof/(dof + (*pt)[i]*(*pt)[i]) ); // significance level
560 } else {
561 pt->set(i, 0);
562 sig[i] = 1;
563 zero_count1++;
564 }
565 }
566
567 if ( verbose & VERB_FULL ) {
568 cout << zero_count1 << " pixels had zero variance and t was set to zero." << endl;
569 cout << zero_count2 << " pixels had variance not equal to 0 and t = 0." << endl;
570 cout << datasize << " = total pixels in image" << endl;
571 }
572
573 return pt;
574 }
575
595 Bimage* img_f_test(int set1, int set2, Bimage* p1, Bimage* p2, vector<double>& weight)
596 {
597 // Set image parameters and arrays
598 Bimage* pf = new Bimage(Float, TSimple, p1->size(), 1);
599 pf->origin(p1->image->origin());
600 pf->sampling(p1->sampling());
601 pf->next = new Bimage(Float, TSimple, pf->size(), 1);
602
603 long i, j, datasize = p1->sizeX()*p1->sizeY()*p1->sizeZ()*p1->images();
604
605 float* var1 = (float *) p1->next->data_pointer(); // pointers to variance data
606 float* var2 = (float *) p2->next->data_pointer();
607 float* sig = (float *) pf->next->data_pointer();
608
609 // Compute F-test
610 if ( verbose ) {
611 cout << endl << "F-test" << endl;
612 cout << "Set 1 contains " << set1 << " images" << endl;
613 cout << "Set 2 contains " << set2 << " images" << endl;
614 }
615
616 double ws1, ws2;
617 for ( i=0, j=0, ws1=0; i<set1; i++, j++ ) ws1 += weight[j];
618 for ( i=0, ws2=0; i<set2; i++, j++ ) ws2 += weight[j];
619
620 double dof1 = ws1*(1.0L - 1.0L/set1);
621 double dof2 = ws2*(1.0L - 1.0L/set2);
622 double df1, df2; // degrees of freedom, sets 1 and 2
623
624 for ( i=0; i<datasize; i++ ) {
625 if ( var1[i] < SMALLFLOAT || var2[i] < SMALLFLOAT ) {
626 pf->set(i, 0);
627 sig[i] = 1;
628 j++;
629 } else {
630 if ( var1[i] > var2[i] ) { // make f the ratio of the larger variance to the smaller one
631 pf->set(i, var1[i] / var2[i]);
632 df1 = dof1;
633 df2 = dof2;
634 } else {
635 pf->set(i, var2[i] / var1[i]);
636 df1 = dof2;
637 df2 = dof1;
638 }
639 sig[i] = 2*betai(0.5L*df2, 0.5L*df1, df2/(df2 + df1*(*pf)[i]) ); // significance level
640 if ( sig[i] > 1 ) sig[i] = 2 - sig[i];
641 }
642 }
643 if ( verbose & VERB_FULL ) {
644 cout << j << " pixels in set 1 or set 2 had zero variance, and the F-values were set to zero." << endl;
645 cout << datasize << " = total pixels in image" << endl;
646 }
647
648 return pf;
649 }
650
651
Bimage::change_type
void change_type(char letter)
Get the data type indicated by a single letter code.
Definition: Bimage.cpp:1743
string_add
Bstring * string_add(Bstring **list, const char *string)
Adds a string to a linked list.
Definition: Bstring.cpp:705
DataType
DataType
Base data type specifier.
Definition: utilities.h:146
Bimage::sampling
Vector3< double > sampling()
Definition: Bimage.h:505
SMALLFLOAT
#define SMALLFLOAT
Definition: utilities.h:45
img_students_t_test
Bimage * img_students_t_test(int n, Bimage *p, vector< double > &weight)
Applies the Student's t-test to one set of images.
Definition: dimgstats.cpp:371
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
use
const char * use[]
Definition: dimgstats.cpp:29
Bstring::length
long length() const
Definition: Bstring.cpp:263
Bimage::file_name
void file_name(string s)
Definition: Bimage.h:230
img_students_t_test_equal
Bimage * img_students_t_test_equal(int set1, int set2, Bimage *p1, Bimage *p2, vector< double > &weight)
Applies the Student's t-test to two sets of images, assumes the two distributions have approximately ...
Definition: dimgstats.cpp:439
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
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
TSimple
Definition: Bimage.h:58
timer.h
Utilities for timing functions.
Float
Definition: utilities.h:157
img_add_weighed
Bimage * img_add_weighed(Bstring *file_list, vector< double > weight, double newavg=0, double newstd=0, int flags=0)
Adds multiple images together with given weights.
Definition: img_combine.cpp:288
Bimage
General image parameter class.
Definition: Bimage.h:163
Bstring::next
Bstring * next
Definition: Bstring.h:31
Boption
A class for a command line input option.
Definition: options.h:26
Bimage::label
void label(string s)
Definition: Bimage.h:235
img_f_test
Bimage * img_f_test(int set1, int set2, Bimage *p1, Bimage *p2, vector< double > &weight)
Applies the F-test to two sets of images.
Definition: dimgstats.cpp:595
VERB_TIME
#define VERB_TIME
Definition: utilities.h:110
img_combine.h
Header file for combining two images in various ways.
betai
double betai(double a, double b, double x)
Calculates the incomplete beta function Ix(a,b).
Definition: math_util.cpp:320
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
Bsub_image::origin
void origin(double x, double y, double z)
Definition: Bimage.h:127
Bstring::split_into_doubles
vector< double > split_into_doubles(const Bstring &delim)
Definition: Bstring.cpp:665
Bstring::post_rev
Bstring post_rev(char c)
Definition: Bstring.cpp:428
Bimage::set
void set(long j, double v)
Sets a single value at the given index.
Definition: Bimage.cpp:1096
Bimage::next
Bimage * next
Definition: Bimage.h:165
Boption::datatype
DataType datatype()
Definition: options.h:93
Bimage::data_pointer
unsigned char * data_pointer()
Definition: Bimage.h:261
Boption::next
Boption * next
Definition: options.h:28
img_students_t_test_unequal
Bimage * img_students_t_test_unequal(int set1, int set2, Bimage *p1, Bimage *p2, vector< double > &weight)
Applies the Student's t-test to two sets of images, assumes the two distributions have unequal varian...
Definition: dimgstats.cpp:521
Bstring
Definition: Bstring.h:29
Bimage::sizeX
void sizeX(long nx)
Definition: Bimage.h:377
verbose
int verbose
img_fom_sqrt
int img_fom_sqrt(Bimage *p)
Definition: dimgstats.cpp:328
Bimage::sizeZ
void sizeZ(long nz)
Definition: Bimage.h:379
Vector3< double >
timer_report
double timer_report(double lasttime)
Reports the time elapsed since a given time.
Definition: timer.cpp:67
Bstring.h
Header file for the string class.
Vector3.h
Class for 3-value vectors.
option_kill
int option_kill(Boption *option)
Deallocates a linked list of option structures.
Definition: options.cpp:109
Unknown_Type
Definition: utilities.h:147
rwimg.h
Header file for 2D and 3D image I/O.
options.h
Header file for option handlers.
Bimage::images
long images()
Definition: Bimage.h:491
Bstring::pre_rev
Bstring pre_rev(char c)
Definition: Bstring.cpp:413
Vector3::volume
double volume()
Definition: Vector3.h:235
VERB_FULL
#define VERB_FULL
Definition: utilities.h:109
Bimage::sizeY
void sizeY(long ny)
Definition: Bimage.h:378
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
Bimage::data_size
long data_size()
Definition: Bimage.h:255
Bimage::image
Bsub_image * image
Definition: Bimage.h:188
Bimage::origin
void origin(double ox, double oy, double oz)
Definition: Bimage.h:563
math_util.h
Header file for general utilities.
main
int main(int argc, char **argv)
Definition: dimgstats.cpp:81
string_kill
int string_kill(Bstring *list)
Kills a string linked list.
Definition: Bstring.cpp:760