Data Structures | |
struct | KSGRE_SEQUENCE |
Macros | |
#define | KSGRE_DEFAULT_SSI_TIME 500 |
#define | KSGRE_INIT_SEQUENCE {KS_INIT_SEQ_CONTROL, KS_INIT_READTRAP, KS_INIT_TRAP, KS_INIT_PHASER, KS_INIT_TRAP, KS_INIT_SELRF}; |
Functions | |
STATUS | cvinit (void) |
STATUS | cveval (void) |
STATUS | my_cveval (void) |
STATUS | cvcheck (void) |
STATUS | predownload (void) |
STATUS | pulsegen (void) |
STATUS | mps2 (void) |
STATUS | aps2 (void) |
STATUS | scan (void) |
abstract ("GRE Tutorial [KSFoundation]") | |
psdname ("ksgre_tutorial") | |
int | ksgre_scan_sliceloop_nargs (int slperpass, int nargs, void **args) |
float | ksgre_scan_acqloop (int passindx) |
float | ksgre_scan_scanloop () |
STATUS | ksgre_scan_seqstate (SCAN_INFO slice_info, int kyview) |
void | ksgre_init_imagingoptions (void) |
STATUS | ksgre_init_UI (void) |
STATUS | ksgre_eval_UI () |
STATUS | ksgre_eval_setupobjects () |
STATUS | ksgre_eval_TErange () |
STATUS | ksgre_gradheat_play (const INT max_encode_mode, int nargs, void **args) |
STATUS | ksgre_eval_tr (KS_SEQ_COLLECTION *seqcollection) |
STATUS | ksgre_check () |
STATUS | ksgre_update_UI () |
STATUS | ksgre_predownload_plot (KS_SEQ_COLLECTION *seqcollection) |
STATUS | ksgre_predownload_setrecon () |
STATUS | ksgre_pg () |
int | ksgre_scan_coreslice (const SCAN_INFO *slice_pos, int dabslice, int kyindx, int exc) |
int | ksgre_scan_sliceloop (int slperpass, int passindx, int kyindx, int exc) |
STATUS | ksgre_scan_init (void) |
STATUS | ksgre_scan_prescanloop (int nloops, int dda) |
Variables | |
KS_SEQ_COLLECTION | seqcollection |
float | ksgre_gscalerfexc = 0.9 |
float | ksgre_spoilerarea = 2000.0 with {0.0, 10000.0, 2000.0, VIS, "ksgre spoiler gradient area",} |
int | ksgre_ssi_time = KSGRE_DEFAULT_SSI_TIME with {32, , KSGRE_DEFAULT_SSI_TIME, VIS, "time from eos to ssi in intern trig",} |
int | ksgre_dda = 2 with {0, 200, 2, VIS, "Number of dummy scans for steady state",} |
KSGRE_SEQUENCE | ksgre = KSGRE_INIT_SEQUENCE |
int | sequence_iopts [] |
int | volindx |
int | passindx |
#define KSGRE_DEFAULT_SSI_TIME 500 |
#define KSGRE_INIT_SEQUENCE {KS_INIT_SEQ_CONTROL, KS_INIT_READTRAP, KS_INIT_TRAP, KS_INIT_PHASER, KS_INIT_TRAP, KS_INIT_SELRF}; |
STATUS cvinit | ( | void | ) |
STATUS cveval | ( | void | ) |
STATUS my_cveval | ( | void | ) |
STATUS cvcheck | ( | void | ) |
STATUS predownload | ( | void | ) |
STATUS pulsegen | ( | void | ) |
STATUS mps2 | ( | void | ) |
STATUS aps2 | ( | void | ) |
STATUS scan | ( | void | ) |
abstract | ( | "GRE Tutorial " | [KSFoundation] | ) |
psdname | ( | "ksgre_tutorial" | ) |
int ksgre_scan_sliceloop_nargs | ( | int | slperpass, |
int | nargs, | ||
void ** | args | ||
) |
For TR timing heat/SAR calculations of regular 2D multislice sequences, GEReq_eval_TR(), ks_eval_mintr() and GEReq_eval_checkTR_SAR() use a standardized function pointer with a fixed set of input arguments to call the sliceloop of the main sequence with different number of slices to check current slice loop duration. As different pulse sequences may need different number of input arguments (with different meaning) this ksgre_scan_sliceloop_nargs() wrapper function provides the argument translation for ksgre_scan_sliceloop().
The function pointer must have an integer corresponding to the number of slices to use as its first argument while the remaining input arguments (to ksgre_scan_sliceloop()) are stored in the generic void pointer array with nargs
elements, which is then unpacked before calling ksgre_scan_sliceloop().
[in] | slperpass | Number of slices to play in the slice loop |
[in] | nargs | Number of extra input arguments to ksgre_scan_sliceloop() in range [0,4] |
[in] | args | Void pointer array pointing to the variables containing the actual values needed for ksgre_scan_sliceloop() |
slicelooptime | Time taken in [us] to play out slperpass slices |
float ksgre_scan_acqloop | ( | int | passindx | ) |
This function traverses through all phase encodes to be played out and runs the ksgre_scan_sliceloop() for each set of kyindx, and excitation. If ksgre_dda > 0, dummy scans will be played out before the phase encoding begins.
[in] | passindx | 0-based pass index in range [0, ks_slice_plan.npasses - 1] |
passlooptime | Time taken in [us] to play out all phase encodes and excitations for slperpass slices. Note that the value is a float instead of int to avoid int overrange at 38 mins of scanning |
float ksgre_scan_scanloop | ( | ) |
This function traverses through all phase encodes to be played out, and runs the ksgre_scan_sliceloop() for each set of kyindx and excitation. If ksgre_dda > 0, dummy scans will be played out before the phase encoding begins.
scantime | Total scan time in [us] (float to avoid int overrange after 38 mins) |
STATUS ksgre_scan_seqstate | ( | SCAN_INFO | slice_info, |
int | kyview | ||
) |
This function sets the current state of all ksgre sequence objects being part of KSGRE_SEQUENCE, incl. gradient amplitude changes, RF freq/phases and receive freq/phase based on current slice position and phase encoding indices.
The idea of having a 'seqstate' function is to be able to come back to a certain sequence state at any time and possibly play it out once more. This could for example be useful when certain lines or slices need to be rescanned due to image artifacts detected during scanning.
[in] | slice_info | Position of the slice to be played out (one element in the ks_scan_info[] array) |
[in] | kyview | Phase encoding index related to ksgre.phaseenc . A value outside of [0, ksgre.phaseenc.res-1] will set the phase encoding gradient amplitude to 0. |
STATUS | SUCCESS or FAILURE |
void ksgre_init_imagingoptions | ( | void | ) |
STATUS ksgre_init_UI | ( | void | ) |
STATUS | SUCCESS or FAILURE |
STATUS ksgre_eval_UI | ( | ) |
STATUS | SUCCESS or FAILURE |
STATUS ksgre_eval_setupobjects | ( | ) |
STATUS | SUCCESS or FAILURE |
STATUS ksgre_eval_TErange | ( | ) |
STATUS | SUCCESS or FAILURE |
STATUS ksgre_gradheat_play | ( | const INT | max_encode_mode, |
int | nargs, | ||
void ** | args | ||
) |
This function
It should be noted that the content of this function is manual work and needs to be updated if the content of ksgre_pg() or used sequence modules are changed for the gradient heating to be accurate. So if, for example, major dynamic changes of gradient amplitudes or which sequence modules that are used, this function should be updated accordingly.
As ks_eval_getduration() and ks_eval_hwlimits() are common for all sequences, this function has to have nargs and args as input arguments, but they are not used for this psd. See ksgre_eval_tr() for more details.
[in] | max_encode_mode | The maximum encoding mode, which can be either AVERAGE_POWER or MAXIMUM_POWER. |
[in] | nargs | (not used) Number of extra input arguments (# elements of void pointer array **args) |
[in] | args | (not used) Void pointer array with nargs elements (may be NULL) |
STATUS | SUCCESS or FAILURE |
STATUS ksgre_eval_tr | ( | KS_SEQ_COLLECTION * | seqcollection | ) |
With the current sequence collection (see my_cveval()), and a function pointer to an argument-standardized wrapper function (ksgre_scan_sliceloop_nargs()) to the slice loop function (ksgre_scan_sliceloop(), this function calls GEReq_eval_TR(), where number of slices that can fit within one TR is determined by adding more slices as input argument to the slice loop function. For more details see GEReq_eval_TR().
With the number of slices/TR now known, a standard 2D slice plan is set up using ks_calc_sliceplan() and the duration of the main sequence is increased based on timetoadd_perTR, which was returned by GEReq_eval_TR(). timetoadd_perTR > 0 when optr > avmintr and when heat or SAR restrictions requires avmintr
to be larger than the net sum of sequence modules in the slice loop.
At the end of this function, TR validation and heat/SAR checks are done using GEReq_eval_checkTR_SAR().
[in] | seqcollection | Pointer to the KS_SEQ_COLLECTION struct holding all sequence modules |
STATUS | SUCCESS or FAILURE |
STATUS ksgre_check | ( | ) |
STATUS ksgre_update_UI | ( | ) |
STATUS | SUCCESS or FAILURE |
STATUS ksgre_predownload_plot | ( | KS_SEQ_COLLECTION * | seqcollection | ) |
Otherwise the function first prints out the textfile: <ks_psdname>_objects.txt, which contains the specs of most sequence components in the sequence.
The rest of the function is the plotting the main sequence diagram as HTML file, and lastly the sequence timing plot, showing slice location on the y-axis and time on the x-axis for all sequence modules (here only 1) at the same time.
For the slicetiming plot, the three functions ks_plot_slicetime_begin();ksgre_scan_scanloop();ks_plot_slicetime_end(); creates a corresponding JSON file, followed by a system call to the python script psdplot/psdplot_slicetime.py to create the HTML plot.
STATUS | SUCCESS or FAILURE |
STATUS ksgre_predownload_setrecon | ( | ) |
For most cases, the GEReq_predownload_*** functions in predownload() in ksgre.e set up the necessary rh*** variables for the reconstruction to work properly. However, if this sequence is customized, certain rh*** variables may need to be changed. Doing this here instead of in predownload() directly separates these changes from the standard behavior.
STATUS | SUCCESS or FAILURE |
STATUS ksgre_pg | ( | ) |
This is the main pulse sequence in ksgre.e using the sequence objects in KSGRE_SEQUENCE with the sequence module name "ksgremain" (= ksgre.seqctrl.description)
STATUS | SUCCESS or FAILURE |
int ksgre_scan_coreslice | ( | const SCAN_INFO * | slice_pos, |
int | dabslice, | ||
int | kyindx, | ||
int | exc | ||
) |
On TGT on the MR system (PSD_HW), this function sets up (ksgre_scan_seqstate()) and plays out the core ksgre sequence with optional sequence modules also called in this function. The low-level function call startseq()
, which actually starts the realtime sequence playout is called from within ks_scan_playsequence(), which in addition also returns the time to play out that sequence module (see time += ...).
On HOST (in ksgre_eval_tr()) we call ksgre_scan_sliceloop_nargs(), which in turn calls this function that returns the total time in [us] taken to play out this core slice. These times are increasing in each parent function until ultimately ksgre_scan_scantime(), which returns the total time of the entire scan.
After each call to ks_scan_playsequence(), ks_plot_slicetime() is called to add slice-timing information on file for later PDF-generation of the sequence. As scanning is performed in real-time and may fail if interrupted, ks_plot_slicetime() will return quietly if it detects both IPG (TGT) and PSD_HW (on the MR scanner). See predownload() for the PNG/PDF generation.
[in] | slice_pos | Position of the slice to be played out (one element in the global ks_scan_info[] array) |
[in] | dabslice | 0-based slice index for data storage |
[in] | kyindx | Phase encoding index related to ksgre.phaseenc . A value outside of [0, ksgre.phaseenc.res-1] will set the phase encoding gradient amplitude to 0. |
[in] | exc | Excitation index in range [0, NEX-1], where NEX = number of excitations (opnex) |
coreslicetime | Time taken in [us] to play out one slice with potentially other sequence modules |
int ksgre_scan_sliceloop | ( | int | slperpass, |
int | passindx, | ||
int | kyindx, | ||
int | exc | ||
) |
slperpass
slices corresponding to one TRThis function gets a spatial slice location index based on the pass index and temporal position within current pass. It then calls ksgre_scan_coreslice() to play out one coreslice (i.e. the main ksgre main sequence + optional sequence modules, excluding inversion modules).
[in] | slperpass | Number of slices to play in the slice loop |
[in] | passindx | 0-based pass index in range [0, ks_slice_plan.npasses - 1] |
[in] | kyindx | Phase encoding index related to ksgre.phaseenc . A value outside of [0, ksgre.phaseenc.res-1] will set the phase encoding gradient amplitude to 0. |
[in] | exc | Excitation index in range [0, NEX-1], where NEX = number of excitations (opnex) |
slicelooptime | Time taken in [us] to play out slperpass slices |
STATUS ksgre_scan_init | ( | void | ) |
STATUS | SUCCESS or FAILURE |
STATUS ksgre_scan_prescanloop | ( | int | nloops, |
int | dda | ||
) |
STATUS | SUCCESS or FAILURE |
KS_SEQ_COLLECTION seqcollection |
float ksgre_gscalerfexc = 0.9 |
float ksgre_spoilerarea = 2000.0 with {0.0, 10000.0, 2000.0, VIS, "ksgre spoiler gradient area",} |
int ksgre_ssi_time = KSGRE_DEFAULT_SSI_TIME with {32, , KSGRE_DEFAULT_SSI_TIME, VIS, "time from eos to ssi in intern trig",} |
int ksgre_dda = 2 with {0, 200, 2, VIS, "Number of dummy scans for steady state",} |
KSGRE_SEQUENCE ksgre = KSGRE_INIT_SEQUENCE |
int sequence_iopts[] |
int volindx |
int passindx |