API#
x_epi data class module
- class x_epi.data.XData(fov=[240, 240, 240], rbw=50, n_avg=1, n_chan=1, n_rep=1, ts=1000, ro_off=0, pe_off=0, slc_off=0, n_echo=1, delta_te=0, symm_ro=True, acq_3d=True, ramp_samp=False, alt_read=False, alt_pha=False, alt_slc=False, ori='Transverse', pe_dir='AP', **kwargs)#
Data class for processing data created with an x_epi sequence
Methods
add_met([name, size, size_acq, pf_pe, ...])Add metabolite acquisition to sequence
apply_off_res([pad])Shifts metabolites that were acquired off-resonance
apply_phase_shift([pad])Shifts images in phase encoding directions if image was acquired with an off center field of view.
Perform sum-of-squares coil combination.
Creates NIfTI format affine transforms for each metabolite.
Create a dictionary for sequence parameters
fft_recon([ref_data, point, n_k])Reconstructs metabolite data using the FFT.
Performs axis flips common to x_epi data
load_k_coords(coord_path)Loads in k-space coordinates and adds them to each metabolite object
load_k_data(twix_path[, recon_dims])Reads k-space data for each metabolite from Siemens twix file
regrid_k_data([method, nufft_size])Regrid k-space in readout direction so that we have even spacing with the correct FOV
save_nii(out_root[, cmplx, mean])Saves image data to nifti
save_param_dic(out_root)Saves input parameters to json
- __init__(fov=[240, 240, 240], rbw=50, n_avg=1, n_chan=1, n_rep=1, ts=1000, ro_off=0, pe_off=0, slc_off=0, n_echo=1, delta_te=0, symm_ro=True, acq_3d=True, ramp_samp=False, alt_read=False, alt_pha=False, alt_slc=False, ori='Transverse', pe_dir='AP', **kwargs)#
Initialize X EPI data object
- Attributes:
- fovarray_like
Contains FOV of each dimension (mm)
- rbwfloat
Readout bandwidth (kHz)
- n_avgint
Number of averages
- n_chanint
Number of coil channels
- n_repint
Number of repeats
- 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)
- 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.
- 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
- oristr
Image orientation for reconstruction.
- pe_dirstr
Phase encoding direction for reconstruction
- Returns:
- XData object
- add_met(name=None, size=[16, 16, 16], size_acq=[16, 16, 16], pf_pe=1, pf_pe2=1, freq_off=0, z_centric=False, esp=0.00048, k_acq=None, k_coord=None, k_data=None, img_data=None, **kwargs)#
Add metabolite acquisition to sequence
- Parameters:
- namestr
Name for metabolite
- sizearray_like
Grid size in x, y, and z
- size_acqarray_like
Acquired dimensions in x, y, z
- pf_pefloat
Partial Fourier fraction in y dimension
- pf_pe2float
Partial Fourier fraction in z dimension
- freq_offfloat
Frequency offset (Hz) of pulse
- z_centricbool
Use centric phase encoding in z direction
- espfloat
Echo spacing (s)
- k_acqndarray
k-space data with dimensions size_acq, n_rep, n_echo
- k_datandarrary
k-space data with dimensions size, n_rep, n_echo
- img_datandarray
image data with dimensions size, n_rep, n_echo
- apply_off_res(pad=8)#
Shifts metabolites that were acquired off-resonance
- Parameters:
- padint
Size to zero pad each dimension when apply shifts
- apply_phase_shift(pad=8)#
Shifts images in phase encoding directions if image was acquired with an off center field of view.
- Parameters:
- padint
Size to zero pad each dimension when apply shifts
- combine_coils()#
Perform sum-of-squares coil combination.
- create_nii_xfm()#
Creates NIfTI format affine transforms for each metabolite. Units are in mm.
- create_param_dic()#
Create a dictionary for sequence parameters
- Returns:
- param_dicdic
Dictionary of sequence parameters
- fft_recon(ref_data=None, point=True, n_k=2)#
Reconstructs metabolite data using the FFT. Also can apply a phase correction for symmetrically acquired EPI data
- Parameters:
- ref_dataXData object
XData object containing with reference scan data (no phase encoding) for each metabolite
- pointbool
Run a pointwise (True) or spline-based (False) phase correction
- n_kint
Number of knots for spline-based phase correction
- flip_k_data()#
Performs axis flips common to x_epi data
- load_k_coords(coord_path)#
Loads in k-space coordinates and adds them to each metabolite object
- Parameters:
- coord_pathstr
Path to k-space coordinates written by x_epi apps
- load_k_data(twix_path, recon_dims=True)#
Reads k-space data for each metabolite from Siemens twix file
- Parameters:
- twix_pathstr
Path to twix data file
- recon_dimsbool
If true, saves k-space data with same dimensions as eventual reconstructed image to k_data. Zero-padding is used to fill any data skipped due to partial Fourier. If False, k-space data will have dimensions matching acquisition and be saved to k_acq.
- regrid_k_data(method='cubic', nufft_size=6)#
Regrid k-space in readout direction so that we have even spacing with the correct FOV
- Parameters:
- methodstr
Cubic uses cubic spline interpolation, nufft performs a non-uniform FFT, and linear performs linear interpolation
- nufft_sizeint
Size of nufft interpolator
- save_nii(out_root, cmplx=False, mean=False)#
Saves image data to nifti
- Parameters:
- out_rootstr
Root for output files. Does not include extension or cmplx/mean suffix.
- cmplxbool
Saves data as complex is true
- meanbool
Saves temporal mean
- save_param_dic(out_root)#
Saves input parameters to json
- Parameters:
- out_rootstr
Path to write json data to. Does not include extension