-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathyarralink.cpp
More file actions
277 lines (210 loc) · 8.35 KB
/
yarralink.cpp
File metadata and controls
277 lines (210 loc) · 8.35 KB
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
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
#include "yarralink.h"
#include "yarralink_ver.h"
#include "MrServers/MrImaging/libSBB/SBBTSat.h"
#include "MrServers/MrImaging/seq/SystemProperties.h"
#include "MrServers/MrProtSrv/MrProt/MrSlice.h"
#ifdef VER_VE
#include "MrServers/MrImaging/libSeqUtil/libSeqUtil.h"
#include "MrServers/MrMeasSrv/MeasNuclei/IF/MeasKnownNuclei.h"
#include "MrServers/MrProtSrv/MrProt/MeasParameter/MrSysSpec.h"
#include "MrServers/MrProtSrv/MrProt/MeasParameter/MrRXSpec.h"
#include "MrServers/MrImaging/seq/SystemProperties.h"
#include "MrServers/MrImaging/libSeqSysProp/SysProperties.h"
#endif
#ifdef WIN32
#include "MrServers/MrProtSrv/MrProtocol/UILink/MrStdNameTags.h"
#include "MrServers/MrProtSrv/MrProtocol/libUILink/UILinkLimited.h"
#include "MrServers/MrProtSrv/MrProtocol/libUILink/UILinkSelection.h"
#include "MrServers/MrProtSrv/MrProtocol/libUILink/UILinkArray.h"
#include "MrServers/MrProtSrv/MrProtocol/UILink/StdProtRes/StdProtRes.h"
#include "MrServers/MrMeasSrv/SeqIF/Sequence/Sequence.h"
#include <vector>
#include <windows.h>
#include <stdio.h>
#include <tchar.h>
#include <iostream>
#endif
#ifndef SEQ_NAMESPACE
#error SEQ_NAMESPACE not defined
#endif
#ifdef SEQUENCE_CLASS_YARRALINK
SEQIF_DEFINE (SEQ_NAMESPACE::yarralink)
#endif
using namespace SEQ_NAMESPACE;
using namespace std;
static sSLICE_POS asSLC[K_NO_SLI_MAX];
void launchClient()
{
#ifdef WIN32
STARTUPINFO si;
PROCESS_INFORMATION pi;
ZeroMemory( &si, sizeof(si) );
si.cb = sizeof(si);
ZeroMemory( &pi, sizeof(pi) );
TCHAR cmdline[512] = TEXT("C:\\MedCom\\MriCustomer\\seq\\yarra\\ort.dll");
// Start the child process
if( !CreateProcess( NULL, // No module name (use command line)
cmdline, // Command line
NULL, // Process handle not inheritable
NULL, // Thread handle not inheritable
FALSE, // Set handle inheritance to FALSE
0, // No creation flags
NULL, // Use parent's environment block
NULL, // Use parent's starting directory
&si, // Pointer to STARTUPINFO structure
&pi ) // Pointer to PROCESS_INFORMATION structure
)
{
printf( "CreateProcess failed (%d).\n", GetLastError() );
}
// Close process and thread handles.
CloseHandle( pi.hProcess );
CloseHandle( pi.hThread );
#endif
}
// UI handlers used to launch the client via UI controls for the situation that
// no subject is in the scannner (in this case, the frequency adjustment does
// not convert and the measurement is stopped before calling prepare with
// normal context).
#ifdef WIN32
unsigned ui_WIP_CheckBox_GetLabelId(LINK_BOOL_TYPE* const, char* arg_list[], long lIndex)
{
static const char* const label1 = "Click to open >>>";
static const char* const label2 = YL_VERSION;
static const char* const label3 = "Info at http://yarra.rocks";
switch (lIndex)
{
case 0:
arg_list[0] = (char*)label1;
break;
case 1:
arg_list[0] = (char*)label2;
break;
case 2:
arg_list[0] = (char*)label3;
break;
}
return MRI_STD_STRING;
}
bool ui_WIP_CheckBox_GetOptions(LINK_BOOL_TYPE* const pThis , std::vector<unsigned>& rOptionVector, unsigned long& rulVerify, long lIndex)
{
rulVerify = LINK_BOOL_TYPE::VERIFY_OFF;
rOptionVector.resize(2);
rOptionVector[0] = false;
rOptionVector[1] = true;
return true;
}
bool ui_WIP_CheckBox_GetValue(LINK_BOOL_TYPE* const pThis , long lIndex)
{
return 0;
}
bool ui_WIP_CheckBox_SetValue(LINK_BOOL_TYPE* const pThis, bool value, long lIndex)
{
if (value)
{
launchClient();
}
return true;
}
#endif
yarralink::yarralink()
{
clientLaunched=false;
}
yarralink::~yarralink()
{
}
NLSStatus yarralink::initialize(SeqLim *pSeqLim)
{
pSeqLim->setMyOrigFilename( __FILE__ );
pSeqLim->setSequenceOwner( "USER" );
pSeqLim->setSequenceHintText( (char *) "YarraLink " YL_VERSION "\nBuild: "__DATE__" "__TIME__"\n");
#ifdef WIN32
fStdImagingInitPost (pSeqLim);
// Register UI handlers for the checkboxes shown on the sequence special card
if ( LINK_BOOL_TYPE* pBool=_create<LINK_BOOL_TYPE>(pSeqLim, MR_TAG_SEQ_WIP1, (long) 0))
{
pBool->registerGetLabelIdHandler (ui_WIP_CheckBox_GetLabelId);
pBool->registerGetOptionsHandler (ui_WIP_CheckBox_GetOptions);
pBool->registerGetValueHandler (ui_WIP_CheckBox_GetValue);
pBool->registerSetValueHandler (ui_WIP_CheckBox_SetValue);
}
if ( LINK_BOOL_TYPE* pBool=_create<LINK_BOOL_TYPE>(pSeqLim, MR_TAG_SEQ_WIP13, (long) 1))
{
pBool->registerGetLabelIdHandler (ui_WIP_CheckBox_GetLabelId);
pBool->registerGetOptionsHandler (ui_WIP_CheckBox_GetOptions);
pBool->registerGetValueHandler (ui_WIP_CheckBox_GetValue);
pBool->registerSetValueHandler (ui_WIP_CheckBox_SetValue);
}
if ( LINK_BOOL_TYPE* pBool=_create<LINK_BOOL_TYPE>(pSeqLim, MR_TAG_SEQ_WIP14, (long) 2))
{
pBool->registerGetLabelIdHandler (ui_WIP_CheckBox_GetLabelId);
pBool->registerGetOptionsHandler (ui_WIP_CheckBox_GetOptions);
pBool->registerGetValueHandler (ui_WIP_CheckBox_GetValue);
pBool->registerSetValueHandler (ui_WIP_CheckBox_SetValue);
}
#endif
return SEQU__NORMAL;
}
NLSStatus yarralink::prepare(MrProt *pMrProt, SeqLim *pSeqLim, SeqExpo *pSeqExpo)
{
NLS_STATUS lStatus = SEQU__NORMAL;
lStatus = fSUPrepSlicePosArray(VER_PTR(pMrProt), VER_PTR(pSeqLim), asSLC);
double dTotalMeasureTimeUsec = 1000;
pSeqExpo->setPreScans ( 0 );
pSeqExpo->setRFEnergyInSequence_Ws ( 0 );
pSeqExpo->setMeasuredPELines ( 0 );
pSeqExpo->setMeasured3dPartitions ( 0 );
pSeqExpo->setMeasureTimeUsec ( dTotalMeasureTimeUsec );
pSeqExpo->setTotalMeasureTimeUsec ( dTotalMeasureTimeUsec );
pSeqExpo->setRelevantReadoutsForMeasTime ( 0 );
// Launch the client during the final preparation of the sequence (i.e. after
// the apply button has been pressed). This will not occur if no patient is in
// the scanner because the adjustment scans will fail and stop the scan.
if ( pSeqLim->isContextNormal() )
{
if (!clientLaunched)
{
launchClient();
clientLaunched=true;
}
}
return (lStatus);
}
NLSStatus yarralink::check(MrProt *pMrProt, SeqLim *pSeqLim, SeqExpo *pSeqExpo, SEQCheckMode *pSEQCheckMode)
{
return (SEQU__NORMAL);
}
NLSStatus yarralink::run(MrProt *pMrProt, SeqLim *pSeqLim, SeqExpo *pSeqExpo)
{
return(SEQU__NORMAL);
}
NLS_STATUS yarralink::runKernel(MrProt *pMrProt,SeqLim *pSeqLim, SeqExpo *pSeqExpo, long lKernelMode, long lSlice, long lPartition, long lLine)
{
return(SEQU__NORMAL);
}
// ----------------------------------------------------------------------------------
// VD/VE line interface
// ----------------------------------------------------------------------------------
#ifndef VER_VB
NLSStatus yarralink::initialize (SeqLim &rSeqLim)
{
return initialize(&rSeqLim);
}
NLSStatus yarralink::prepare (MrProt &rMrProt, SeqLim &rSeqLim, SeqExpo &rSeqExpo)
{
return prepare(&rMrProt, &rSeqLim, &rSeqExpo);
}
NLSStatus yarralink::check (MrProt &rMrProt, SeqLim &rSeqLim, SeqExpo &rSeqExpo, SEQCheckMode * pSEQCheckMode)
{
return check(&rMrProt, &rSeqLim, &rSeqExpo, pSEQCheckMode);
}
NLSStatus yarralink::run (MrProt &rMrProt, SeqLim &rSeqLim, SeqExpo &rSeqExpo)
{
return run(&rMrProt, &rSeqLim, &rSeqExpo);
}
NLS_STATUS yarralink::runKernel(MrProt &rMrProt, SeqLim &rSeqLim, SeqExpo &rSeqExpo, long lKernelMode, long lSlice, long lPartition, long lLine)
{
return runKernel(&rMrProt, &rSeqLim, &rSeqExpo, lKernelMode, lSlice, lPartition, lLine);
}
#endif