KSFoundation  [October2024]
A platform for structured EPIC programming on GE MR systems
ksepi_implementation.e File Reference
#include "ksdesign.h"
#include "ksscan.h"
#include "ksinversion.h"
#include "ksdiffusion.h"
#include <KSFoundation_KSRF.h>

Data Structures

struct  KSEPI_SEQUENCE
 
struct  KSEPI_FLEET_SEQUENCE
 
struct  KSEPI_METADATA
 

Macros

#define KSEPI_MINHNOVER   8 /* N.B. overscans below about 16-24 should be avoided for long TE */
 
#define KSEPI_MAXRBW_NORAMPSAMPLING   125.0
 
#define KSEPI_DEFAULT_SSI_TIME_ICEHARDWARE   100
 
#define KSEPI_DEFAULT_SSI_TIME   1500
 
#define PLAY_FLEET   ((int) (!KS_3D_SELECTED && oparc && opaccel_ph_stride > 1)) /* conditions when to play FLEET */
 
#define OPUSER_PSDVERSION   opuser0
 
#define SHOW_RHRECON   use0
 
#define OPUSER_KYNOVER   opuser1
 
#define SHOW_KYNOVER   use1
 
#define OPUSER_BLIPSIGN   opuser2
 
#define SHOW_BLIPSIGN   use2
 
#define OPUSER_EPIREADOUTMODE   opuser4
 
#define SHOW_EPIREADOUTMODE   use4
 
#define OPUSER_FLEET_EPIREADOUTMODE   opuser5
 
#define SHOW_FLEET_EPIREADOUTMODE   use5
 
#define OPUSER6_DIFF_RETURNMODE   opuser6 /* opuser6 is checked in recon_ksepi2, so don't chance this */
 
#define SHOW_DIFF_RETURNMODE   use6
 
#define OPUSER7_SWI_RETURNMODE   opuser7 /* opuser7 is checked in recon_ksepi2, so don't chance this */
 
#define SHOW_SWI_READOUTMODE   use7
 
#define OPUSER_REFLINES   opuser9
 
#define SHOW_REFLINES   use9
 
#define OPUSER_KZACSLINES   opuser15
 
#define SHOW_KZACSLINES   use15
 
#define KSEPI_INIT_SEQUENCE   {KS_INIT_SEQ_CONTROL, KS_INIT_EPI, KS_INIT_EPI, KS_INIT_TRAP, KS_INIT_SELRF, KS_INIT_SELRF, {KS_INIT_TRAP}, KS_INIT_WAIT, KS_INIT_WAIT, KS_INIT_TRAP, KS_INIT_TRAP}
 
#define KSEPI_FLEET_INIT_SEQUENCE   {KS_INIT_SEQ_CONTROL, KS_INIT_EPI, KS_INIT_TRAP, KS_INIT_SELRF, KS_INIT_WAIT, KS_INIT_WAIT}
 
#define KSEPI_INIT_METADATA   {KSEPI_SEQINDEX_MAIN, 0, 0, 0, 0, 0, 0, 0, 0, 0, KSEPI_SEQPART_EPITRAIN, KS_NOTSET, KS_NOTSET, 1}
 
#define KSEPI_PHASEENCODING_MEMORYPOOL_SIZE   25000
 

Enumerations

enum  KSEPI_SEQINDICES { KSEPI_SEQINDEX_MAIN, KSEPI_SEQINDEX_FLEET, KSEPI_SEQINDEX_MAIN_SPLITODDEVEN, KSEPI_SEQINDEX_FLEET_SPLITODDEVEN }
 
enum  KSEPI_SEQPARTS { KSEPI_SEQPART_EPITRAIN, KSEPI_SEQPART_DYNREFTRAIN, KSEPI_SEQPART_FIDNAV }
 

Functions

 abstract ("EPI [KSFoundation]")
 
 psdname ("ksepi")
 
STATUS ksepi_eval_flowcomp_phase (KS_TRAP *fcphase, const KS_EPI *epi, const char *desc)
 
STATUS ksepi_pg (int start_time)
 
KS_CORESLICETIME ksepi_scan_irslice (const SCAN_INFO *slice_pos, KS_DYNAMIC_STATE *dynamic)
 
KS_CORESLICETIME ksepi_scan_coreslice (const SCAN_INFO *slice_pos, KS_DYNAMIC_STATE *dynamic)
 
KS_CORESLICETIME ksepi_scan_coreslicegroup (const SCAN_INFO *slice_pos, KS_DYNAMIC_STATE *dynamic)
 
KS_CORESLICETIME ksepi_scan_fleet_coreslice (const SCAN_INFO *slice_pos, KS_DYNAMIC_STATE *dynamic)
 
void ksepi_scan_attach_metadata (KSEPI_SEQUENCE *seq, const KS_DYNAMIC_STATE *dynamic, uint8_t sequence_group)
 
void ksepi_dump_metadata (KSEPI_METADATA *metadata, const KS_DYNAMIC_STATE *dynamic)
 
STATUS ksepi_set_loop_control_design (KSSCAN_LOOP_CONTROL_DESIGN *loop_design, const KS_EPI *epitrain)
 
STATUS ksepi_scan_seqstate (SCAN_INFO slice_pos, KS_PHASEENCODING_COORD starting_coord, ks_enum_epiblipsign blipsign)
 
s64 ksepi_scan_scanloop ()
 
const KSSCAN_LOOP_CONTROLksepi_get_loop_ctrl ()
 
void ksepi_init_imagingoptions (void)
 
STATUS ksepi_init_UI (void)
 
STATUS ksepi_eval_UI ()
 
STATUS ksepi_eval_setuprf ()
 
STATUS ksepi_eval_setupfleet ()
 
STATUS ksepi_eval_setupobjects ()
 
STATUS ksepi_eval_TErange ()
 
void ksepi_set_kspace_design_forsat (KS_KSPACE_DESIGN *kdesign)
 
void ksepi_set_slicetiming_design (KS_SLICETIMING_DESIGN *slicetiming_design)
 
STATUS ksepi_set_inversion_loop_control_design (KSINV_LOOP_CONTROL_DESIGN *invloopctrl_design, const KS_EPI *epitrain)
 
STATUS ksepi_eval_inversion (KS_SEQ_COLLECTION *seqcollection)
 
STATUS ksepi_eval_sat (KS_SEQ_COLLECTION *seqcollection)
 
STATUS ksepi_gradheat_play (const INT max_encode_mode, int nargs, void **args)
 
STATUS ksepi_eval_loops (KS_SEQ_COLLECTION *seqcollection)
 
int ksepi_eval_ssitime ()
 
STATUS ksepi_eval_scantime (KS_SEQ_COLLECTION *seqcollection)
 
STATUS ksepi_update_UI ()
 
STATUS ksepi_predownload_plot (KS_SEQ_COLLECTION *seqcollection)
 
STATUS ksepi_predownload_setrecon ()
 
STATUS ksepi_pg_fleet (int start_time)
 
STATUS ksepi_fleet_scan_seqstate (const SCAN_INFO *slice_pos, KS_PHASEENCODING_COORD starting_coord, ks_enum_epiblipsign blipsign)
 
void ksepi_scan_rf_off ()
 
void ksepi_scan_attach_metadata (KS_EPI *epitrain, KS_EPI *dynreftrain, const KS_DYNAMIC_STATE *dynamic, uint8_t sequence_group)
 
STATUS ksepi_scan_init (void)
 
STATUS ksepi_scan_prescanloop (int nloops, int dda)
 

Variables

float ksepi_excthickness = 0
 
float ksepi_gscalerfexc = 0.9 with {0.1, 3.0, 0.9, VIS, "Excitation slice thk scaling (< 1.0 thicker slice)",}
 
int ksepi_slicecheck = 0 with {0, 1, 0, VIS, "move readout to z axis for slice thickness test",}
 
float ksepi_spoilerarea = 3000.0 with {0.0, 10000.0, 3000.0, VIS, "ksepi ksepi.spoiler gradient area",}
 
int ksepi_rfspoiling = 1 with {0, 1, 1, VIS, "Enable RF spoiling 1:on 0:off",}
 
int ksepi_fse90 = 0 with {0, 1, 0, VIS, "Use FSE90 instead of SPSP for non-fatsat",}
 
float ksepi_kissoff_factor = 0.04 with {0, 1, 0.04, VIS, "Slice oversampling fraction on each side (3D)",}
 
float ksepi_rfstretch_exc = 1.0 with {0.1,10.0, 1.0, VIS, "RF excitation stretch factor"}
 
int ksepi_fastexc3D = TRUE with {FALSE, TRUE, TRUE, VIS, "Sel. RF exc (3D) 0:EXC_SPSP_3D 1:EXC_FAST_SPSP_3D",}
 
float ksepi_crusher_dephasing = 6.0 with { 0.0, 100.0, 6.0, VIS, "crusher dephasing over slice [cycles]",}
 
float ksepi_gscalerfref = 0.9 with {0.1, 3.0, 0.9, VIS, "Refocusing slice thk scaling (< 1.0 thicker slice)",}
 
float ksepi_rfstretch_ref = 1.0 with {0.1,10.0, 1.0, VIS, "RF refocusing stretch factor",}
 
int ksepi_bridgecrushers = FALSE with {FALSE, TRUE, FALSE, VIS, "Bridge RF ref crushers",}
 
int ksepi_t1value_to_null = T1_FAT_3T with {0, 5s, T1_FAT_3T, VIS, "T1 value to NULL [us]",}
 
int ksepi_rampsampling = 1 with {0, 1, 1, VIS, "Rampsampling [0:OFF 1:ON]",}
 
int ksepi_readlobegap = 0 with {0, 10ms, 0, VIS, "extra gap between readout lobes [us]",}
 
int ksepi_echogap = 0 with {0, 100ms, 0, VIS, "extra gap between EPI echoes [us]",}
 
int ksepi_readsign = 1 with { -1, 1, 1, VIS, "Readout polarity: +1/-1",}
 
float ksepi_readampmax = 3.0 with {0.0, 5.0, 3.0, VIS, "Max grad amp for EPI readout lobes",}
 
float ksepi_sr = 0.01 with {0.0, , 0.01, VIS, "EPI SR: amp/ramp [(G/cm) / us]",}
 
int ksepi_esp = 0 with {0, 1000000, 0, VIS, "View-only: Echo spacing in [us]",}
 
int ksepi_blipsign = KS_EPI_POSBLIPS with {KS_EPI_NEGBLIPS, KS_EPI_POSBLIPS, KS_EPI_POSBLIPS, VIS, "Blip polarity: +1/-1",}
 
int ksepi_echotime_shifting = 1 with {0, 1, 1, VIS, "Enable echo time shifting for multi shot",}
 
int ksepi_kynover = 24 with {KSEPI_MINHNOVER, 512, 24, VIS, "#extralines for MinTE",}
 
int ksepi_kznover = 0 with {0, 512, 0, VIS, "#extralines in kz",}
 
int ksepi_kz_nacslines = 8 with {0, 64, 8, VIS, "#acslines in kz",}
 
int ksepi_caipi = 0 with {0, 512, 0, VIS, "CAIPIRINHA shift (affects 3D epi only. Set 0 for no CAIPI)",}
 
int ksepi_readout_mode = KS_EPI_BIPOLAR with {KS_EPI_BIPOLAR, KS_EPI_FLYBACK, KS_EPI_BIPOLAR, VIS, "EPI readout mode 0: bipolar 1:splitoddeven 2:flyback",}
 
int ksepi_fcy = 1 with {0, 1, 0, VIS, "Flowcomp Y when opfcomp"}
 
int ksepi_fcz = 1 with {0, 1, 0, VIS, "Flowcomp Z when opfcomp"}
 
int ksepi_fleet = 0 with {0, 1, 0, VIS, "FLEET calibration volume [0:OFF 1:ON]",}
 
int ksepi_echotime_shifting_fleet = 1 with {0, 1, 1, VIS, "Enable echo time shifting for multi shot FLEET",}
 
float ksepi_fleet_flip = 5.0 with {1.0, 90.0, 5.0, VIS, "FLEET flip angle [deg]",}
 
int ksepi_fleet_dda = 3 with {1, 200, 3, VIS, "Dummies for FLEET module",}
 
int ksepi_fleet_num_ky = 48 with {32, 256, 48, VIS, "Number of ky encodes for FLEET module",}
 
int ksepi_fleet_readout_mode = KS_EPI_SPLITODDEVEN with {KS_EPI_BIPOLAR, KS_EPI_FLYBACK, KS_EPI_SPLITODDEVEN, VIS, "FLEET EPI readout mode 0: bipolar 1:splitoddeven 2:flyback",}
 
int ksepi_fleet_nshots = 3 with {1, 128, 3, VIS, "# shots for FLEET",}
 
int ksepi_reflines = 0 with {0, 96, 0, VIS, "Number of phase reference lines per shot",}
 
int ksepi_swi_returnmode = 0 with {0, 7, 0, VIS, "SWI recon 0:Off 1:Acq 2:SWI 4:SWIphase",}
 
int ksepi_pos_start = KS_RFSSP_PRETIME with {0, , KS_RFSSP_PRETIME, INVIS, "us from start until the first waveform begins",}
 
int ksepi_ssi_time = KSEPI_DEFAULT_SSI_TIME with {32, , KSEPI_DEFAULT_SSI_TIME, VIS, "time from eos to ssi in intern trig",}
 
int ksepi_dda = 1 with {1, 200, 1, VIS, "Number of dummy scans for steady state",}
 
int ksepi_debug = 1 with {0, 100, 1, VIS, "Write out e.g. plot files (unless scan on HW)"}
 
int ksepi_imsize = KS_IMSIZE_POW2 with {KS_IMSIZE_NATIVE, KS_IMSIZE_MIN256, KS_IMSIZE_POW2, VIS, "img. upsamp. [0:native 1:pow2 2:min256]"}
 
int ksepi_abort_on_kserror = FALSE with {0, 1, 0, VIS, "Hard program abort on ks_error [0:OFF 1:ON]",}
 
int ksepi_ref_nsegments = 1 with {1, 512, 1, VIS, "Number of kz segments in reference volume",}
 
float ksepi_epiqfact = 1.0 with {1.0, 10.0, 1.0, VIS, "Quietness factor for the EPI readout only",}
 
int ksepi_recvgain_mode = RG_CAL_MODE_HIGH_FIXED with {RG_CAL_MODE_MIN, RG_CAL_MODE_MAX, RG_CAL_MODE_HIGH_FIXED, VIS, "RecvGain - 0:Measured 1:8 2:5 3:Max",}
 
int ksepi_metadump = 0
 
KSEPI_SEQUENCE ksepi = KSEPI_INIT_SEQUENCE
 
KSSCAN_LOOP_CONTROL ksepi_loopctrl = KSSCAN_INIT_LOOP_CONTROL
 
KSDIFF_CONTROL ksepi_diffctrl = KSDIFF_INIT_CONTROL
 
KSEPI_FLEET_SEQUENCE ksepi_fleetseq = KSEPI_FLEET_INIT_SEQUENCE
 
KSSCAN_LOOP_CONTROL ksepi_fleet_loopctrl = KSSCAN_INIT_LOOP_CONTROL
 
KSINV_MODULE ksepi_inv = KSINV_INIT_MODULE
 
KSINV_LOOP_CONTROL ksepi_inv_loopctrl = KSINV_INIT_LOOP_CONTROL
 
KS_PHASEENCODING_COORD ksepi_phaseencoding_memorypool [KSEPI_PHASEENCODING_MEMORYPOOL_SIZE] = {KS_INIT_PHASEENCODING_COORD}
 
int ksepi_interechotime = 0
 
float ksepi_echotime_shifting_shotdelay = 0.0
 
float ksepi_echotime_shifting_shotdelay_fleet = 0.0
 
int ksepi_echotime_shifting_sumdelay = 0
 
int ksepi_echotime_shifting_sumdelay_fleet = 0
 
KS_KSPACE_ACQ kacq = KS_INIT_KSPACE_ACQ
 
int sequence_iopts []
 
int rfspoiling_phase_counter = 0
 

Detailed Description

This file contains the implementation details for the ksepi psd