Skip to content
Snippets Groups Projects
gaussComparer.cc 854 B
Newer Older
Stephen Smith's avatar
Stephen Smith committed
/*  gaussComparer.cc

    Mark Woolrich, FMRIB Image Analysis Group

    Copyright (C) 1999-2000 University of Oxford  */

/*  CCOPYRIGHT  */

#include "gaussComparer.h"

Mark Woolrich's avatar
Mark Woolrich committed
namespace FILM {
Stephen Smith's avatar
Stephen Smith committed

Mark Woolrich's avatar
Mark Woolrich committed
  float GaussComparer::computeRatio(const float prob, Log& out)
Stephen Smith's avatar
Stephen Smith committed
    {
      float theorZScore = -ndtri(prob);
      int sum = histogram.integrateToInf(theorZScore) + histogram.integrateFromInf(-theorZScore);

      out << "p = " << prob << ": Positive only, ratio =  " << ((float) histogram.integrateToInf(theorZScore)
					    /(float)histogram.integrateAll())/(prob) << endl;
      out << "p = " << prob << ": Negative only, ratio =  " << ((float) histogram.integrateFromInf(-theorZScore)
					    /(float)histogram.integrateAll())/(prob) << endl;

      return ((float)sum/(float)histogram.integrateAll())/(2*prob);
    }

#ifndef NO_NAMESPACE
}
#endif