/* histogram.cc Mark Woolrich, FMRIB Image Analysis Group Copyright (C) 1999-2000 University of Oxford */ /* CCOPYRIGHT */ #include "miscmaths.h" #include "histogram.h" using namespace std; #ifndef NO_NAMESPACE namespace MISCMATHS { #endif void Histogram::generate() { Tracer ts("Histogram::generate"); int size = sourceData.Nrows(); if(calcRange) { // calculate range automatically histMin=histMax=sourceData(1); for(int i=1; i<=size; i++) { if (sourceData(i)>histMax) histMax=sourceData(i); if (sourceData(i)1) { val+=kernel(2)*(histogram(i-1)); norm+=kernel(2); } if(i>2) { val+=kernel(3)*(histogram(i-2)); norm+=kernel(3); } if(i maxnum) { maxnum = (int)histogram(i); maxbin = i; } } return getValue(maxbin); } #ifndef NO_NAMESPACE } #endif