Skip to content
Snippets Groups Projects
glim.h 1.43 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>
Stephen Smith's avatar
Stephen Smith committed
#define WANT_STREAM
#define WANT_MATH

#include "newmat/newmatap.h"
#include "newmat/newmatio.h"
Stephen Smith's avatar
Stephen Smith committed
#include "VolumeSeries.h"
#include "Volume.h"

using namespace NEWMAT;
Mark Woolrich's avatar
Mark Woolrich committed
namespace FILM{
Stephen Smith's avatar
Stephen Smith committed

#if !defined(__glim_h)
#define __glim_h
 
#define BATCHSIZE 50

  class Glim
    {
    public:
Mark Woolrich's avatar
Mark Woolrich committed
      Glim(VolumeSeries& p_y, const Matrix& p_x); 
Stephen Smith's avatar
Stephen Smith committed

      void Save();

Mark Woolrich's avatar
Mark Woolrich committed
      VolumeSeries& ComputeResids();      
Stephen Smith's avatar
Stephen Smith committed
      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);
Mark Woolrich's avatar
Mark Woolrich committed
      void setData(VolumeSeries& p_y) { y = p_y; }
Stephen Smith's avatar
Stephen Smith committed

      // y = bx + r
Mark Woolrich's avatar
Mark Woolrich committed
      VolumeSeries& y;
Stephen Smith's avatar
Stephen Smith committed
      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