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
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
/* contrast_mgr.cc
Mark Woolrich, FMRIB Image Analysis Group
Copyright (C) 1999-2000 University of Oxford */
/* CCOPYRIGHT */
#include <iostream>
#include <fstream>
#include <strstream>
#define WANT_STREAM
#define WANT_MATH
#include "newmatap.h"
#include "newmatio.h"
#include "VolumeSeries.h"
#include "Volume.h"
#include "ContrastMgr.h"
#include "sigproc.h"
#include "miscmaths.h"
#include "Log.h"
#include "paradigm.h"
#include "ContrastMgrOptions.h"
#include <string>
#ifndef NO_NAMESPACE
using namespace NEWMAT;
using namespace SIGPROC;
using namespace TACO;
using namespace UTILS;
#endif
int main(int argc, char *argv[])
{
try{
// parse command line to find out directory name for logging:
ofstream out2;
ContrastMgrOptions& globalopts = ContrastMgrOptions::getInstance();
globalopts.parse_command_line(argc, argv, out2);
// Setup logging:
Log& logger = Log::getInstance();
logger.setLogFile("contrastlogfile");
logger.setDir(globalopts.datadir);
// parse command line again to output arguments to logfile
globalopts.parse_command_line(argc, argv, logger.str());
// Load contrasts:
Paradigm parad;
parad.load("", globalopts.contrastfname, false, 0);
if(globalopts.verbose)
{
logger.str() << "Contrast:" << endl << parad.getContrasts();
}
ContrastMgr conMgr(parad.getContrasts());
cerr << "Loading data...";
conMgr.Load();
cerr << " Completed" << endl;
// Loop through contrasts:
for(int c = 1; c <= parad.getContrasts().Nrows(); c++)
{
cerr << "Computing data...";
conMgr.SetContrast(c, c+globalopts.copenumber-1);
conMgr.ComputeNeff(false);
conMgr.ComputeCope();
conMgr.ComputeVarCope();
conMgr.ComputeZStat();
cerr << " Completed" << endl;
cerr << "Saving data...";
conMgr.Save(globalopts.suffix);
cerr << " Completed" << endl;
}
}
catch(Exception p_excp)
{
cerr << p_excp.what() << endl;
}
catch(...)
{
cerr << "Image error" << endl;
}
return 0;
}