-
Notifications
You must be signed in to change notification settings - Fork 9
/
RtConfigFmriRun.cpp
105 lines (89 loc) · 3.23 KB
/
RtConfigFmriRun.cpp
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
93
94
95
96
97
98
99
100
101
102
103
104
105
/*=========================================================================
* RtConfigFmriRun.cpp defines a class that controls configuration of
* a single real-time fMRI experimental run.
*
* Copyright 2007-2013, the MURFI dev team.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0.txt
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*=========================================================================*/
#include"RtConfigFmriRun.h"
#include"RtExperiment.h"
#include"RtLimit.h"
#include"ace/Trace.h"
// defaults
static const unsigned int DEFAULT_SCANNERPORT = 15000;
static const string DEFAULT_IMAGETYPE = "epi";
static const string DEFAULT_STUDYREFNAME( "study_ref");
// set default config info
void RtConfigFmriRun::setDefaults() {
set("scanner:disabled",false);
set("scanner:receiveImages",true);
set("scanner:port", DEFAULT_SCANNERPORT);
set("scanner:saveImages",true);
set("scanner:onlyReadMoco",true);
set("scanner:unmosaic",true);
}
// validate the configuration
// checks for valid setup of different parts of the program
// returns true for success
bool RtConfigFmriRun::validateConfig() {
//ACE_TRACE(("RtConfigFmriRun::validateConfig"));
bool valid = true;
stringstream ss;
if(!isSet("study:log:filename")) {
set("study:log:filename", getExperimentConfig().get("study:log:filename"));
}
// if tr and scan length are set in the design, copy that over
if (isSet("processor:incremental-glm:tr")) {
if (isSet("scanner:tr")) {
cerr << "ERROR: TR is set both in the scanner section and in the "
<< "GLM setup, please only specify it in one place" << endl;
valid = false;
}
else {
set("scanner:tr", get("processor:incremental-glm:tr"));
}
}
if (isSet("processor:incremental-glm:measurements")) {
if (isSet("scanner:measurements")) {
cerr << "ERROR: The number of measurements is set both in the scanner"
<< " section and in the GLM setup, please only specify it in "
<< "one place" << endl;
valid = false;
}
else {
set("scanner:measurements",
get("processor:incremental-glm:measurements"));
}
}
// check required acquisition parameters
if(!isSet("scanner:tr")) {
cerr << "ERROR: tr must be set!" << endl;
valid = false;
}
if(!isSet("scanner:measurements")) {
cerr << "ERROR: number of measurements must be set!" << endl;
valid = false;
}
// study reference volume
if(!isSet("study:xfm:referenceVol")) {
path p;
p.operator=(get("study:xfm:directory").filepath()
/ (DEFAULT_STUDYREFNAME + "."
+ get("study:volumeFormat").str()));
cout << "using default study reference volume name " << p.string() << endl;
set("study:xfm:referenceVol",p.string());
}
return valid;
}