Skip to content
Snippets Groups Projects
glim.h 1.47 KiB
Newer Older
Stephen Smith's avatar
Stephen Smith committed
/*  glim.h

    Mark Woolrich, FMRIB Image Analysis Group

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

/*  CCOPYRIGHT  */

#include <iostream>
#include <fstream>
#define WANT_STREAM
#define WANT_MATH

#include "newmatap.h"
#include "newmatio.h"
#include "VolumeSeries.h"
#include "Volume.h"

#ifndef NO_NAMESPACE
using namespace NEWMAT;
using namespace TACO;
namespace SIGPROC{
#endif

#if !defined(__glim_h)
#define __glim_h
 
#define FALSE 0
#define TRUE 1

#define BATCHSIZE 50

  class Glim
    {
    public:
      Glim(const VolumeSeries& p_y, const Matrix& p_x); 

      void Save();

      const VolumeSeries& ComputeResids();      
      void ComputePes();
      void SetVrow(const ColumnVector& p_vrow, const int ind);
      void SetGlobalVrow(const ColumnVector& p_vrow);
      void ComputeSigmaSquared(const int ind);
      void UseGlobalVrow();

    private:
      Glim();
      Glim(const Glim&);
      Glim& operator=(const Glim& p_glim);
      
      void SetCorrection(const Matrix& corr, const int ind);
      void ConstructV(const ColumnVector& p_vrow);

      // y = bx + r
      const VolumeSeries& y;
      const Matrix& x;

      int numTS;
      int sizeTS;
      int numParams;

      VolumeSeries r;
      Matrix pinv_x;
      Matrix V;
      Matrix RV;
      Matrix RMat;

      int batch_size;

      // Data to be saved:
      Matrix corrections;
      Matrix b;
      Volume sigmaSquareds;
      float dof;
    };


#ifndef NO_NAMESPACE
       }
#endif

#endif