-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmtrk_api.h
132 lines (99 loc) · 3.24 KB
/
mtrk_api.h
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
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
#ifndef mtrk_api_h
#define mtrk_api_h 1
#include "cJSON.h"
#include "MrServers/MrMeasSrv/SeqIF/libRT/libRT.h"
#include "MrServers/MrMeasSrv/MeasUtils/NLSStatus.h"
#include "mtrk_common.h"
#include "mtrk_equations.h"
#include "mtrk_arrays.h"
#include "mtrk_objects.h"
namespace SEQ_NAMESPACE
{
class mtrk;
class mtrk_sections
{
public:
mtrk_sections();
~mtrk_sections();
cJSON* file;
cJSON* settings;
cJSON* infos;
cJSON* instructions;
cJSON* objects;
cJSON* arrays;
cJSON* equations;
char* loadedMeasurementID;
std::string loadedFilename;
void clear();
bool isComplete();
bool load(cJSON* sequence);
cJSON* getBlock(char* id);
};
class mtrk_state
{
public:
mtrk_state();
int counters[MTRK_DEFS_COUNTERS];
double floats [MTRK_DEFS_FLOATS];
long int clock;
long int tableStart;
long int tableDuration;
bool isDryRun;
int slices;
void reset(bool dryRun=true);
void updateDuration(int startTime, int duration=0);
long int totalDuration;
MrProtocolData::SeqExpoRFInfo rfInfo;
};
inline void mtrk_state::updateDuration(int startTime, int duration)
{
int endTime=startTime + duration;
if (endTime > tableDuration)
{
tableDuration=endTime;
}
}
class mtrk_api
{
public:
mtrk_api();
virtual ~mtrk_api();
void setParent(mtrk* parentSequence);
mtrk* parent;
bool loadSequence(std::string filename, bool forceLoad=false);
void unloadSequence();
cJSON* sequence;
mtrk_sections sections;
mtrk_state state;
mtrk_equations equations;
mtrk_arrays arrays;
mtrk_objects objects;
int recursions;
bool prepare(MrProt* pMrProt, MrProtocolData::SeqExpo* pSeqExpo, bool isBinarySearch=false);
bool run(MrProt* pMrProt, MrProtocolData::SeqExpo* pSeqExpo, bool isDryRun=false);
bool runBlock(cJSON* block);
bool runActionLoop (cJSON* item);
bool runActionBlock (cJSON* item);
bool runActionCondition(cJSON* item);
bool runActionInit (cJSON* item);
bool runActionSubmit (cJSON* item);
bool runActionRF (cJSON* item);
bool runActionADC (cJSON* item);
bool runActionGrad (cJSON* item);
bool runActionSync (cJSON* item);
bool runActionMark (cJSON* item);
bool runActionCalc (cJSON* item);
bool runActionDebug (cJSON* item);
bool getDynamicValue(cJSON* item, double& value, double oldValue=0.);
int getInfoInt (char* name, int defaultValue);
double getInfoDouble(char* name, double defaultValue);
char* getInfoString(char* name, char* defaultValue);
double getMeasureTimeUsec();
MrProtocolData::SeqExpoRFInfo getRFInfo();
double getReadoutOS();
int getSlices();
MrProt* ptrMrProt;
MrProtocolData::SeqExpo* ptrSeqExpo;
};
}
#endif