KSFoundation  [October2024]
A platform for structured EPIC programming on GE MR systems
All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
Combined ChemSat & Spatial prep sequence (kssat.e) using kschemsat.[h,cc], ksmt.[h,cc] & ksspsat.[h,cc]

Data Structures

struct  KSSAT_MODULE
 

Macros

#define KSSAT_INIT_MODULE   {KS_INIT_SEQ_CONTROL, KSMT_INIT_MODULE, KSCHEMSAT_INIT_MODULE, KSSPSAT_INIT_MODULE, KS_INIT_TRAP}
 

Functions

STATUS kssat_setup_from_UI (KSSAT_MODULE *sat, KS_KSPACE_DESIGN *kspace_design, KS_SLICETIMING_DESIGN *slicetiming_design, float slthick, KS_SEQ_COLLECTION *seqcollection)
 
STATUS kssat_pg (KSSAT_MODULE *sat)
 
int kssat_scan (const SCAN_INFO *slice_info, KS_DYNAMIC_STATE *dynamic, KSSAT_MODULE *sat)
 

Variables

KSSAT_MODULE kssat = KSSAT_INIT_MODULE
 
int kssat_ssi_time = KSCHEMSAT_DEFAULT_SSITIME with {10, 20000, KSCHEMSAT_DEFAULT_SSITIME, VIS, "Time from eos to ssi in intern trig",}
 

Detailed Description

Macro Definition Documentation

◆ KSSAT_INIT_MODULE

Function Documentation

◆ kssat_setup_from_UI()

STATUS kssat_setup_from_UI ( KSSAT_MODULE sat,
KS_KSPACE_DESIGN kspace_design,
KS_SLICETIMING_DESIGN slicetiming_design,
float  slthick,
KS_SEQ_COLLECTION seqcollection 
)

Setup the saturation module on the host from the scanner's UI

This helper function, sets up the disigns from the scanner's UI, evals them, dry-runs the waveform generation and adds the module's sequence control to the sequence collection.

Parameters
[in,out]satPointer to a saturation module
[in]kspace_designPointer to the k-space design of the main module, needed for FOV and resolution
[in]slicetiming_designPointer to the slice timing design, needed for the slice locations
[in]slthickSlice thickness
[in,out]seqcollectionPointer to the seqcollection
Return values
STATUSSUCCESS or FAILURE
132  {
133  STATUS status;
134 
136 
137  status = ksmt_eval_design(&sat->mt);
138  KS_RAISE(status);
139 
141 
142  status = kschemsat_eval_design(&sat->chemsat);
143  KS_RAISE(status);
144 
146 
147  sat->spsat.design.rf_spoiling_flag = PSD_ON; /* turn on RF-spoiling */
148  status = ksspsat_eval(&sat->spsat, kspace_design, slicetiming_design, slthick);
149  KS_RAISE(status);
150 
151  /* Eventually to be used as unique spoiler, off for now */
152  sat->spoiler.area = 0; /* KSSPSAT_DEFAULT_SPOILERAREA */
153  status = ks_eval_trap_rotation_invariant_75_max_slewrate(&sat->spoiler, "kssat_spoiler");
154  KS_RAISE(status);
155 
156  /* Turn off MT spoiler if any other sat is used */
157  if (sat->chemsat.design.satmode > 0 || sat->spsat.state.N_impl_sat_pulses > 0 || sat->spsat.state.N_expl_sat_pulses > 0) {
158  sat->mt.spoiler.duration = 0;
159  }
160 
161  status = kssat_pg(sat);
162  KS_RAISE(status);
163 
164  strcpy(sat->seqctrl.description, "kssat");
166  KS_RAISE(status);
167 
168  return SUCCESS;
169 
170 } /* kssat_setup_from_UI() */
KS_SEQ_CONTROL seqctrl
Definition: kssat.e:53
STATUS ks_eval_trap_rotation_invariant_75_max_slewrate(KS_TRAP *trap, const char *const desc)
Sets up a trapezoid using a KS_TRAP sequence object with physical gradient constraints (invariant to ...
Definition: KSFoundation_host.c:524
int satmode
Definition: kschemsat.h:46
int rf_spoiling_flag
Definition: ksspsat.h:88
KS_TRAP spoiler
Definition: kssat.e:57
KSSPSAT_MODULE spsat
Definition: kssat.e:56
KSMT_MODULE mt
Definition: kssat.e:54
KSMT_DESIGN design
Definition: ksmt.h:67
STATUS ksmt_eval_design(KSMT_MODULE *mt)
Populate objects from design
Definition: ksmt.cc:37
STATUS kssat_pg(KSSAT_MODULE *sat)
Place all waveforms for the saturation module
Definition: kssat.e:180
STATUS ks_eval_addtoseqcollection(KS_SEQ_COLLECTION *seqcollection, KS_SEQ_CONTROL *seqctrl) WARN_UNUSED_RESULT
Adds a sequence module (KS_SEQ_CONTROL) to the KS_SEQ_COLLECTION struct for later RF scaling and SAR ...
Definition: KSFoundation_host.c:207
KSCHEMSAT_MODULE chemsat
Definition: kssat.e:55
STATUS kschemsat_eval_design(KSCHEMSAT_MODULE *chemsat)
Populate objects from design
Definition: kschemsat.cc:40
KSSPSAT_STATE state
Definition: ksspsat.h:108
void ksmt_set_design_from_UI(KSMT_DESIGN *design)
Set the design values of a MT module according to the scanner's UI
Definition: ksmt.e:79
KS_TRAP spoiler
Definition: ksmt.h:69
float area
Definition: KSFoundation.h:670
#define KS_RAISE(status)
Definition: KSFoundation.h:190
KSCHEMSAT_DESIGN design
Definition: kschemsat.h:67
STATUS ksspsat_set_design_from_UI(KSSPSAT_DESIGN *spsat_design)
Set the design values of a spatial sat module according to the scanner's UI
Definition: ksspsat.e:153
int N_expl_sat_pulses
Definition: ksspsat.h:101
KSSPSAT_DESIGN design
Definition: ksspsat.h:107
KS_SEQ_COLLECTION seqcollection
Definition: ksepi.e:82
KS_DESCRIPTION description
Definition: KSFoundation.h:1234
void kschemsat_set_design_from_UI(KSCHEMSAT_DESIGN *design)
Set the design values of a chemical sat module according to the scanner's UI
Definition: kschemsat.e:78
STATUS ksspsat_eval(KSSPSAT_MODULE *spsat_module, KS_KSPACE_DESIGN *kspace_design, KS_SLICETIMING_DESIGN *slicetiming_design, float slthick)
Helper function that performs all eval functions in order
Definition: ksspsat.cc:329
int duration
Definition: KSFoundation.h:673
int N_impl_sat_pulses
Definition: ksspsat.h:100

◆ kssat_pg()

STATUS kssat_pg ( KSSAT_MODULE sat)

Place all waveforms for the saturation module

Parameters
[in,out]satPointer to a saturation module
Return values
STATUSSUCCESS or FAILURE
180  {
181  STATUS status;
183 
184 #ifndef IPG
186 #endif
187  strcpy(sat->seqctrl.description, "kssat");
188 
189 
190  /* Spatial Sat */
191  const int spsat_start_time = 0;
192  status = ksspsat_pg(&sat->spsat, spsat_start_time, &sat->seqctrl);
193  KS_RAISE(status);
194  loc.pos = sat->spsat.end_time;
195 
196  /* MT */
197  const int mt_start_time = loc.pos + (sat->spsat.end_time > 0) * (KS_RFSSP_PRETIME + KS_RFSSP_POSTTIME);
198  status = ksmt_pg(&sat->mt, mt_start_time, &sat->seqctrl);
199  KS_RAISE(status);
200  loc.pos = IMax(2, sat->spsat.end_time, sat->mt.end_time);
201 
202  /* Fat Sat */
203  const int chemsat_start_time = loc.pos + (sat->spsat.end_time > 0 || sat->mt.end_time > 0) * (KS_RFSSP_PRETIME + KS_RFSSP_POSTTIME);
204  status = kschemsat_pg(&sat->chemsat, chemsat_start_time, &sat->seqctrl);
205  KS_RAISE(status);
206  loc.pos = IMax(3, sat->spsat.end_time, sat->mt.end_time, sat->chemsat.end_time);
207 
208 
209  /* Common spoiler for all saturation pulses (inactive since kssat_setup_from_UI():spoiler.area currently 0) */
210  loc.ampscale = 1.0;
211 
212  if (loc.pos > 0 && sat->spoiler.duration > 0) {
213  loc.board = YGRAD;
214  status = ks_pg_trap(&sat->spoiler, loc, &sat->seqctrl);
215  KS_RAISE(status);
216 
217  loc.board = ZGRAD;
218  status = ks_pg_trap(&sat->spoiler, loc, &sat->seqctrl);
219  KS_RAISE(status);
220 
221  loc.pos += sat->spoiler.duration;
222  }
223 
224 #ifdef HOST_TGT
225  {
228  }
229 #endif
230 
231  return SUCCESS;
232 
233 } /* kssat_pg() */
KS_SEQ_CONTROL seqctrl
Definition: kssat.e:53
KS_TRAP spoiler
Definition: kssat.e:57
KSSPSAT_MODULE spsat
Definition: kssat.e:56
KSMT_MODULE mt
Definition: kssat.e:54
int pos
Definition: KSFoundation.h:463
STATUS ksspsat_pg(KSSPSAT_MODULE *spsat_module, int start_time, KS_SEQ_CONTROL *ctrl)
Place all waveforms for the spatial sat module
Definition: ksspsat.cc:358
int end_time
Definition: kschemsat.h:70
int board
Definition: KSFoundation.h:462
float ampscale
Definition: KSFoundation.h:464
KSCHEMSAT_MODULE chemsat
Definition: kssat.e:55
KS_GRADRFCTRL gradrf
Definition: KSFoundation.h:1236
void ks_init_gradrfctrl(KS_GRADRFCTRL *gradrfctrl)
Resets KS_GRADRFCTRL to its default value (KS_INIT_GRADRFCTRL)
Definition: KSFoundation_host.c:141
#define KS_RFSSP_POSTTIME
Definition: KSFoundation.h:218
int end_time
Definition: ksspsat.h:111
int end_time
Definition: ksmt.h:70
STATUS ks_pg_trap(KS_TRAP *trap, KS_SEQLOC loc, KS_SEQ_CONTROL *ctrl) WARN_UNUSED_RESULT
Places a KS_TRAP sequence object on a board at some position in the pulse sequence
Definition: KSFoundation_common.c:1802
#define KS_RAISE(status)
Definition: KSFoundation.h:190
typedef struct used as argument to ks_pg_*** functions to control where and when to place a sequence ...
Definition: KSFoundation.h:461
STATUS ksmt_pg(KSMT_MODULE *mt, int start_time, KS_SEQ_CONTROL *seqctrl_p)
Generate the waveforms of a MT module
Definition: ksmt.cc:100
STATUS kschemsat_pg(KSCHEMSAT_MODULE *chemsat, int start_time, KS_SEQ_CONTROL *seqctrl_p)
Generate the waveforms of a chemical sat module
Definition: kschemsat.cc:89
int ssi_time
Definition: KSFoundation.h:1226
STATUS ks_eval_seqctrl_setminduration(KS_SEQ_CONTROL *seqctrl, int mindur)
Sets the minimum duration and duration fields of a KS_SEQ_CONTROL struct based on some minimum time (...
Definition: KSFoundation_host.c:4921
#define KS_INIT_SEQLOC
Definition: KSFoundation.h:287
KS_DESCRIPTION description
Definition: KSFoundation.h:1234
int kssat_ssi_time
Definition: kssat.e:118
int duration
Definition: KSFoundation.h:673
#define KS_RFSSP_PRETIME
Definition: KSFoundation.h:217

◆ kssat_scan()

int kssat_scan ( const SCAN_INFO *  slice_info,
KS_DYNAMIC_STATE *  dynamic,
KSSAT_MODULE sat 
)

Change the dynamic state for a saturation module

Parameters
[in]slice_infoSlice orientation for the current slice
dynamicDynamic parameters, used for updating the sat band locations according to the Mphysical and Mlogical transformations. The former is used for prospective motion correction while the latter is used for, e.g, rotating the blades in a PROPELLER sequence.
[in,out]satPointer to a saturation module
Returns
int Duration of the module [us]
241  {
242 
243  /* RF-Spoiling */
244  if (sat->spsat.design.rf_spoiling_flag == PSD_ON){
245  float rfphase = ks_scan_rf_phase_spoiling(sat->spsat.state.rf_counter++);
246  ks_scan_rf_setphase(&sat->chemsat.rf, INSTRALL, rfphase);
247  }
248 
249  ksspsat_scan_seqstate(slice_info, dynamic, &sat->spsat);
250 
252  return ks_scan_playsequence(&sat->seqctrl);
253 }
KS_SEQ_CONTROL seqctrl
Definition: kssat.e:53
float ks_scan_rf_phase_spoiling(int counter)
Returns spoiling phase for a given RF counter
Definition: KSFoundation_common.c:4827
int rf_spoiling_flag
Definition: ksspsat.h:88
KSSPSAT_MODULE spsat
Definition: kssat.e:56
void ks_scan_rf_setphase(KS_RF *rf, int instanceno, float rfphase)
Updates the phase of one or all instances of an RF pulse (KS_RF)
Definition: KSFoundation_tgt.c:789
int rf_counter
Definition: ksspsat.h:99
#define KS_NOTSET
Definition: KSFoundation.h:115
KS_RF rf
Definition: kschemsat.h:68
KSCHEMSAT_MODULE chemsat
Definition: kssat.e:55
void ksspsat_scan_seqstate(const SCAN_INFO *slice_info, KS_DYNAMIC_STATE *dynamic, KSSPSAT_MODULE *spsat)
Change the dynamic state for a spatial sat module
Definition: ksspsat.cc:423
KSSPSAT_STATE state
Definition: ksspsat.h:108
int ks_scan_playsequence(KS_SEQ_CONTROL *ctrl)
Definition: KSFoundation_tgt.c:1644
Definition: KSFoundation.h:403
KSSPSAT_DESIGN design
Definition: ksspsat.h:107
void ks_plot_slicetime(const KS_SEQ_CONTROL *ctrl, int nslices, float *slicepos_mm, float slthick_mm, KS_PLOT_EXCITATION_MODE exctype)
ADDTITLEHERE
Definition: KSFoundation_common.c:4276

Variable Documentation

◆ kssat

◆ kssat_ssi_time

int kssat_ssi_time = KSCHEMSAT_DEFAULT_SSITIME with {10, 20000, KSCHEMSAT_DEFAULT_SSITIME, VIS, "Time from eos to ssi in intern trig",}