Bsoft 2.1.4
Bernard's software package
dimgstats.cpp File Reference

Calculates statistical measures within a set of images or between sets of images. More...

#include "Bstring.h"
#include "rwimg.h"
#include "img_combine.h"
#include "math_util.h"
#include "utilities.h"
#include "options.h"
#include "timer.h"
#include "Vector3.h"

Functions

int img_fom_sqrt (Bimage *p)
 
Bimageimg_students_t_test (int n, Bimage *p, vector< double > &weight)
 Applies the Student's t-test to one set of images. More...
 
Bimageimg_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 the same variance. More...
 
Bimageimg_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 variance. More...
 
Bimageimg_f_test (int set1, int set2, Bimage *p1, Bimage *p2, vector< double > &weight)
 Applies the F-test to two sets of images. More...
 
int main (int argc, char **argv)
 

Variables

int verbose
 
const char * use []
 

Detailed Description

Calculates statistical measures within a set of images or between sets of images.

Author
David Belnap and Bernard Heymann
Date
Created: 20051213
Modified: 20190208 (BH)

Function Documentation

◆ 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.

Author
David Belnap
Parameters
set1number of files in set 1.
set2number of files in set 2.
*p1average image with variance (FOM), set 1
*p2average image with variance (FOM), set 2
weightlist of weights.
Returns
Bimage* F-test image and significance image (as FOM).
The F value is computed for each pixel:
        F(i) = var1(i) / var2(i)

Variance (as FOM of an average image) is input.  The significance 
level is computed and stored as FOM of F-test image.  Output is
in floating point.
Reference: Press W.H. et al (1992) Numerical Recipes in C.

◆ img_fom_sqrt()

int img_fom_sqrt ( Bimage p)

◆ 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.

Parameters
nnumber of files in the set.
*paverage and variance of the set.
weightlist of weights.
Returns
Bimage* significant level image (floating point).
First, average (avg) and variance (var) images are calculated:
        var = [1/(N-1)] sum(x - avgx)^2
Second, the t value is computed and returned as an image:
        t = avg / sqrt[ var/N ]
Finally, the significance is calculated and returned as the FOM of the image:
        sig = betai(dof/2, 0.5, dof/(dof + t*t))
where dof (degrees-of-freedom) is calculated as:
        dof = ws*(1 - 1.0L/N)
and ws is the weight sum.
All images are converted to floating point.
Reference: Press W.H. et al (1992) Numerical Recipes in C. Milligan and Flicker (1987) J. Cell Biol. 105:29-39.

◆ 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 the same variance.

Author
David Belnap and Bernard Heymann
Parameters
set1number of files in set 1.
set2number of files in set 2.
*p1average image with variance (FOM), set 1
*p2average image with variance (FOM), set 2
weightlist of weights.
Returns
Bimage* t-test image and significance image (as FOM).
Input average images for sets 1 and 2, with variance as FOM portion
of the images.  The numerator portion of the variance (Vn) is 
computed from the variance.  The "standard error of the difference 
of the means" is computed:
SD = sqrt[ ( (Vn1 + Vn2) / degrees_of_freedom ) * (1/set1 + 1/set2) ]

and used to compute the t value:
            t = ( avg1 - avg2 ) / SD

Finally, the significance level (probability) is computed.
Reference: Press W.H. et al (1992) Numerical Recipes in C. Milligan and Flicker (1987) J. Cell Biol. 105:29-39.

◆ 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 variance.

Author
David Belnap
Parameters
set1number of files in set 1.
set2number of files in set 2.
*p1average image with variance (FOM), set 1
*p2average image with variance (FOM), set 2
weightlist of weights.
Returns
Bimage* t-test image and significance image (as FOM).
Input average images for sets 1 and 2, with variance as FOM portion
of the images.  The t value is computed:
        t = ( avg1 - avg2 ) / sqrt[ var1/ws1 + var2/ws2 ]

(ws = weighted sum, default = N).  The significance level 
(probability) is computed.  Output is in floating point.
Reference: Press W.H. et al (1992) Numerical Recipes in C. Milligan and Flicker (1987) J. Cell Biol. 105:29-39.

◆ main()

int main ( int  argc,
char **  argv 
)

Variable Documentation

◆ use

const char* use[]

◆ verbose

int verbose
extern