#include <RtpPsd.h>
#include <PromoCommon.h>
#include "stddef_ep.h"
#include "pulsegen.h"
#include "epic.global.h"
#include "epicfuns.h"
#include "epicmsg.h"
#include "epicconf.h"
#include "ca_filt.h"
#include "psdutil.h"
Data Structures | |
union | Indices |
Functions | |
STATUS | scale (FLOAT(*inrotmat)[9], long(*outrotmat)[9], INT slquant, LOG_GRAD *lgrad, PHYS_GRAD *pgrad, INT contdebug) |
unsigned short | ks_scan_omegawave_hz (KS_WAVE *wave, int instanceno, float Hz, int omega_iwave_phase_at_null) |
unsigned short | ks_scan_omegatrap_hz (KS_TRAP *trp, int instanceno, float Hz, int omega_iwave_phase_at_null) |
void | ks_scan_wait (KS_WAIT *wait, int waitperiod) |
void | ks_scan_wave_ampscale (KS_WAVE *wave, int instanceno, float ampscale) |
void | ks_scan_trap_ampscale (KS_TRAP *trp, int instanceno, float ampscale) |
void | ks_scan_trap_ampscale_slice (KS_TRAP *trp, int start, int skip, int count, float ampscale) |
void | ks_scan_phaser_kmove (KS_PHASER *phaser, int instanceno, double pixelunits) |
double | ks_scan_phaser_compute_kmove (KS_PHASER *phaser, int view) |
void | ks_scan_phaser_toline (KS_PHASER *phaser, int instanceno, int view) |
void | ks_scan_phaser_fromline (KS_PHASER *phaser, int instanceno, int view) |
void | ks_scan_phaser_average (KS_PHASER *phaser, int instanceno) |
void | ks_scan_phaser_max (KS_PHASER *phaser, int instanceno) |
void | ks_scan_rf_ampscale (KS_RF *rf, int instanceno, float ampscale) |
void | ks_scan_rf_on (KS_RF *rf, int instanceno) |
void | ks_scan_rf_on_chop (KS_RF *rf, int instanceno) |
void | ks_scan_rf_off (KS_RF *rf, int instanceno) |
void | ks_scan_selrf_setfreqphase_pins (KS_SELRF *selrf, int instanceno, SCAN_INFO sliceinfo, int sms_multiband_factor, float sms_slice_gap, float rfphase) |
void | ks_scan_selrf_setfreqphase (KS_SELRF *selrf, int instanceno, SCAN_INFO sliceinfo, float rfphase) |
void | ks_scan_rf_setphase (KS_RF *rf, int instanceno, float rfphase) |
void | ks_scan_setwavestate (KS_WAVE *wave, int state, int instance) |
void | ks_scan_wave2hardware (KS_WAVE *wave, const KS_WAVEFORM newwaveform, int state) |
void | ks_scan_offsetfov_iso (KS_READTRAP *readtrap, int instanceno, SCAN_INFO sliceinfo, double ky, double kz, double rcvphase) |
void | ks_scan_offsetfov_iso_readwave (KS_READWAVE *readwave, int instanceno, SCAN_INFO sliceinfo, double ky, double kz, double rcvphase) |
void | ks_scan_offsetfov (KS_READTRAP *readtrap, int instanceno, SCAN_INFO sliceinfo, float ky, float phasefovratio, float rcvphase) |
void | ks_scan_offsetfov3D (KS_READTRAP *readtrap, int instanceno, SCAN_INFO sliceinfo, float ky, float phasefovratio, float kz, float zphasefovratio, float rcvphase) |
void | ks_scan_offsetfov_readwave (KS_READWAVE *readwave, int instanceno, SCAN_INFO sliceinfo, float ky, float phasefovratio, float rcvphase) |
void | ks_scan_offsetfov3D_readwave (KS_READWAVE *readwave, int instanceno, SCAN_INFO sliceinfo, float ky, float phasefovratio, float kz, float zphasefovratio, float rcvphase) |
float * | ks_scan_getrotate (void) |
void | ks_scan_rotate (SCAN_INFO slice_pos) |
void | ks_scan_isirotate (KS_ISIROT *isirot) |
int | ks_scan_getsliceloc (const KS_SLICE_PLAN *slice_plan, int passindx, int sltimeinpass) |
int | ks_scan_getslicetime (const KS_SLICE_PLAN *slice_plan, int passindx, int slloc) |
ks_enum_epiblipsign | ks_scan_epi_verify_phaseenc_plan (KS_EPI *epi, KS_PHASEENCODING_PLAN *phaseenc_plan, int shot) |
ks_enum_epiblipsign | _compute_epi_blipsign (KS_EPI *epi, KS_PHASEENCODING_COORD starting_coord) |
void | ks_scan_epi_shotcontrol_sms (KS_EPI *epi, int echo, SCAN_INFO sliceinfo, KS_PHASEENCODING_COORD starting_coord, ks_enum_epiblipsign blipsign, float rcvphase, int sms_factor, float sms_slice_gap, int caipi_factor, int sms_slice_encoding_direction) |
void | ks_scan_epi_shotcontrol (KS_EPI *epi, int echo, SCAN_INFO sliceinfo, KS_PHASEENCODING_COORD starting_coord, ks_enum_epiblipsign blipsign, float rcvphase) |
void | ks_scan_epi_loadecho (KS_EPI *epi, int echo, int storeecho, int slice, KS_PHASEENCODING_COORD starting_coord, ks_enum_epiblipsign blipsign, KS_DYNAMIC_STATE *dynamic) |
void | ks_set_opcode (WF_PULSE_ADDR echo, short opcode) |
void | ks_loaddab_reserved (WF_PULSE_ADDR echo, short state, short resampler_index) |
void | ks_loaddab (WF_PULSE_ADDR echo, const char *custom_dab_array) |
void | ks_loaddab_full (WF_PULSE_ADDR echo, const char *custom_dab_array) |
WF_PULSE_ADDR | ks_get_wf_pulse (KS_ECHOTRAIN *echotrain, const int readout_index) |
LONG | ks_get_override_R1 (KS_ECHOTRAIN *echotrain, const int readout_index) |
void | ks_scan_acq_to_rtp (KS_READ *acq, TYPDAB_PACKETS dabacqctrl, float fatoffset) |
STATUS | boffset (long *offsets) |
void | ks_scan_switch_to_sequence (KS_SEQ_CONTROL *ctrl) |
STATUS | setssitime (long) |
STATUS | startseq (s16, s16) |
int | ks_scan_playsequence (KS_SEQ_CONTROL *ctrl) |
STATUS | ks_scan_loaddabwithindices_nex (WF_PULSE_ADDR pulse, LONG slice, LONG echo, LONG view, uint8_t acq, uint8_t vol, LONG operation, TYPDAB_PACKETS acqon_flag) |
STATUS | ks_scan_loaddabwithindices (WF_PULSE_ADDR pulse, LONG slice, LONG echo, LONG view, uint8_t acq, uint8_t vol, TYPDAB_PACKETS acqon_flag) |
int | ks_scan_wait_for_rtp (void *rtpmsg, int maxmsgsize, int maxwait, KS_SEQ_CONTROL *waitctrl) |
void | ks_copy_and_reset_obj (void *pobj) |
void | ks_tgt_reset_gradrfctrl (KS_GRADRFCTRL *gradrfctrl) |
void | ks_show_clock (FLOAT scantime) |
STATUS | acqq_longdab (WF_PULSE_ADDR pulse, LONG pos_ref, LONG dab_ref, LONG xtr_ref, LONG fslot_value) |
Variables | |
int | cfreceiveroffsetfreq |
int | rspent |
int | pscR1 |
int | cfcoilswitchmethod |
long | rsprot [TRIG_ROT_MAX][9] |
int | cfhwgut |
int | opslicecnt |
int | piviews |
float | pitslice |
STATUS scale | ( | FLOAT(*) | inrotmat[9], |
long(*) | outrotmat[9], | ||
INT | slquant, | ||
LOG_GRAD * | lgrad, | ||
PHYS_GRAD * | pgrad, | ||
INT | contdebug | ||
) |
unsigned short ks_scan_omegawave_hz | ( | KS_WAVE * | wave, |
int | instanceno, | ||
float | Hz, | ||
int | omega_iwave_phase_at_null | ||
) |
A KS_WAVE object on OMEGA can be used to perform a dynamic frequency offset
[in,out] | wave | Pointer to KS_WAVE |
[in] | instanceno | Instance of KS_RF to change (INSTRALL changes all instances) |
[in] | Hz | Desired frequency offset in [Hz] for the point in the KS_WAVE with the largest absolute amplitude |
[in] | omega_iwave_phase_at_null | the area of the integer waveform at the null point |
iphase | correction to be applied with XTR packet |
unsigned short ks_scan_omegatrap_hz | ( | KS_TRAP * | trap, |
int | instanceno, | ||
float | Hz, | ||
int | omega_iwave_phase_at_null | ||
) |
A KS_TRAP object on OMEGA is used for rampsampled acquisitions and is placed out using ks_pg_readtrap() for a KS_READTRAP object if the field .rampsampling
= 1. This will cause a trapezoidal frequency shift during the readout instead of a fixed frequency offset when rampsampling is not used. An error is returned if the current instance of the KS_TRAP is on another board than OMEGA
For Cartesian applications, there is no need to call this function directly, since ks_scan_offsetfov() already calls this function
Special note for OMEGA: Neither the .amp
field nor the .ampscale
field passed in to ks_pg_trap() has an effect. Only the Hz
argument controls the frequency shift
[in,out] | trap | Pointer to KS_TRAP |
[in] | instanceno | Instance of KS_RF to change (INSTRALL changes all instances) |
[in] | Hz | Desired frequency offset in [Hz] at the plateau of the trapezoid |
[in] | omega_iwave_phase_at_null | the area of the integer waveform at the null point |
iphase | correction to be applied with XTR packet |
void ks_scan_wait | ( | KS_WAIT * | wait, |
int | waitperiod | ||
) |
waitperiod
must not exceed.duration
.
[in,out] | wait | Pointer to KS_WAIT |
[in] | waitperiod | Time in [us] to wait |
STATUS | SUCCESS or FAILURE |
void ks_scan_wave_ampscale | ( | KS_WAVE * | wave, |
int | instanceno, | ||
float | ampscale | ||
) |
This function multiplies one instance of a KS_WAVE object with an amplitude scale factor (3rd arg) that should be in range [-1.0,1.0] to avoid slewrate issues. To change all instances of a KS_TRAP object, use INSTRALL
as the 2nd argument.
The actual amplitude for an instance of a KS_WAVE object is the multiplication of the three factors:
.ampscale
in the KS_SEQLOC struct passed to ks_pg_trap()ampscale
value passed in as 3rd argument to this function.[in,out] | wave | Pointer to KS_WAVE |
[in] | instanceno | Instance of KS_TRAP to change (INSTRALL changes all instances) |
[in] | ampscale | Gradient amplitude scale factor, normally in range [-1.0,1.0], but the range [-1.2, 1.2] is allowed to allow certain run-time gradient corrections |
STATUS | SUCCESS or FAILURE |
void ks_scan_trap_ampscale | ( | KS_TRAP * | trap, |
int | instanceno, | ||
float | ampscale | ||
) |
This function multiplies one instance of a KS_TRAP object with an amplitude scale factor (3rd arg) that should be in range [-1.0,1.0] to avoid slewrate issues. To change all instances of a KS_TRAP object, use INSTRALL
as the 2nd argument.
The actual amplitude for an instance of a KS_TRAP object is the multiplication of the three factors:
.ampscale
in the KS_SEQLOC struct passed to ks_pg_trap()ampscale
value passed in as 3rd argument to this function.[in,out] | trap | Pointer to KS_TRAP |
[in] | instanceno | Instance of KS_TRAP to change (INSTRALL changes all instances) |
[in] | ampscale | Gradient amplitude scale factor, normally in range [-1.0,1.0], but the range [-1.2, 1.2] is allowed to allow certain run-time gradient corrections |
STATUS | SUCCESS or FAILURE |
void ks_scan_trap_ampscale_slice | ( | KS_TRAP * | trap, |
int | start, | ||
int | skip, | ||
int | count, | ||
float | ampscale | ||
) |
This function multiplies some instances of a KS_TRAP object with an amplitude scale factor (5th arg) that should be in range [-1.0,1.0] to avoid slewrate issues.
The instances to change are start + i * skip
, where i
goes from 0 to count
. FAILURE is returned if either start or start
+ count
* skip
out of range or count
is negative
[in,out] | trap | Pointer to KS_TRAP |
[in] | start | First instance number of the KS_TRAP |
[in] | skip | Difference in instance number between consecutive instances |
[in] | count | Number of instances to change in total |
[in] | ampscale | Gradient amplitude scale factor, normally in range [-1.0,1.0], but the range [-1.2, 1.2] is allowed to allow certain run-time gradient corrections |
STATUS | SUCCESS or FAILURE |
void ks_scan_phaser_kmove | ( | KS_PHASER * | phaser, |
int | instanceno, | ||
double | pixelunits | ||
) |
This function sets the amplitude of the gradient for a KS_PHASER object so that a shift in k-space of pixelunits
number of pixels is produced. If pixelunits
is 1.0, the gradient area corresponds to one pixel shift in a fully sampled k-space (no parallel imaging) along the board the KS_PHASER object is placed on. pixelunits
is of type float
and any non-integer value is accepted, and the sign of pixelunits
determines the direction of k-space shift
[in,out] | phaser | Pointer to KS_PHASER |
[in] | instanceno | Instance of KS_TRAP to change (INSTRALL changes all instances) |
[in] | pixelunits | Non-integer pixel units in a fully sampled k-space to move |
STATUS | SUCCESS or FAILURE |
double ks_scan_phaser_compute_kmove | ( | KS_PHASER * | phaser, |
int | view | ||
) |
void ks_scan_phaser_toline | ( | KS_PHASER * | phaser, |
int | instanceno, | ||
int | view | ||
) |
This function sets the amplitude of the gradient for a KS_PHASER object to produce a k-space shift from the center of k-space to the view
number (3rd arg). The view
number must be an integer in range [0, .res
-1], and the number refers to a fully sampled k-space (without parallel imaging)
[in,out] | phaser | Pointer to KS_PHASER |
[in] | instanceno | Instance of KS_TRAP to change (INSTRALL changes all instances) |
[in] | view | Phase encoding line to acquire with index corresponding to a fully sampled k-space [0, res-1] |
STATUS | SUCCESS or FAILURE |
void ks_scan_phaser_fromline | ( | KS_PHASER * | phaser, |
int | instanceno, | ||
int | view | ||
) |
This function sets the amplitude of the gradient for a KS_PHASER object to produce a k-space shift from the view
number (3rd arg) to the k-space center. The view
number must be an integer in range [0, .res
-1], and the number refers to a fully sampled k-space (without parallel imaging)
[in,out] | phaser | Pointer to KS_PHASER |
[in] | instanceno | Instance of KS_TRAP to change (INSTRALL changes all instances) |
[in] | view | Phase encoding line to acquire with index corresponding to a fully sampled k-space [0, res-1] |
STATUS | SUCCESS or FAILURE |
void ks_scan_phaser_average | ( | KS_PHASER * | phaser, |
int | instanceno | ||
) |
void ks_scan_phaser_max | ( | KS_PHASER * | phaser, |
int | instanceno | ||
) |
void ks_scan_rf_ampscale | ( | KS_RF * | rf, |
int | instanceno, | ||
float | ampscale | ||
) |
This function multiplies one instance of a KS_RF object with an amplitude scale factor (3rd arg) that must be in range [-1.0,1.0]. To change all instances of a KS_RF object, use INSTRALL
as the 2nd argument.
The actual flip angle for an instance of a KS_RF object is the multiplication of the three factors:
.ampscale
in the KS_SEQLOC struct passed to ks_pg_rf()ampscale
value passed in as 3rd argument to this function. Since both ampscale factors are forced to be in range [-1.0,1.0], it is not possible to increase the flip angle beyond the designed value (.flip
)[in,out] | rf | Pointer to KS_RF |
[in] | instanceno | Instance of KS_RF to change (INSTRALL changes all instances) |
[in] | ampscale | RF amplitude scale factor in range [-1.0,1.0] |
void ks_scan_rf_on | ( | KS_RF * | rf, |
int | instanceno | ||
) |
This function (re)sets the RF amplitude to the state given by ks_pg_rf()
[in,out] | rf | Pointer to KS_RF |
[in] | instanceno | Instance of KS_RF to change (INSTRALL changes all instances) |
void ks_scan_rf_on_chop | ( | KS_RF * | rf, |
int | instanceno | ||
) |
Everytime this function is called, the magnitude of the RF amplitude will be (re)set the RF amplitude to the state given by ks_pg_rf() and the polarity of the RF amplitude will be changed. If this function is called each TR (RF chopping) for a linear single-line k-space acquisition, a FOV/2 shift will occur in the image with any DC component shifted out to the edges of the image FOV.
[in,out] | rf | Pointer to KS_RF |
[in] | instanceno | Instance of KS_RF to change (INSTRALL changes all instances) |
void ks_scan_rf_off | ( | KS_RF * | rf, |
int | instanceno | ||
) |
This can be undone by calling ks_scan_rf_on(), ks_scan_rf_on_chop(), or ks_scan_rf_ampscale()
[in,out] | rf | Pointer to KS_RF |
[in] | instanceno | Instance of KS_RF to change (INSTRALL changes all instances) |
void ks_scan_selrf_setfreqphase_pins | ( | KS_SELRF * | selrf, |
int | instanceno, | ||
SCAN_INFO | sliceinfo, | ||
int | sms_multiband_factor, | ||
float | sms_slice_gap, | ||
float | rfphase | ||
) |
This function alters the phase of the PINS RF pulse in a KS_SELRF object to excite spatial locations corresponding to the information in sliceinfo.tloc
.
[in,out] | selrf | Pointer to KS_SELRF |
[in] | instanceno | Instance of KS_RF to change (INSTRALL changes all instances) |
[in] | sliceinfo | SCAN_INFO struct for the current slice to be played out |
[in] | sms_multiband_factor | |
[in] | sms_slice_gap | in [mm] |
[in] | rfphase | Phase of the RF pulse in [degrees] |
STATUS | SUCCESS or FAILURE |
void ks_scan_selrf_setfreqphase | ( | KS_SELRF * | selrf, |
int | instanceno, | ||
SCAN_INFO | sliceinfo, | ||
float | rfphase | ||
) |
This function alters the frequency of the RF pulse in a KS_SELRF object to excite a spatial location corresponding to the information in sliceinfo.tloc
. The phase of the RF pulse is also updated
[in,out] | selrf | Pointer to KS_SELRF |
[in] | instanceno | Instance of KS_RF to change (INSTRALL changes all instances) |
[in] | sliceinfo | SCAN_INFO struct for the current slice to be played out |
[in] | rfphase | Phase of the RF pulse in [degrees] |
STATUS | SUCCESS or FAILURE |
void ks_scan_rf_setphase | ( | KS_RF * | rf, |
int | instanceno, | ||
float | rfphase | ||
) |
This function sets the phase of an RF pulse object (KS_RF). Can be used for RF spoiling
[in,out] | rf | Pointer to KS_SEL |
[in] | instanceno | Instance of KS_RF to change (INSTRALL changes all instances) |
[in] | rfphase | Phase of the RF pulse in [degrees] |
void ks_scan_setwavestate | ( | KS_WAVE * | wave, |
int | state, | ||
int | instance | ||
) |
During the ks_pg_addwaveform state calls we keep track of the address of each new waveform that was added. This function then allows you to switch to a new waveform by simply changing the address in the intstruction. Be aware that each instance of the KS_WAVE has a unique instruction. This allows you change wave_state on an instance granularity level.
[in] | wave | Pointer to a KS_WAVE sequence object |
[in] | state | The new state to switch to (previously added by ks_pg_addwaveformstate) |
[in] | instance | Which instance you would like to change state (INSTRALL affects all) |
void ks_scan_wave2hardware | ( | KS_WAVE * | wave, |
const KS_WAVEFORM | newwaveform, | ||
int | state | ||
) |
This function copies a waveform to the iwave buffer on the sequencer associated with the specified wave state. In order to use this function multiple wave states are required, these are added using ks_pg_addwavestate. During run time, it is the responsibility of the programmer to not copy a waveform into the currently active wave state. This is because the sequencer and your psd-code are asynchronous and this function writes into the sequence immediately. If the KS_WAVE is currently playing this could trip you scanner! Note: This function affects all instructions (instances) pointing to this state.
[in,out] | wave | Pointer to KS_WAVE |
[in] | newwaveform | KS_WAVEFORM to copy to hardware (if NULL , the .waveform field in KS_WAVE will be used instead) |
[in] | state | The wave state to write the waveform into; this can't be equal to the currently active wavestate |
void ks_scan_offsetfov_iso | ( | KS_READTRAP * | readtrap, |
int | instanceno, | ||
SCAN_INFO | sliceinfo, | ||
double | ky, | ||
double | kz, | ||
double | rcvphase | ||
) |
[in,out] | readtrap | Pointer to KS_READTRAP |
[in] | instanceno | Instance of KS_RF to change (INSTRALL changes all instances) |
[in] | sliceinfo | SCAN_INFO struct for the current slice to be played out |
[in] | ky | phase offset in k-space measured in voxels/pixels |
[in] | kz | phase offset in k-space measured in voxels/pixels |
[in] | rcvphase | Receiver phase in [degrees] of the acquisition window corresponding to the KS_READTRAP and instanceno |
void ks_scan_offsetfov_iso_readwave | ( | KS_READWAVE * | readwave, |
int | instanceno, | ||
SCAN_INFO | sliceinfo, | ||
double | ky, | ||
double | kz, | ||
double | rcvphase | ||
) |
void ks_scan_offsetfov | ( | KS_READTRAP * | readtrap, |
int | instanceno, | ||
SCAN_INFO | sliceinfo, | ||
float | view, | ||
float | phasefovratio, | ||
float | rcvphase | ||
) |
This function can be used by 2D Cartesian pulse sequences to build up the phase ramp in k-space necessary to shift the image FOV. The desired image FOV shift is given by the SCAN_INFO struct passed in as 3rd argument. The view
field and the phasefovratio
arguments are necessary to know where in the physical k-space the acquired data is placed. Knowing this and the FOV offset in the phase encoding direction, the necessary receiver phase for the current view
can be set. After this function has been called for all view
numbers, the necessary phase ramp has been set up in k-space to perform the phase FOV shift in the image domain. The rcvphase
is added to the receive phase required for the FOV shift. In general, the rcvphase
should be the same as the phase of the RF excitation pulse.
For rampsampled acquisitions (.rampsampling
= 1 in KS_READTRAP), the ks_scan_offsetfov_iso() function called will internally call ks_scan_omegatrap_hz() for FOV shifts in the readout direction. Both ks_scan_offsetfov() and ks_scan_offsetfov3D() calls the same ks_scan_offsetfov_iso() function after performing unit conversions of the input arguments.
[in,out] | readtrap | Pointer to KS_READTRAP |
[in] | instanceno | Instance of KS_RF to change (INSTRALL changes all instances) |
[in] | sliceinfo | SCAN_INFO struct for the current slice to be played out |
[in] | view | Phase encoding line to acquire with index corresponding to a fully sampled k-space [0, res-1] |
[in] | phasefovratio | The ratio of FOVphase/FOVfreq (as opphasefov ) |
[in] | rcvphase | Receiver phase in [degrees] of the acquisition window corresponding to the KS_READTRAP and instanceno |
void ks_scan_offsetfov3D | ( | KS_READTRAP * | readtrap, |
int | instanceno, | ||
SCAN_INFO | sliceinfo, | ||
float | kyview, | ||
float | phasefovratio, | ||
float | kzview, | ||
float | zphasefovratio, | ||
float | rcvphase | ||
) |
This function can be used by 3D Cartesian pulse sequences to build up the phase ramp in k-space necessary to shift the image FOV. The desired image FOV shift is given by the SCAN_INFO struct passed in as 3rd argument. The kyview
/kzview
field and the phasefovratio
/zphasefovratio
arguments are necessary to know where in the physical k-space the acquired data is placed. Knowing this and the FOV offset in both phase encoding directions, the necessary receiver phase for the current kyview
/kzview
can be set. After this function has been called for all kyview
/kzview
numbers, the necessary phase ramp has been set up in k-space to perform the phase FOV shift in the image domain. The rcvphase
is added to the receive phase required for the FOV shift. In general, the rcvphase
should be the same as the phase of the RF excitation pulse.
For rampsampled acquisitions (.rampsampling
= 1 in KS_READTRAP), the ks_scan_offsetfov_iso() function called will internally call ks_scan_omegatrap_hz() for FOV shifts in the readout direction. Both ks_scan_offsetfov() and ks_scan_offsetfov3D() calls the same ks_scan_offsetfov_iso() function after performing unit conversions of the input arguments.
[in,out] | readtrap | Pointer to KS_READTRAP |
[in] | instanceno | Instance of KS_RF to change (INSTRALL changes all instances) |
[in] | sliceinfo | SCAN_INFO struct for the current slice to be played out |
[in] | kyview | Phase encoding line to acquire with index corresponding to a fully sampled k-space [0, res-1] (YGRAD) |
[in] | phasefovratio | The ratio of FOVphase/FOVfreq (as opphasefov ) |
[in] | kzview | Z Phase encoding line to acquire with index corresponding to a fully sampled k-space [0, res-1] (ZGRAD) |
[in] | zphasefovratio | The ratio of FOVslice/FOVfreq (as (opslquant * opslthick) / opfov ) |
[in] | rcvphase | Receiver phase in [degrees] of the acquisition window corresponding to the KS_READTRAP and instanceno |
void ks_scan_offsetfov_readwave | ( | KS_READWAVE * | readwave, |
int | instanceno, | ||
SCAN_INFO | sliceinfo, | ||
float | ky, | ||
float | phasefovratio, | ||
float | rcvphase | ||
) |
void ks_scan_offsetfov3D_readwave | ( | KS_READWAVE * | readwave, |
int | instanceno, | ||
SCAN_INFO | sliceinfo, | ||
float | ky, | ||
float | phasefovratio, | ||
float | kz, | ||
float | zphasefovratio, | ||
float | rcvphase | ||
) |
float* ks_scan_getrotate | ( | void | ) |
void ks_scan_rotate | ( | SCAN_INFO | slice_pos | ) |
The field .oprot
(9-element array) in the SCAN_INFO struct holds the rotation matrix that should be played out
This function performs the necessary scaling of the rotation matrix using loggrd
and phygrd
and then calls setrotatearray()
, which performs the actual rotation on hardware during the next SSI time.
See ks_scan_update_slice_location() for detail on how to create new SCAN_INFO structs in run-time
[in] | slice_pos | SCAN_INFO struct holding new slice information |
void ks_scan_isirotate | ( | KS_ISIROT * | isirot | ) |
This function needs a psd-specific wrapper function to execute (see ks_pg_isirot()) since the ISI interupt routine is calling a void function without input arguments. This psd-specific wrapper function should only contain the call to ks_scan_isirotate() with the psd-specific KS_ISIROT set up in pulsegen().
For N number of calls to ks_pg_isirot() in the sequence module's pg-function, the field isirot.numinstances
will be set to N, and this many ISI interrupt with a corresponding isirot.isinumber
exist in the sequence module. Valid ISI numbers are 4-7, and one available number should be linked to one specific wrapper function using ks_eval_isirot() and ks_pg_isirot().
In real-time, ks_scan_isirotate() will increment the isirot.counter
field by 1 and restart at 0 after isirot->numinstances
. isirot.counter
is set to 0 in ks_pg_isirot(). Based on the value of the .counter
field, it will assign a pre-stored SCAN_INFO struct corresponding to this counter value. Again, this connection is done by ks_pg_isirot().
ks_scan_isirotate() takes the current SCAN_INFO and converts it to long int, and then calls setrotateimm(..., WARP_UPDATE_ON_SSP_INT);
[in] | isirot | Pointer to the KS_ISIROT struct set up by ks_pg_isirot() |
int ks_scan_getsliceloc | ( | const KS_SLICE_PLAN * | slice_plan, |
int | passindx, | ||
int | sltimeinpass | ||
) |
This function finds the spatially sorted slice index (.slloc
) in range [0, nslices-1] given the sequence's DATA_ACQ_ORDER struct array (in slice_plan.acq_order)
[in] | slice_plan | Pointer to the slice plan (KS_SLICE_PLAN) for the sequence |
[in] | passindx | Current pass index ([0, acqs-1]) |
[in] | sltimeinpass | Temporal index of the n slices acquired in each pass ([0, n-1]) |
slloc | Spatially sorted slice index |
int ks_scan_getslicetime | ( | const KS_SLICE_PLAN * | slice_plan, |
int | passindx, | ||
int | slloc | ||
) |
This function finds the temporally sorted slice index (.sltime
) in range [0, nslices-1] given the sequence's DATA_ACQ_ORDER struct array (in slice_plan.acq_order)
[in] | slice_plan | Pointer to the slice plan (KS_SLICE_PLAN) for the sequence |
[in] | passindx | Current pass index ([0, acqs-1]) |
[in] | slloc | Spatially sorted slice index [0, nslices-1] |
sltimeinpass | Temporal index of the n slices acquired in each pass ([0, n-1]) |
ks_enum_epiblipsign ks_scan_epi_verify_phaseenc_plan | ( | KS_EPI * | epi, |
KS_PHASEENCODING_PLAN * | phaseenc_plan, | ||
int | shot | ||
) |
ks_enum_epiblipsign _compute_epi_blipsign | ( | KS_EPI * | epi, |
KS_PHASEENCODING_COORD | starting_coord | ||
) |
void ks_scan_epi_shotcontrol_sms | ( | KS_EPI * | epi, |
int | echo, | ||
SCAN_INFO | sliceinfo, | ||
KS_PHASEENCODING_COORD | starting_coord, | ||
ks_enum_epiblipsign | blipsign, | ||
float | rcvphase, | ||
int | sms_factor, | ||
float | sms_slice_gap, | ||
int | caipi_factor, | ||
int | sms_slice_encoding_direction | ||
) |
This function has two different tasks. First, it controls the EPI blips and sets the EPI dephaser and rephaser amplitude given the current phaseshot
and blipsign
. If phaseshot
is outside the valid range ([0, .blipphaser.R
-1], all gradient amplitudes on the blip (phase encoding) axis will be zero. This can be useful to acquire a refscan for Nyquist ghost correction. Second, it sets up the proper frequency and phase modulation per readout lobe to produce the desired FOV offset in both the frequency and phase encoding directions
[in,out] | epi | Pointer to KS_EPI |
[in] | echo | EPI echo index (up to 16 EPI trains supported) |
[in] | sliceinfo | SCAN_INFO struct for the current slice to be played out |
[in] | starting_coord | coordinate in k-space from where the EPI train starts |
[in] | blipsign | KS_EPI_POSBLIPS or KS_EPI_NEGBLIPS |
[in] | rcvphase | Receiver phase in degrees, for RF spoiling. |
[in] | sms_factor | ADDTEXTHERE |
[in] | sms_slice_gap | ADDTEXTHERE |
[in] | caipi_factor | ADDTEXTHERE |
[in] | sms_slice_encoding_direction | ADDTEXTHERE |
void ks_scan_epi_shotcontrol | ( | KS_EPI * | epi, |
int | echo, | ||
SCAN_INFO | sliceinfo, | ||
KS_PHASEENCODING_COORD | starting_coord, | ||
ks_enum_epiblipsign | blipsign, | ||
float | rcvphase | ||
) |
This function has two different tasks. First, it controls the EPI blips and sets the EPI dephaser and rephaser amplitude given the current phaseshot
and blipsign
. If phaseshot
is outside the valid range ([0, .blipphaser.R
-1], all gradient amplitudes on the blip (phase encoding) axis will be zero. This can be useful to acquire a refscan for Nyquist ghost correction. Second, it sets up the proper frequency and phase modulation per readout lobe to produce the desired FOV offset in both the frequency and phase encoding directions
[in,out] | epi | Pointer to KS_EPI |
[in] | echo | EPI echo index (up to 16 EPI trains supported) |
[in] | sliceinfo | SCAN_INFO struct for the current slice to be played out |
[in] | starting_coord | coordinate in k-space from where the EPI train starts |
[in] | blipsign | KS_EPI_POSBLIPS or KS_EPI_NEGBLIPS |
[in] | rcvphase | Receiver phase in degrees, for RF spoiling. |
void ks_scan_epi_loadecho | ( | KS_EPI * | epi, |
int | echo, | ||
int | storeecho, | ||
int | slice, | ||
KS_PHASEENCODING_COORD | starting_coord, | ||
ks_enum_epiblipsign | blipsign, | ||
KS_DYNAMIC_STATE * | dynamic | ||
) |
ADDTEXTHERE
[in,out] | epi | Pointer to KS_EPI |
[in] | echo | EPI echo index to work on (up to 16 EPI trains supported) |
[in] | storeecho | EPI echo index for storing (usually the same as echo) |
[in] | slice | Slice index where to store the data (0-based) |
[in] | starting_coord | coordinate in k-space from where the EPI train starts |
[in] | blipsign | KS_EPI_POSBLIPS or KS_EPI_NEGBLIPS |
dynamic | Pointer to KS_DYNAMIC_STATE struct, which has elements being automatically updated by the scan looping functions |
void ks_set_opcode | ( | WF_PULSE_ADDR | echo, |
short | opcode | ||
) |
void ks_loaddab_reserved | ( | WF_PULSE_ADDR | echo, |
short | state, | ||
short | resampler_index | ||
) |
[in] | echo | ADDTEXTHERE |
[in] | state | ADDTEXTHERE |
[in] | resampler_index | ADDTEXTHERE |
void ks_loaddab | ( | WF_PULSE_ADDR | echo, |
const char * | dab_array | ||
) |
[in] | echo | ADDTEXTHERE |
[in] | dab_array | ADDTEXTHERE |
void ks_loaddab_full | ( | WF_PULSE_ADDR | echo, |
const char * | custom_dab_array | ||
) |
[in] | echo | ADDTEXTHERE |
[in] | custom_dab_array | ADDTEXTHERE |
WF_PULSE_ADDR ks_get_wf_pulse | ( | KS_ECHOTRAIN * | echotrain, |
const int | readout_index | ||
) |
[in] | echotrain | ADDTEXTHERE |
[in] | readout_index | ADDTEXTHERE |
WF_PULSE_ADDR |
LONG ks_get_override_R1 | ( | KS_ECHOTRAIN * | echotrain, |
const int | readout_index | ||
) |
[in] | echotrain | ADDTEXTHERE |
[in] | readout_index | ADDTEXTHERE |
LONG |
void ks_scan_acq_to_rtp | ( | KS_READ * | read, |
TYPDAB_PACKETS | dabacqctrl, | ||
float | fatoffset | ||
) |
[in,out] | read | Pointer to KS_READ |
[in] | dabacqctrl | DABON or DABOFF |
[in] | fatoffset | Frequency offset in [Hz] for the current data acquisition window |
STATUS boffset | ( | long * | offsets | ) |
void ks_scan_switch_to_sequence | ( | KS_SEQ_CONTROL * | ctrl | ) |
STATUS setssitime | ( | long | ) |
STATUS startseq | ( | s16 | , |
s16 | |||
) |
int ks_scan_playsequence | ( | KS_SEQ_CONTROL * | ctrl | ) |
STATUS ks_scan_loaddabwithindices_nex | ( | WF_PULSE_ADDR | pulse, |
LONG | slice, | ||
LONG | echo, | ||
LONG | view, | ||
uint8_t | acq, | ||
uint8_t | vol, | ||
LONG | operation, | ||
TYPDAB_PACKETS | acqon_flag | ||
) |
[in] | pulse | Pointer to WF_PULSE in a KS_READ |
[in] | slice | 0-based temporal slice index (2D) or kz encoding step typically (3D) |
[in] | echo | 0-based echo in the echo train |
[in] | view | 1-based ky view number |
[in] | acq | 0-based acquisition index (always 0 if all slices fit in one TR) |
[in] | vol | 0-based volume index (always 0 if only one volume) |
[in] | operation | DABSTORE, DABADD (for 2nd to last excitation) |
[in] | acqon_flag | DABON or DABOFF |
STATUS | SUCCESS or FAILURE |
STATUS ks_scan_loaddabwithindices | ( | WF_PULSE_ADDR | pulse, |
LONG | slice, | ||
LONG | echo, | ||
LONG | view, | ||
uint8_t | acq, | ||
uint8_t | vol, | ||
TYPDAB_PACKETS | acqon_flag | ||
) |
[in] | pulse | Pointer to WF_PULSE in a KS_READ |
[in] | slice | 0-based temporal slice index (2D) or kz encoding step typically (3D) |
[in] | echo | 0-based echo in the echo train |
[in] | view | 1-based ky view number |
[in] | acq | 0-based acquisition index (always 0 if all slices fit in one TR) |
[in] | vol | 0-based volume index (always 0 if only one volume) |
[in] | acqon_flag | DABON or DABOFF |
STATUS | SUCCESS or FAILURE |
int ks_scan_wait_for_rtp | ( | void * | rtpmsg, |
int | maxmsgsize, | ||
int | maxwait, | ||
KS_SEQ_CONTROL * | waitctrl | ||
) |
[out] | rtpmsg | pointer to memory that will be filled by the RTP message |
[in] | maxmsgsize | size in bytes of the memory pointed by rtpmsg |
[in] | maxwait | timing out period in [ms] |
[in] | waitctrl | pointer to the KS_SEQ_CONTROL of a wait sequence. If NULL, the provided maxwait is ignored and a value of zero used instead. |
size | of the received message, zero if timed out |
void ks_copy_and_reset_obj | ( | void * | pobj | ) |
Create a copy of the object pointed by pobj and insert it into the linked list in second position. finally reset the (base part of) original object.
It is required that pobj
can be casted to (KS_BASE *), which is the pointed object should have a KS_BASE as first member. Note that other, object-specific, actions may need to be performed to finalize the reset. This includes calls to ks_instancereset_***() functions on each member of the current pobj
[in] | pobj | Pointer to a sequence object of some kind |
void ks_tgt_reset_gradrfctrl | ( | KS_GRADRFCTRL * | gradrfctrl | ) |
Clears KS_GRADRFCTRL on TGT. Called in ks_pg_trap, ks_pg_wave, and ks_pg_rf if the field is_cleared_on_tgt
is false.
gradrfctrl | [pointer to KS_GRADRFCTRL] |
void ks_show_clock | ( | FLOAT | scantime | ) |
STATUS acqq_longdab | ( | WF_PULSE_ADDR | pulse, |
LONG | pos_ref, | ||
LONG | dab_ref, | ||
LONG | xtr_ref, | ||
LONG | fslot_value | ||
) |
int cfreceiveroffsetfreq |
int rspent |
int pscR1 |
int cfcoilswitchmethod |
long rsprot[TRIG_ROT_MAX][9] |
int cfhwgut |
int opslicecnt |
int piviews |
float pitslice |