KSFoundation  [October2024]
A platform for structured EPIC programming on GE MR systems
Prep sequence module: MT (ksmt.[h,cc,e])

Data Structures

struct  KSMT_DESIGN
 
struct  KSMT_MODULE
 

Macros

#define KSMT_DEFAULT_FLIP   670
 
#define KSMT_DEFAULT_RFOFFSET   1200
 
#define KSMT_DEFAULT_BW   150
 
#define KSMT_DEFAULT_SPOILERAREA   5000
 
#define KSMT_DEFAULT_RFDURATION   8000
 
#define KSMT_DEFAULT_SSITIME   1000 /* try to reduce this value */
 
#define KSMT_MODULE_LOADED
 
#define KSMT_INIT_DESIGN   {KSMT_OFF, KSMT_RF_FERMI, KSMT_DEFAULT_FLIP, KSMT_DEFAULT_RFOFFSET, KSMT_DEFAULT_BW, KSMT_DEFAULT_RFDURATION, KSMT_DEFAULT_SPOILERAREA, KSMT_DEFAULT_SSITIME}
 
#define KSMT_INIT_MODULE   {KS_INIT_BASE(KSMT_MODULE), KS_INIT_SEQ_CONTROL, KSMT_INIT_DESIGN, KS_INIT_RF, KS_INIT_TRAP, KS_NOTSET, 0, 0}
 

Enumerations

enum  { KSMT_OFF, KSMT_ON }
 
enum  { KSMT_RF_FERMI, KSMT_RF_BINO }
 

Functions

void ksmt_init_design (KSMT_DESIGN *design)
 
STATUS ksmt_eval_design (KSMT_MODULE *mt)
 
STATUS ksmt_pg (KSMT_MODULE *mt, int start_time, KS_SEQ_CONTROL *seqctrl_p)
 
void ksmt_set_design_from_UI (KSMT_DESIGN *design)
 

Variables

KSMT_MODULE ksmt = KSMT_INIT_MODULE
 
float ksmt_flip = KSMT_DEFAULT_FLIP with {0, 20000, KSMT_DEFAULT_FLIP, VIS, "RF flip angle [deg]",}
 
int ksmt_rftype = KSMT_RF_FERMI with {KSMT_RF_FERMI, KSMT_RF_BINO, KSMT_RF_FERMI, VIS, "RF type (0:fermi 1:bino)",}
 
int ksmt_bw = KSMT_DEFAULT_BW with {2, 100000, 300, VIS, "RF BW",}
 
int ksmt_rfduration = KSMT_DEFAULT_RFDURATION with {2, 10000, KSMT_DEFAULT_RFDURATION, VIS, "RF duration",}
 
int ksmt_rfoffset = KSMT_DEFAULT_RFOFFSET with {-10000, 10000, KSMT_DEFAULT_RFOFFSET, VIS, "RF freq offset [Hz]",}
 
float ksmt_spoilerarea = KSMT_DEFAULT_SPOILERAREA with {0, 10000, KSMT_DEFAULT_SPOILERAREA, VIS, "Spoiler area",}
 
int ksmt_ssi_time = KSMT_DEFAULT_SSITIME with {10, 20000, KSMT_DEFAULT_SSITIME, VIS, "Time from eos to ssi in intern trig",}
 

Detailed Description

Macro Definition Documentation

◆ KSMT_DEFAULT_FLIP

#define KSMT_DEFAULT_FLIP   670

◆ KSMT_DEFAULT_RFOFFSET

#define KSMT_DEFAULT_RFOFFSET   1200

◆ KSMT_DEFAULT_BW

#define KSMT_DEFAULT_BW   150

◆ KSMT_DEFAULT_SPOILERAREA

#define KSMT_DEFAULT_SPOILERAREA   5000

◆ KSMT_DEFAULT_RFDURATION

#define KSMT_DEFAULT_RFDURATION   8000

◆ KSMT_DEFAULT_SSITIME

#define KSMT_DEFAULT_SSITIME   1000 /* try to reduce this value */

◆ KSMT_MODULE_LOADED

#define KSMT_MODULE_LOADED

can be used to check whether the mt module has been included in a main psd

◆ KSMT_INIT_DESIGN

◆ KSMT_INIT_MODULE

Enumeration Type Documentation

◆ anonymous enum

anonymous enum
Enumerator
KSMT_OFF 
KSMT_ON 
27 {KSMT_OFF, KSMT_ON};
Definition: ksmt.h:27
Definition: ksmt.h:27

◆ anonymous enum

anonymous enum
Enumerator
KSMT_RF_FERMI 
KSMT_RF_BINO 
Definition: ksmt.h:28
Definition: ksmt.h:28

Function Documentation

◆ ksmt_init_design()

void ksmt_init_design ( KSMT_DESIGN design)

Initialize a MT design to off

Parameters
[out]designpointer to the MT design
Return values
STATUSSUCCESS or FAILURE
29  {
30  design->satmode = KSMT_OFF;
31 
32 } /* ksmt_init_design() */
Definition: ksmt.h:27
int satmode
Definition: ksmt.h:46

◆ ksmt_eval_design()

STATUS ksmt_eval_design ( KSMT_MODULE mt)

Populate objects from design

Parameters
[in,out]mtpointer to the module to be processed
Return values
STATUSSUCCESS or FAILURE
37  {
38  STATUS status;
39 
40  mt->end_time = 0;
41 
42  if (mt->design.satmode == KSMT_OFF) {
43  return SUCCESS;
44  }
45 
46  /* RF */
47  KS_DESCRIPTION tmpdesc;
49  if (mt->design.rftype == KSMT_RF_FERMI) {
50 
51  mt->rf = excnonsel_fermi100;
52  mt->rf.flip = mt->design.flip;
53  mt->rf.cf_offset = mt->design.rfoffset; /* Exciter offset in Hz */
55 
56  status = ks_eval_rf(&mt->rf, tmpdesc);
57  KS_RAISE(status);
58 
59  float rfstretchfactor = (float)(mt->design.rfduration) / (float)(mt->rf.rfwave.duration);
60  status = ks_eval_stretch_rf(&mt->rf, rfstretchfactor);
61  KS_RAISE(status);
62 
63  } else if (mt->design.rftype == KSMT_RF_BINO) {
64 
65  int sub_pulse_dur = 100;
66  int nPulses = 20;
67  int prp = 200;
68 
69  status = ks_eval_mt_rf_binomial(&mt->rf, tmpdesc, sub_pulse_dur, nPulses, prp);
70  KS_RAISE(status);
71 
73  status = ks_eval_rf(&mt->rf, tmpdesc);
74  KS_RAISE(status);
75 
76  }
77  /* ks_print_rf(mt->rf, stderr); fflush(stderr); */
78 
79  /* set up spoiler */
80  mt->spoiler.area = mt->design.spoilerarea;
81  status = ks_eval_trap_rotation_invariant_75_max_slewrate(&mt->spoiler, "ksmt_spoiler");
82  KS_RAISE(status);
83 
84 
85  /* setup seqctrl with desired SSI time and zero duration. .min_duration will be set in ksmt_pg() */
87  strcpy(mt->seqctrl.description, "ksmt");
88 
89  return SUCCESS;
90 
91 } /* ksmt_eval_design() */
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
Definition: ksmt.h:27
float cf_offset
Definition: KSFoundation.h:1030
int satmode
Definition: ksmt.h:46
int rfoffset
Definition: ksmt.h:49
int role
Definition: KSFoundation.h:1027
KSMT_DESIGN design
Definition: ksmt.h:67
Definition: ksmt.h:28
Definition: ksmt.h:28
float flip
Definition: KSFoundation.h:1028
DECL_TYPE KS_RF excnonsel_fermi100
Definition: KSFoundation_GERF.c:1325
float flip
Definition: ksmt.h:48
KS_TRAP spoiler
Definition: ksmt.h:69
KS_SEQ_CONTROL seqctrl
Definition: ksmt.h:66
void ks_init_seqcontrol(KS_SEQ_CONTROL *seqcontrol)
Resets KS_SEQ_CONTROL to its default value (KS_INIT_SEQ_CONTROL)
Definition: KSFoundation_host.c:148
int end_time
Definition: ksmt.h:70
KS_DESCRIPTION description
Definition: KSFoundation.h:745
void ks_create_suffixed_description(char *const out, const char *const prefix, const char *suffix,...) __attribute__((format(printf
KS_WAVE rfwave
Definition: KSFoundation.h:1037
STATUS ks_eval_mt_rf_binomial(KS_RF *rf, const char *const desc, int sub_pulse_dur, int nPulses, int prp)
Sets up a KS_RF object as a Binomial MT RF pulse
Definition: KSFoundation_host.c:2588
int rftype
Definition: ksmt.h:47
float area
Definition: KSFoundation.h:670
#define KS_RAISE(status)
Definition: KSFoundation.h:190
STATUS ks_eval_rf(KS_RF *rf, const char *const desc) WARN_UNUSED_RESULT
Sets up a KS_RF object
Definition: KSFoundation_host.c:2805
Definition: KSFoundation.h:2340
KS_RF rf
Definition: ksmt.h:68
KS_DESCRIPTION description
Definition: KSFoundation.h:1234
char KS_DESCRIPTION[KS_DESCRIPTION_LENGTH]
Definition: KSFoundation.h:351
float spoilerarea
Definition: ksmt.h:52
int rfduration
Definition: ksmt.h:51
STATUS ks_eval_stretch_rf(KS_RF *rf, float stretch_factor)
In-place stretching of a KS_RF object
Definition: KSFoundation_host.c:3928
int duration
Definition: KSFoundation.h:747

◆ ksmt_pg()

STATUS ksmt_pg ( KSMT_MODULE mt,
int  start_time,
KS_SEQ_CONTROL seqctrl_p 
)

Generate the waveforms of a MT module

If seqctrl_p is not NULL, it is assumed that the MT is generated within another sequence module, use start_time to control the positioning. The end_time field is set to be able to continue the pulse generation.

Parameters
[in,out]mtpointer to the module to be processed
[in]start_timetime position for the start of the MT waveforms
[in,out]seqctrl_poptional pointer to a sequence control for embedding
Return values
STATUSSUCCESS or FAILURE
100  {
101  STATUS status;
103 
104  if (!mt) {
105  return KS_THROW("the first argument can not be NULL");
106  }
107 
108  #ifdef HOST_TGT
110  mt->seqctrl.duration = 0;
111  #endif
112 
113  /* Initialize critical fields */
114  mt->embedded = 1;
115  mt->spoiling_counter = 0;
116 
117  /* return early if sat mode is off */
118  if (mt->design.satmode == KSMT_OFF) {
119  return SUCCESS;
120  }
121 
122  if (!seqctrl_p) {
123  /* If seqctrl_p is NULL we assume an independent sequence module will be generated */
124  seqctrl_p = &mt->seqctrl;
125  mt->embedded = 0;
126  }
127 
128  loc.pos = RUP_GRD(IMax(2, KS_RFSSP_PRETIME + 32, start_time));
129 
130  /* RF */
131  status = ks_pg_rf(&mt->rf, loc, seqctrl_p);
132  KS_RAISE(status);
133 
134  loc.pos += mt->rf.rfwave.duration;
135 
136  /* Y spoiler */
137  loc.board = YGRAD;
138  status = ks_pg_trap(&mt->spoiler, loc, seqctrl_p);
139  KS_RAISE(status);
140 
141  /* Z spoiler */
142  loc.board = ZGRAD;
143  status = ks_pg_trap(&mt->spoiler, loc, seqctrl_p);
144  KS_RAISE(status);
145 
146  loc.pos += mt->spoiler.duration;
147 
148  /* make sure we are divisible by GRAD_UPDATE_TIME (4us) */
149  loc.pos = RUP_GRD(loc.pos);
150 
151  mt->end_time = loc.pos;
152 
153 #ifdef HOST_TGT
154  /************************************************************************************************
155  * Set the minimal sequence duration
156  ***********************************************************************************************/
157  mt->seqctrl.ssi_time = mt->design.ssi_time;
159 #endif
160 
161  return SUCCESS;
162 
163 } /* ksmt_pg() */
Definition: ksmt.h:27
int satmode
Definition: ksmt.h:46
int pos
Definition: KSFoundation.h:463
KSMT_DESIGN design
Definition: ksmt.h:67
int board
Definition: KSFoundation.h:462
int duration
Definition: KSFoundation.h:1227
KS_TRAP spoiler
Definition: ksmt.h:69
KS_SEQ_CONTROL seqctrl
Definition: ksmt.h:66
int ssi_time
Definition: ksmt.h:53
int end_time
Definition: ksmt.h:70
KS_WAVE rfwave
Definition: KSFoundation.h:1037
STATUS ks_pg_rf(KS_RF *rf, KS_SEQLOC loc, KS_SEQ_CONTROL *ctrl) WARN_UNUSED_RESULT
Places a KS_RF sequence object on a board at some position in the pulse sequence
Definition: KSFoundation_common.c:2652
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
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
int embedded
Definition: ksmt.h:71
KS_RF rf
Definition: ksmt.h:68
#define KS_INIT_SEQLOC
Definition: KSFoundation.h:287
int duration
Definition: KSFoundation.h:673
#define KS_THROW(format,...)
Definition: KSFoundation.h:181
int spoiling_counter
Definition: ksmt.h:72
int duration
Definition: KSFoundation.h:747
#define KS_RFSSP_PRETIME
Definition: KSFoundation.h:217

◆ ksmt_set_design_from_UI()

void ksmt_set_design_from_UI ( KSMT_DESIGN design)

Set the design values of a MT module according to the scanner's UI

Parameters
[out]designPointer to a MT design
Return values
STATUSSUCCESS or FAILURE
79  {
80 
81  if (opmt) {
82  design->satmode = KSMT_ON;
83  } else {
84  design->satmode = KSMT_OFF;
85  }
86 
87  /* RF */
88  design->flip = ksmt_flip;
89  design->rfoffset = ksmt_rfoffset;
90  design->rftype = ksmt_rftype;
91  design->rfduration = ksmt_rfduration;
92  if (design->rftype == KSMT_RF_FERMI) {
93  design->bw = ksmt_bw;
94  } else if (KSMT_RF_BINO) {
95  /*design->bw = ksmt_bw;*/
96  }
97 
98  /* Spoiler */
99  design->spoilerarea = ksmt_spoilerarea;
100 
101  /* SSI time */
102  design->ssi_time = ksmt_ssi_time;
103 
104 } /* ksmt_set_design_from_UI() */
Definition: ksmt.h:27
int satmode
Definition: ksmt.h:46
int rfoffset
Definition: ksmt.h:49
Definition: ksmt.h:27
int ksmt_rfoffset
Definition: ksmt.e:60
Definition: ksmt.h:28
int ksmt_ssi_time
Definition: ksmt.e:62
Definition: ksmt.h:28
float flip
Definition: ksmt.h:48
int ksmt_bw
Definition: ksmt.e:58
int ssi_time
Definition: ksmt.h:53
float ksmt_spoilerarea
Definition: ksmt.e:61
int ksmt_rftype
Definition: ksmt.e:57
int rftype
Definition: ksmt.h:47
int bw
Definition: ksmt.h:50
float ksmt_flip
Definition: ksmt.e:56
int ksmt_rfduration
Definition: ksmt.e:59
float spoilerarea
Definition: ksmt.h:52
int rfduration
Definition: ksmt.h:51

Variable Documentation

◆ ksmt

◆ ksmt_flip

float ksmt_flip = KSMT_DEFAULT_FLIP with {0, 20000, KSMT_DEFAULT_FLIP, VIS, "RF flip angle [deg]",}

◆ ksmt_rftype

int ksmt_rftype = KSMT_RF_FERMI with {KSMT_RF_FERMI, KSMT_RF_BINO, KSMT_RF_FERMI, VIS, "RF type (0:fermi 1:bino)",}

◆ ksmt_bw

int ksmt_bw = KSMT_DEFAULT_BW with {2, 100000, 300, VIS, "RF BW",}

◆ ksmt_rfduration

int ksmt_rfduration = KSMT_DEFAULT_RFDURATION with {2, 10000, KSMT_DEFAULT_RFDURATION, VIS, "RF duration",}

◆ ksmt_rfoffset

int ksmt_rfoffset = KSMT_DEFAULT_RFOFFSET with {-10000, 10000, KSMT_DEFAULT_RFOFFSET, VIS, "RF freq offset [Hz]",}

◆ ksmt_spoilerarea

float ksmt_spoilerarea = KSMT_DEFAULT_SPOILERAREA with {0, 10000, KSMT_DEFAULT_SPOILERAREA, VIS, "Spoiler area",}

◆ ksmt_ssi_time

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