-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmtrk.cpp
198 lines (156 loc) · 5.4 KB
/
mtrk.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
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
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
#include "MrServers/MrImaging/seq/mtrk/mtrk.h"
#include "MrServers/MrImaging/seq/mtrk/mtrk_UI.h"
#include "MrServers/MrMeasSrv/SeqIF/csequence.h"
#include "MrServers/MrImaging/libSeqSysProp/SysProperties.h"
#include "MrServers/MrImaging/ut/libsequt.h"
#include "MrServers/MrProtSrv/MrProt/MrSliceGroup.h"
#define OnErrorReturn(S) if(!MrSucceeded(S)) return(S)
#ifndef SEQ_NAMESPACE
#error SEQ_NAMESPACE not defined
#endif
#ifdef SEQUENCE_CLASS_mtrk
SEQIF_DEFINE (SEQ_NAMESPACE::mtrk)
#endif
using namespace SEQ_NAMESPACE;
mtrk::mtrk(): m_pUI(NULL)
{
mapi.setParent(this);
}
mtrk::~mtrk()
{
if(NULL != m_pUI)
{
delete m_pUI;
m_pUI = NULL;
}
}
NLSStatus mtrk::initialize(SeqLim &rSeqLim)
{
static const char *ptModule = {"mtrk::initialize"};
NLS_STATUS lStatus = SEQU__NORMAL;
rSeqLim.setAllowedFrequency(8000000, 500000000);
rSeqLim.enableSliceShift();
rSeqLim.enableMSMA();
rSeqLim.enableOffcenter();
rSeqLim.setAllowedSliceOrientation(SEQ::DOUBLE_OBLIQUE);
rSeqLim.setReadoutFOV(100, 500, 1, 300);
rSeqLim.setPhaseFOV(100, 500, 1, 300);
rSeqLim.setSlices(1, K_NO_SLI_MAX, 1, 1);
rSeqLim.setMultipleSeriesMode(SEQ::MULTIPLE_SERIES_OFF);
rSeqLim.setMultiSliceMode(SEQ::MSM_SEQUENTIAL);
rSeqLim.setSliceSeriesMode(SEQ::ASCENDING);
rSeqLim.setAdjShim(SEQ::ADJSHIM_STANDARD, SEQ::ADJSHIM_TUNEUP);
rSeqLim.setReadoutOSFactor(2.0);
if((MRRESULT_SEV & (lStatus = createUI(rSeqLim))) == MRRESULT_SEV)
{
MRTRACE("Instantiation of UI class failed!");
return lStatus;
}
#ifdef WIN32
if(NULL == m_pUI)
{
MRTRACE("UI object pointer is null (creation failed probably)!");
return ( SEQU_ERROR );
}
lStatus = m_pUI->registerUI(rSeqLim);
if(MrSeverity(lStatus) != MRRESULT_SUCCESS)
{
MRTRACE("Registering UI object failed! Errorcode: %i", lStatus);
return lStatus;
}
rSeqLim.setDefaultEVAProt (_T("%SiemensEvaDefProt%\\Inline\\Inline.evp"));
#endif
return lStatus;
}
NLSStatus mtrk::prepare(MrProt &rMrProt, SeqLim &rSeqLim, MrProtocolData::SeqExpo &rSeqExpo)
{
static const char *ptModule = {"mtrk::prepare"};
NLS_STATUS lStatus = SEQU__NORMAL;
mapi.prepare(&rMrProt,&rSeqExpo,rSeqLim.isContextPrepForBinarySearch());
#ifdef WIN32
//if (!rSeqLim.isContextPrepForBinarySearch())
{
Slice slice(rMrProt.sliceSeries()[0]);
slice.readoutFOV(mapi.getInfoDouble(MTRK_INFOS_FOV,300.));
slice.phaseFOV(mapi.getInfoDouble(MTRK_INFOS_FOV,300.));
//rMrProt.getsSliceArray().setlSize(mapi.getSlices());
//rMrProt.sliceSeries().setlSize(mapi.getSlices());
//rMrProt.getsSliceArray().setlSize(mapi.getSlices());
//rMrProt.getsSliceArray().setlGuaranteedSlices(mapi.getSlices());
}
#endif
int lLinesToMeasure=0;
OnErrorReturn(fSSLSetRxGain(K_RX_GAIN_CODE_HIGH, rMrProt, rSeqLim));
OnErrorReturn(fSUPrepSlicePosArray (rMrProt, rSeqLim, m_asSLC));
fSUSetSequenceString(mapi.getInfoString(MTRK_INFOS_SEQSTRING,"MTRK"), rMrProt, rSeqExpo);
rSeqExpo.setRFInfo (mapi.getRFInfo());
rSeqExpo.setMeasureTimeUsec (mapi.getMeasureTimeUsec());
rSeqExpo.setTotalMeasureTimeUsec(mapi.getMeasureTimeUsec());
rSeqExpo.setMeasuredPELines (mapi.getInfoInt(MTRK_INFOS_PELINES,128));
rSeqExpo.setOnlineFFT (SEQ::ONLINE_FFT_PHASE);
rSeqExpo.setICEProgramFilename (mapi.getInfoString(MTRK_INFOS_RECONSTRUCTION,"%SiemensIceProgs%\\IceProgram2D"));
rSeqLim.setReadoutOSFactor (mapi.getReadoutOS());
return (lStatus);
}
NLSStatus mtrk::check(MrProt &rMrProt, SeqLim &rSeqLim, MrProtocolData::SeqExpo &rSeqExpo, SEQCheckMode *)
{
static const char *ptModule = {"mtrk::check"};
NLS_STATUS lStatus = SEQU__NORMAL;
int lL = 0;
int alLCk[4] = {0, 1, rSeqExpo.getMeasuredPELines() - 2, rSeqExpo.getMeasuredPELines() - 1};
while (lL < 4 )
{
//OnErrorReturn(runKernel(rMrProt, rSeqLim, rSeqExpo, KERNEL_CHECK, 0, 0, alLCk[lL]));
lL++;
}
return(lStatus);
}
NLSStatus mtrk::run(MrProt &rMrProt, SeqLim &rSeqLim, MrProtocolData::SeqExpo &rSeqExpo)
{
static const char *ptModule = {"mtrk::run"};
NLS_STATUS lStatus = SEQU__NORMAL;
if(IS_UNIT_TEST_ACTIVE(rSeqLim))
{
mSEQTest(rMrProt, rSeqLim, rSeqExpo, RTEB_ORIGIN_fSEQRunStart, 0, 0, 0, 0, 0);
}
mapi.run(&rMrProt,&rSeqExpo);
if(IS_UNIT_TEST_ACTIVE(rSeqLim))
{
mSEQTest(rMrProt, rSeqLim, rSeqExpo, RTEB_ORIGIN_fSEQRunFinish, 0, 0, 0, 0, 0);
}
return(lStatus);
}
NLS_STATUS mtrk::runKernel(MrProt &rMrProt, SeqLim &rSeqLim, MrProtocolData::SeqExpo &rSeqExpo,
long lKernelMode, long /* m_lSlice */, long /* m_lPartition */, long lLine)
{
static const char *ptModule = {"mtrk::runKernel"};
NLS_STATUS lStatus = SEQU__NORMAL;
return(lStatus);
}
NLS_STATUS mtrk::createUI (SeqLim&)
{
#ifdef WIN32
static const char *ptModule = {"mtrk::createUI"};
if(m_pUI)
{
delete m_pUI;
m_pUI = NULL;
}
try
{
m_pUI = new mtrkUI();
}
catch (...)
{
delete m_pUI;
m_pUI = NULL;
TRACE_PUT1(TC_ALWAYS, TF_SEQ,"%s: Cannot instantiate UI class !", ptModule);
return ( SEQU_ERROR );
}
#endif
return ( SEQU_NORMAL );
}
const mtrkUI* mtrk::getUI (void) const
{
return ( m_pUI );
}