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

    Mark Woolrich, FMRIB Image Analysis Group

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

/*  CCOPYRIGHT  */

Mark Woolrich's avatar
Mark Woolrich committed
#if !defined(__ContrastMgr_h)
#define __ContrastMgr_h

#include <iostream>
#include <fstream>
Stephen Smith's avatar
Stephen Smith committed
#define WANT_STREAM
#define WANT_MATH

#include "newmatap.h"
#include "newmatio.h"
David Flitney's avatar
David Flitney committed
#include "miscmaths/volumeseries.h"
#include "miscmaths/volume.h"
Mark Woolrich's avatar
Mark Woolrich committed
#include "paradigm.h"
#include "miscmaths/miscmaths.h"
Stephen Smith's avatar
Stephen Smith committed

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

  class ContrastMgr
    {
    public:
Mark Woolrich's avatar
Mark Woolrich committed
      ContrastMgr();

      void run();

    private:
      ContrastMgr(const ContrastMgr&);
      ContrastMgr& operator=(const ContrastMgr& p_ContrastMgr);

    protected:
Stephen Smith's avatar
Stephen Smith committed

      void Load();
Mark Woolrich's avatar
Mark Woolrich committed
      void SaveFContrast(const string& suffix);
      void SaveTContrast(const string& suffix);
Stephen Smith's avatar
Stephen Smith committed

      void ComputeVarCope();
      void ComputeCope();
Mark Woolrich's avatar
Mark Woolrich committed
      void ComputeNeff();
Stephen Smith's avatar
Stephen Smith committed
      void ComputeZStat();
Mark Woolrich's avatar
Mark Woolrich committed
      void ComputeFStat();
Stephen Smith's avatar
Stephen Smith committed

      const ColumnVector& GetVarCope() const {return varcb;}
      const ColumnVector& GetCope() const {return cb;}
Mark Woolrich's avatar
Mark Woolrich committed
      const ColumnVector& GetDof() const {return dof;}
Stephen Smith's avatar
Stephen Smith committed
      
Mark Woolrich's avatar
Mark Woolrich committed
      void SetTContrast(const int p_num, const int p_c_counter) 
Stephen Smith's avatar
Stephen Smith committed
	{
Mark Woolrich's avatar
Mark Woolrich committed
	  tc = parad.getTContrasts().Row(p_num).t();
Stephen Smith's avatar
Stephen Smith committed
	  c_counter = p_c_counter;
Mark Woolrich's avatar
Mark Woolrich committed
	  contrast_num = p_num;
Stephen Smith's avatar
Stephen Smith committed
	}

Mark Woolrich's avatar
Mark Woolrich committed
      void SetFContrast(const int p_num, const int p_c_counter);
Stephen Smith's avatar
Stephen Smith committed

      void GetCorrection(Matrix& corr, const int ind);

Mark Woolrich's avatar
Mark Woolrich committed
      // Contrasts:      
      ColumnVector tc;
      Matrix fc;
Stephen Smith's avatar
Stephen Smith committed
      int c_counter;
      int numParams;
Mark Woolrich's avatar
Mark Woolrich committed
      int num_Ccontrasts_in_Fcontrast;
Mark Woolrich's avatar
Mark Woolrich committed
      bool contrast_valid;
      int contrast_num;

      Paradigm parad;
Stephen Smith's avatar
Stephen Smith committed

      // Loaded data:
Mark Woolrich's avatar
Mark Woolrich committed
      VolumeSeries corrections;
Stephen Smith's avatar
Stephen Smith committed
      Matrix b;
Mark Woolrich's avatar
Mark Woolrich committed
      Volume dof;
Stephen Smith's avatar
Stephen Smith committed
      Volume sigmaSquareds;

Mark Woolrich's avatar
Mark Woolrich committed
      // Calculated data:
Stephen Smith's avatar
Stephen Smith committed
      Volume varcb;
      Volume cb;
      Volume neff;      
      Volume tstat;
Mark Woolrich's avatar
Mark Woolrich committed
      Volume fstat;
Stephen Smith's avatar
Stephen Smith committed
      Volume zstat;

      // Other:
      int numTS;
Mark Woolrich's avatar
Mark Woolrich committed
      bool is_avw_corrections;
Stephen Smith's avatar
Stephen Smith committed
    };