Newer
Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
/* paradigm.cc
Mark Woolrich, FMRIB Image Analysis Group
Copyright (C) 1999-2000 University of Oxford */
/* CCOPYRIGHT */
#include "paradigm.h"
#include "Log.h"
#include "sigproc.h"
#include "miscmaths.h"
using namespace UTILS;
namespace UTILS {
void Paradigm::load(const string& p_paradfname, const string& p_contrastfname, bool p_blockdesign, int p_sizets)
{
if(p_paradfname != "")
SIGPROC::In(p_paradfname, designMatrix);
if(p_contrastfname != "")
SIGPROC::In(p_contrastfname, contrasts);
// Check time series match up with design
if(p_paradfname != "" && designMatrix.Nrows() != p_sizets)
{
cerr << "Num scans = "<< p_sizets << ", design matrix rows = " << designMatrix.Nrows() << endl;
throw Exception("size of design matrix does not match number of scans\n");
}
// Check contrast matches design matrix
if(p_paradfname != "" && p_contrastfname != "" && designMatrix.Ncols() != contrasts.Ncols())
{
cerr << "Num contrast cols = " << contrasts.Ncols() << ", design matrix cols = "
<< designMatrix.Ncols() << endl;
throw Exception("size of design matrix does not match contrast\n");
}
if(p_blockdesign)
{
// Need to adjust amplitude from (-1,1) to (0,1)
designMatrix = (designMatrix + 1)/2;
}
}
}