Newer
Older
/* glmrand.h
Mark Woolrich, FMRIB Image Analysis Group
Copyright (C) 1999-2000 University of Oxford */
#include <iostream>
#include <fstream>
#define WANT_STREAM
#define WANT_MATH
#include "newmatap.h"
#include "newmatio.h"
#include "Volume.h"
#include "VolumeSeries.h"
#if !defined(__glmRand_h)
#define __glmRand_h
#ifndef NO_NAMESPACE
using namespace NEWMAT;
using namespace TACO;
namespace SIGPROC{
#endif
#define BATCHSIZE 50
class GlmRand
{
public:
GlmRand(const int pnumrand, const int pnumts, Matrix& pcontrasts, const int contrastnum) :
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
contrasts(&pcontrasts),
numTS(pnumts),
numrand(pnumrand),
randts(pnumrand*pnumts),
datats(pnumts),
datazs(pnumts),
datatscount(1),
batch_size(BATCHSIZE) {SetContrast(contrastnum);}
void addData(ColumnVector& p_y, Matrix& p_x);
void SetContrast(const int p_num) {c = contrasts->Row(p_num).t();}
const Volume& ComputeZStats();
private:
GlmRand(const GlmRand&);
GlmRand& operator=(const GlmRand& p_glmRand);
void randomise();
void ComputeResids();
void ComputeVar();
void Computecb();
void ComputeTStats();
// y = bx + r
// Original time series:
ColumnVector yorig;
VolumeSeries y;
Matrix* x;
// Contrast
Matrix* contrasts;
ColumnVector c;
int numTS;
int sizeTS;
int numrand;
VolumeSeries r;
Matrix pinv_x;
Volume cb;
Volume var;
Volume randts;
Volume datats;
Volume datazs;
Matrix RMat;
int datatscount;
// batch stuff
int batch_size;
};
#endif
#ifndef NO_NAMESPACE
}
#endif