API

class x_epi.XEPI(*args: Any, **kwargs: Any)
__init__(fov=[240, 240, 240], rbw=50, n_avg=1, n_rep=1, tr=0, tv=0, ts=0, ro_off=0, pe_off=0, slc_off=0, slice_axis='Z', n_echo=1, delta_te=0, symm_ro=True, acq_3d=True, no_pe=False, grad_spoil=False, ramp_samp=False, no_slc=False, alt_read=False, alt_pha=False, alt_slc=False, ro_os=1, b0=3, nuc='13C', rf_dead_time=100, rf_ringdown_time=30, max_slew=200, max_grad=100, ori='Transverse', pe_dir='AP', **kwargs)

Initialize X EPI sequence object, inherits from pypulseq Sequence object

Parameters

fovarray_like

Contains FOV of each dimension (mm)

rbwfloat

Readout bandwidth (kHz)

n_avgint

Number of averages

n_repint

Number of repeats

trfloat

Minimum duration of each excitation block (ms)

tvfloat

Minimum duration of each 3D image (ms)

tsfloat

Minimum durartion of each metabolite set (ms)

ro_offfloat

Spatial offset in readout direction (mm)

pe_offfloat

Spatial offset in phase encoding direction (mm). Only for recon.

slc_off: float

Spatial offset in slice direction (mm)

slice_axisstr

Axis to play slic gradient on. Takes X, Y, Z

n_echoint

Number of echoes following each excitation

delta_tefloat

Minimum duration between each echo (ms) #Extract sequence options

symm_robool

Uses symmetric readout if True. Otherwise uses flyback.

acq_3dbool

Uses a 3D readout if True. Otherwise uses 2D.

no_pebool

Turns off phase encoding gradients is True.

grad_spoilbool

Turns on gradient spoilers if True

no_slcbool

Turns off slice gradients if True.

alt_readbool

Alternate polarity of readout every repetition

alt_phabool

Alternate polarity of phase encoding every repetition

alt_slcbool

Alternate polarity of second phase encoding every repetition

ro_osfloat

Readout oversampling factor

b0float

Main magnetic field strength (T)

nucstr

Nucleus to image

rf_dead_timefloat

Dead time for RF channel (us)

rf_ringdown_timefloat

Ringdown time for RF channel (us)

max_slewfloat

Maximum slew rate (T/m/s)

max_gradfloat

Maximum gradient strength (mT/m)

oristr

Image orientation for reconstruction.

pe_dirstr

Phase encoding direction for reconstruction

Returns

XEPI sequence object

add_blck_lbl(*args, lbl=None)

Quick function to add events to block and add a label to list

Parameters

argsSimpleNamespace

Block structure / items to be added to sequence

lblstr

Label to add to self.blck_lbls

add_met(name=None, size=[16, 16, 16], pf_pe=1, pf_pe2=1, sinc_frac=0.5, sinc_tbw=4, formula='1', use_sinc=False, grd_path='/Users/blazeyt/Documents/code/x_epi/x_epi/../seq/siemens_singleband_pyr_3T.GRD', rf_path='/Users/blazeyt/Documents/code/x_epi/x_epi/../seq/siemens_singleband_pyr_3T.RF', flip=90, freq_off=0, sinc_dur=4, z_centric=False, **kwargs)

Add metabolite acquisition to sequence

Parameters

namestr

Name for metabolite

sizearray_like

Grid size in x, y, and z

pf_pefloat

Partial Fourier fraction in y dimension

pf_pe2float

Partial Fourier fraction in z dimension

sinc_fracfloat

Center fraction of sinc pulse

sinc_tbwfloat

Time-bandwidth product of sinc pulse

grd_pathstr

Path to gradient file from Spectral-Spatial RF Toolbox

rf_pathstr

‘Path to rf file from Spectral-Spatial RF Toolbox

formulastr

Formula for scaling SSRF gradient where x is slice thickness in mm

use_sincbool

Use a sinc pulse instead of an SSRF pulse

flipfloat

Flip angle (degrees)

freq_offfloat

Frequency offset (Hz) of pulse

sinc_durfloat

Duration of sinc pulse (ms)

z_centricbool

Use centric phase encoding in z direction

add_spec(run_spec='END', spec_size=2048, spec_bw=25, spec_flip=2.5, spec_tr=1000, n_spec=1, **kwargs)

Add spectra acquisition to start and/or end of acquisition

Parameters

run_specstr

When to run spectra. Takes START, END, or BOTH

spec_sizen

Number of spectra to acquire

spec_bwfloat

Spectral bandwidth (kHz)

spec_flipfloat

Flip angle for sinc pulse (degrees)

spec_trfloat

Minimum duration of each excitation block (ms)

n_specint

Number of spectra acquistions (seperated by at least spec_tr)

add_spec_events()

Creates rf, adc, and slice gradient events for spectra

create_param_dic()

Create a dictionary for sequence parameters

Returns

param_dicdic

Dictionary of sequence parameters

create_seq(return_plot=False, no_reps=False)

Creates epi sequence

Parameters

return_plotbool

If True, returns a sequence object with no repetitions or averages. Useful for plotting sequence

no_repsbool

If True, turns off replications/averages

Returns

plot_seqX EPI object

Sequence object with no repetitions or aveages

create_ssrf_grad_ev(met_idx)

Creates gradient event for SSRF pulse

Parameters

met_idxint

Index of metabolite in self.mets

create_ssrf_rf_ev(met_idx)

Creates RF event for SSRF pulse

Parameters

met_idxint

Index of metabolite in self.mets

save_params(out_path)

Saves input parameters that were used to define section to json

Parameters

out_pathstr

Path to write json data to

Returns

out_dicjson

Json file containing parameters

x_epi.utils.compute_k_space(seq)

Computes rf, gradient, and k-space waveforms of current sequence

Parameters

seqXEPI object

Sequence object containing waveforms

Returns

g_listlist

Gradient waveforms in X, Y, and Z dimensions for each metabolite

rf_listlist

Complex rf waveforms for each metabolite

k_listlist

3D k-space waveforms for each metabolite. Returned if k_3d is True

adc_listlist

Timings for 3D k-space waveforms for each metabolite. Returned if k_3d is True

k_2d_listlist

2D k-space waveforms for each metabolite. Returned if k_2d is True

adc_2d_listlist

Timings for 2D k-space waveforms for each metabolite. Returned if k_2d is True

x_epi.utils.interp_waveform(sig, delta_t, delta_ti, ti_end=None)

Interpolates signal waveform

Parameters

signdarray

Array containing waveform data

delta_tfloat

Sampling time for data in sig

delta_tifloat

Sampling time to interpolate to

ti_stopfloat

Time to end interpolation at

Returns

sig_indarray

Array containing interpolated data

x_epi.utils.load_ssrf_grad(grd_path)

Load in SSRF gradient

Parameters

grd_pathstr

Path to SSRF gradient file

Returns

grd_datandarray

Numpy array containing gradient data

grd_maxfloat

Maximum gradient value (G/cm)

grd_deltafloat

Sampling time (s)

x_epi.utils.load_ssrf_rf(rf_path)

Load in SSRF rf

Parameters

rf_pathstr

Path to SSRF RF file

Returns

rf_magndarray

Numpy array containing rf magnitude

rf_phandarray

Numpy array containing rf phase

b1_maxfloat

Maximum B1 (G)

rf_deltafloat

Sampling time (s)

x_epi.utils.nuc_to_gamma(nuc)

Returns gyromagnetic ratio given nucleus

Parameters

nucstr

Nucleus string (e.g., 13C, 1H, etc)

Returns

gammafloat

Gyromangetic ratio in Hz/T

x_epi.utils.save_k_space(seq, out)

Parameters

seqXEPI sequence object

Sequence object to compute k-space data

outstr

Root for output files

Returns

k_spacelist of ndarrays

List containing k_space data for each metabolite