Learn R Programming

spant (version 3.9.0)

MR Spectroscopy Analysis Tools

Description

Tools for reading, visualising and processing Magnetic Resonance Spectroscopy data. The package includes methods for spectral fitting: Wilson (2021) , Wilson (2025) and spectral alignment: Wilson (2018) .

Copy Link

Version

Install

install.packages('spant')

Monthly Downloads

432

Version

3.9.0

License

GPL-3

Issues

Pull Requests

Stars

Forks

Maintainer

Martin Wilson

Last Published

February 23rd, 2026

Functions in spant (3.9.0)

Ncoils

Return the total number of coil elements in an MRS dataset.
Npts

Return the number of data points in an MRS dataset.
Arg.mrs_data

Apply Arg operator to an MRS dataset.
Mod.mrs_data

Apply Mod operator to an MRS dataset.
Ntrans

Return the total number of acquired transients for an MRS dataset.
Imzap

Complex rounding function taken from complexplus package to reduce the number of spant dependencies.
acquire

Simulate pulse sequence acquisition.
abfit_reg_opts

Return a list of options for an ABfit analysis with regularision.
Nx

Return the total number of x locations in an MRS dataset.
abfit_opts_v1_9_0

Return a list of options for an ABfit analysis to maintain comparability with analyses performed with version 1.9.0 (and earlier) of spant.
add_noise

Add noise to an mrs_data object.
Nz

Return the total number of z locations in an MRS dataset.
Ny

Return the total number of y locations in an MRS dataset.
add_noise_spec_snr

Add noise to an mrs_data object to match a given SNR.
abfit_opts

Return a list of options for an ABfit analysis.
Re.mrs_data

Apply Re operator to an MRS dataset.
append_basis

Combine a pair of basis set objects.
apodise_xy

Apodise MRSI data in the x-y direction with a k-space filter.
append_coils

Append MRS data across the coil dimension, assumes they matched across the other dimensions.
append_dyns

Append MRS data across the dynamic dimension, assumes they matched across the other dimensions.
align

Align spectra to a reference frequency using a convolution based method.
array2mrs_data

Convert a 7 dimensional array in into a mrs_data object. The array dimensions should be ordered as : dummy, X, Y, Z, dynamic, coil, FID.
apply_axes

Apply a function over specified array axes.
apply_mrs

Apply a function across given dimensions of a MRS data object.
apply_pulse

Simulate an RF pulse on a single spin.
basis2dyn_mrs_data

Convert a basis object to a dynamic mrs_data object.
basis2mrs_data

Convert a basis object to an mrs_data object - where basis signals are spread across the dynamic dimension.
bc_spline

Fit and subtract a smoothing spline to each spectrum in a dataset.
auto_phase

Perform zeroth-order phase correction based on the minimisation of the squared difference between the real and magnitude components of the spectrum.
bc_poly

Fit and subtract a polynomial to each spectrum in a dataset.
append_regs

Append multiple regressor data frames into a single data frame.
assign_dyns

Overwrite a subset of dynamic scans.
calc_design_efficiency

Calculate the efficiency of a regressor data frame.
calc_ed_from_lambda

Calculate the effective dimensions of a spline smoother from lambda.
bc_constant

Remove a constant baseline offset based on a reference spectral region.
check_tqn

Check the TARQUIN binary can be run
check_lcm

Check LCModel can be run
bin_spec

Bin equally spaced spectral regions.
bc_als

Baseline correction using the ALS method.
beta2lw

Covert a beta value in the time-domain to an equivalent linewidth in Hz: x * exp(-i * t * t * beta).
collapse_to_dyns

Collapse MRS data by concatenating spectra along the dynamic dimension.
comb_coils

Combine coil data based on the first data point of a reference signal.
bbase

Generate a spline basis, slightly adapted from : "Splines, knots, and penalties", Eilers 2010.
crop_spec

Crop mrs_data object based on a frequency range.
crop_basis

Crop basis_set object based on a frequency range.
def_N

Return the default number of data points in the spectral dimension.
back_extrap_ar

Back extrapolate time-domain data points using an autoregressive model.
auto_phase_bl

Perform zeroth-order phase correction based on expected baseline regions.
comb_fit_list_dyns

Combine a list of fit results into a single fit result object across the dynamic dimension.
def_ft

Return the default transmitter frequency in Hz.
bc_gauss

Apply and subtract a Gaussian smoother in the spectral domain.
def_acq_paras

Return (and optionally modify using the input arguments) a list of the default acquisition parameters.
def_fs

Return the default sampling frequency in Hz.
downsample_mrs_td

Downsample an MRS signal by a factor of 2 by removing every other data point in the time-domain. Note, signals outside the new sampling frequency will be aliased.
est_noise_sd

Estimate the standard deviation of the noise from a segment of an mrs_data object.
deconv_mrs

Deconvolve two MRS data objects.
downsample_mrs_fd

Downsample an MRS signal by a factor of 2 using an FFT "brick-wall" filter.
elliptical_mask

Create an elliptical mask stored as a matrix of logical values.
decimate_mrs_td

Decimate an MRS signal by filtering in the time domain before downsampling.
calc_coil_noise_sd

Calculate the noise standard deviation for each coil element.
calc_peak_info_vec

Calculate the FWHM of a peak from a vector of intensity values.
calc_coil_noise_cor

Calculate the noise correlation between coil elements.
circ_mask

Create a logical circular mask spanning the full extent of an n x n matrix.
comb_metab_ref

Combine a reference and metabolite mrs_data object.
conv_mrs

Convolve two MRS data objects.
coherence_filter

Zero all coherence orders other than the one supplied as an argument.
fit_asy_pvoigt

Fit a single asymmetric pseudo-Voigt resonance in the frequency domain.
fit_diags

Calculate diagnostic information for object of class fit_result.
calc_sd_poly

Perform a polynomial fit, subtract and return the standard deviation of the residuals.
comb_fit_list_fit_tables

Combine all fitting data points from a list of fits into a single data frame.
fit_svs

Standard SVS 1H brain analysis pipeline.
crop_td_pts_end

Crop mrs_data object data points at the end of the FID.
crop_td_pts

Crop mrs_data object data points in the time-domain.
comb_fit_list_result_tables

Combine the fit result tables from a list of fit results.
crossprod_3d

Compute the vector cross product between vectors x and y. Adapted from http://stackoverflow.com/questions/15162741/what-is-rs-crossproduct-function
comb_fit_tables

Combine all fitting data points into a single data frame.
calc_basis_corr_mat

Estimate the correlation matrix for a basis set.
calc_spec_diff

Calculate the sum of squares differences between two mrs_data objects.
calc_spec_snr

Calculate the spectral SNR.
calc_basis_crlbs

Estimate the CRLB for each element in a basis set.
comb_coils_mrsi_gls

Combine MRSI coil data using the GLS method presented by An et al JMRI 37:1445-1450 (2013).
dicom_reader

A very simple DICOM reader.
fit_svs_edited

Edited SVS 1H brain analysis pipeline.
fp_phase

Return the phase of the first data point in the time-domain.
find_bids_mrs

Search for MRS data files in a BIDS filesystem structure.
diff_mrs

Apply the diff operator to an MRS dataset in the FID/spectral dimension.
gen_F

Generate the F product operator.
fit_res2csv

Write fit results table to a csv file.
fit_mrs

Perform a fit based analysis of MRS data.
fd_gauss_smo

Apply a Gaussian smoother in the spectral domain.
fit_t2_te_array

Fit a T2 relaxation curve, from multiple TEs, to a set of amplitudes.
fit_t1_tr_array

Fit a T1 recovery curve, from multiple TRs, to a set of amplitudes.
get_fit_map

Get a data array from a fit result.
get_1h_spectre_basis_names

Return a character vector of molecules included in the Gold Star Phantoms SPECTRE phantom.
gen_numeric_reg

Generate a regressor from a numeric vector.
gen_poly_reg

Generate polynomial regressors.
fp_scale

Scale the first time-domain data point in an mrs_data object.
get_1h_braino_basis_names

Return a character vector of molecules included in the GE BRAINO phantom.
gen_F_xy

Generate the Fxy product operator with a specified phase.
crop_xy

Crop an MRSI dataset in the x-y direction
crop_td_pts_pot

Crop mrs_data object data points in the time-domain rounding down to the next smallest power of two (pot). Data that already has a pot length will not be changed.
comb_coils_svs_gls

Combine SVS coil data using the GLS method presented by An et al JMRI 37:1445-1450 (2013).
fp_phase_correct

Perform a zeroth order phase correction based on the phase of the first data point in the time-domain.
gen_bold_reg

Generate BOLD regressors.
gen_conv_reg

Generate regressors by convolving a specified response function with a stimulus.
get_1h_brain_basis_paras

Return a list of mol_parameter objects suitable for 1H brain MRS analyses.
def_nuc

Return the default nucleus.
get_mol_paras

Get a mol_parameters object for a named molecule.
get_mrs_affine

Generate an affine for nifti generation.
get_voi_cog

Calculate the centre of gravity for an image containing 0 and 1's.
get_fp

Return the first time-domain data point.
fs

Return the sampling frequency in Hz of an MRS dataset.
get_1h_brain_basis_paras_v1

Return a list of mol_parameter objects suitable for 1H brain MRS analyses.
get_mrsi_voi

Generate a MRSI VOI from an mrs_data object.
get_mol_names

Return a character array of names that may be used with the get_mol_paras function.
get_metab

Extract the metabolite component from an mrs_data object.
get_mrsi2d_seg

Calculate the partial volume estimates for each voxel in a 2D MRSI dataset.
get_subset

Extract a subset of MRS data.
get_svs_voi

Generate a SVS acquisition volume from an mrs_data object.
get_voi_seg

Return the white matter, gray matter and CSF composition of a volume.
gridplot

Arrange spectral plots in a grid.
glm_spec_fmrs_fl

Perform first-level spectral GLM analysis of an fMRS dataset.
glm_spec

Perform a GLM analysis of dynamic MRS data in the spectral domain.
grid_shift_xy

Grid shift MRSI data in the x/y dimension.
decimate_mrs_fd

Decimate an MRS signal to half the original sampling frequency by filtering in the frequency domain before down sampling.
dyn_acq_times

Return a time scale vector of acquisition times for a dynamic MRS scan. The first temporal scan is assigned a value of 0.
ecc

Eddy current correction.
hsvd_vec

HSVD of a complex vector.
hsvd_filt

HSVD based signal filter.
int_spec

Integrate a spectral region.
interleave_dyns

Interleave the first and second half of a dynamic series.
lb

Apply line-broadening (apodisation) to MRS data or basis object.
fit_amps

Extract the fit amplitudes from an object of class fit_result.
ft_dyns

Apply the Fourier transform over the dynamic dimension.
fit_svs_gui

GUI interface for the standard SVS 1H brain analysis pipeline, this is a work in progress, and not ready for serious use.
fit_t1_ti_array

Fit a T1 recovery curve, from multiple TIs, to a set of amplitudes.
find_mrs_files

Find valid MRS data files recursively from a directory path.
lb_renoise

Apply line-broadening to dynamic MRS data and add normally distributed noise (renoise) to reverse any associated improvement in SNR.
def_ref

Return the default reference value for ppm scale.
mask_dyns

Mask an MRS dataset in the dynamic dimension.
is.def

Check if an object is defined, which is the same as being not NULL.
match_lineshape

Apply Voigt line-broadening to match a reference spectrum.
is_fd

Check if the chemical shift dimension of an MRS data object is in the frequency domain.
make_basis_from_raw

Make a basis-set object from a directory containing LCModel formatted RAW files.
matexp

Matrix exponential function taken from complexplus package to reduce the number of spant dependencies.
lw2beta

Covert a linewidth in Hz to an equivalent beta value in the time-domain ie: x * exp(-t * t * beta).
fd2td

Transform frequency-domain data to the time-domain.
fit_svs_edited_group_results

Combine edited fitting results for group analysis.
fit_svs_group_results

Combine fitting results for group analysis.
mask_fit_res

Mask fit result spectra depending on a vector of bool values.
fd_conv_filt

Frequency-domain convolution based filter.
gen_baseline_reg

Generate baseline regressor.
ft_shift

Perform a fft and ffshift on a vector.
gen_I

Generate the I product operator for a single spin.
gen_group_reg

Expand a regressor matrix for a group analysis.
ft_shift_mat

Perform a fft and fftshift on a matrix with each column replaced by its shifted fft.
gen_trap_reg

Generate trapezoidal regressors.
gausswin_2d

Create a two dimensional Gaussian window function stored as a matrix.
median_dyns

Calculate the median dynamic data.
mvfftshift

Perform a fftshift on a matrix, with each column replaced by its shifted result.
mrs_data2vec

Convert mrs_data object to a vector.
mod_td

Apply the Modulus operator to the time-domain MRS signal.
plot_bc

Convenience function to plot a baseline estimate with the original data.
plot.mrs_data

Plotting method for objects of class mrs_data.
get_acq_paras

Return acquisition parameters from a MRS data object.
get_1h_brain_basis_paras_v2

Return a list of mol_parameter objects suitable for 1H brain MRS analyses.
get_1h_brain_basis_paras_v3

Return a list of mol_parameter objects suitable for 1H brain MRS analyses.
get_2d_psf

Get the point spread function (PSF) for a 2D phase encoded MRSI scan.
gen_impulse_reg

Generate impulse regressors.
mean_dyns

Calculate the mean dynamic data.
mean_dyns_scheme

Average sets of dynamics according to a scheme vector.
get_fh_dyns

Return the first half of a dynamic series.
get_seg_ind

Get the indices of data points lying between two values (end > x > start).
get_1h_brain_basis_names

Return a character vector of common 1H molecules found in healthy human brain.
get_sh_dyns

Return the second half of a dynamic series.
get_even_dyns

Return even numbered dynamic scans starting from 1 (2,4,6...).
get_basis_subset

Return a subset of the input basis.
get_tail_dyns

Return the last scans of a dynamic series.
hsvd

HSVD of an mrs_data object.
get_td_amp

Return an array of amplitudes derived from fitting the initial points in the time domain and extrapolating back to t=0.
hz

Return the frequency scale of an MRS dataset in Hz.
gridplot.mrs_data

Arrange spectral plots in a grid.
ift_shift

Perform an iffshift and ifft on a vector.
get_dyns

Extract a subset of dynamic scans.
get_hrf

Generate a double gamma model of the HRF as used in SPM.
inv_even_dyns

Invert even numbered dynamic scans starting from 1 (2,4,6...).
get_guassian_pulse

Generate a gaussian pulse shape.
get_head_dyns

Return the first scans of a dynamic series.
get_mrsi_voxel

Generate a MRSI voxel from an mrs_data object.
mr_data2bids

Create a BIDS file structure from a vector of data paths or list of mri/mrs data objects.
preproc_svs

Preprocess and perform quality assessment of a single SVS data set.
get_slice

Return a single slice from a larger MRSI dataset.
get_ref

Extract the reference component from an mrs_data object.
qn_states

Get the quantum coherence matrix for a spin system.
get_lcm_cmd

Print the command to run the LCModel command-line program.
get_odd_dyns

Return odd numbered dynamic scans starting from 1 (1,3,5...).
get_spin_num

Return the spin number for a given nucleus.
read_tqn_result

Reader for csv results generated by TARQUIN.
rats

Robust Alignment to a Target Spectrum (RATS).
preproc_svs_dataset

Preprocess and perform quality assessment of one or more SVS data sets.
get_voi_seg_psf

Return the white matter, gray matter and CSF composition of a volume.
get_voxel

Return a single voxel from a larger mrs dataset.
ift_shift_mat

Perform an ifft and ifftshift on a matrix with each column replaced by its shifted ifft.
image.mrs_data

Image plot method for objects of class mrs_data.
rectangular_mask

Create a rectangular mask stored as a matrix of logical values.
recon_imag

Reconstruct complex time-domain data from the real part of frequency-domain data.
mrs_data2basis

Convert an mrs_data object to basis object - where basis signals are spread across the dynamic dimension in the MRS data.
get_mrsi_voxel_xy_psf

Generate a MRSI voxel PSF from an mrs_data object.
mask_xy_corners

Mask the four corners of an MRSI dataset in the x-y plane.
mask_xy

Mask an MRSI dataset in the x-y direction
inv_odd_dyns

Invert odd numbered dynamic scans starting from 1 (1,3,5...).
mean_dyn_blocks

Calculate the mean of adjacent dynamic scans.
mean_dyn_pairs

Calculate the pairwise means across a dynamic data set.
mrs_data2bids

Create a BIDS file structure from a vector of MRS data paths or list of mrs_data objects.
get_uncoupled_mol

Generate a mol_parameters object for a simple spin system with one resonance.
glm_spec_fmrs_group

Perform group-level spectral GLM analysis of an fMRS dataset.
img2kspace_xy

Transform 2D MRSI data to k-space in the x-y direction.
glm_spec_group_linhyp

Test a group-level spectral GLM linear hypothesis.
get_tqn_cmd

Print the command to run the TARQUIN command-line program.
reexports

Objects exported from other packages
scale_amp_molal

Apply water reference scaling to a fitting results object to yield metabolite quantities in millimolar (mM) units (mol / kg of tissue water).
pg_extrap_xy

Papoulis-Gerchberg (PG) algorithm method for k-space extrapolation.
one_page_pdf

Export a one-page pdf of a single fit result
nifti_flip_lr

Flip the x data dimension order of a nifti image. This corresponds to flipping MRI data in the left-right direction, assuming the data in save in neurological format (can check with fslorient program).
scale_amp_molal_pvc

Apply water reference scaling to a fitting results object to yield metabolite quantities in millimolar (mM) units (mol / kg of tissue water).
phase

Apply phasing parameters to MRS data.
mat2mrs_data

Convert a matrix (with spectral points in the column dimension and dynamics in the row dimensions) into a mrs_data object.
lofdc

Correct linear frequency drift.
lw2alpha

Covert a linewidth in Hz to an equivalent alpha value in the time-domain ie: x * exp(-t * alpha).
install_cli

Install the spant command-line interface scripts to a system path.
l2_reg

Perform l2 regularisation artefact suppression.
kspace2img_xy

Transform 2D MRSI data from k-space to image space in the x-y direction.
scale_basis_from_singlet

Scale a basis-set to be consistent with spant assumptions for water scaling.
mrs_data2list

Split MRS data containing multiple spectra into a list of single spectra datasets.
mvifftshift

Perform an ifftshift on a matrix, with each column replaced by its shifted result.
match_files

Match files based on a vector of input paths and a glob pattern. The glob pattern is appended to each path and should match one file only.
mean.mrs_data

Calculate the mean spectrum from an mrs_data object.
paths2df

Split paths into parts based on backslash, forwardslash and dot characters and return a data frame of these parts.
mean.list

Calculate the mean spectrum from an mrs_data object.
mrs_data2spec_mat

Convert mrs_data object to a matrix, with spectral points in the column dimension and dynamics in the row dimension.
mrs_data2mat

Convert mrs_data object to a matrix, with spectral points in the column dimension and dynamics in the row dimension.
read_ima_coil_dir

Read a directory containing Siemens MRS IMA files and combine along the coil dimension. Note that the coil ID is inferred from the sorted file name and should be checked when consistency is required between two directories.
precomp

Save function results to file and load on subsequent calls to avoid repeat computation.
ppm

Return the ppm scale of an MRS dataset or fit result.
n2coord

Print fit coordinates from a single index.
read_ima_dyn_dir

Read a directory containing Siemens MRS IMA files and combine along the dynamic dimension. Note that the coil ID is inferred from the sorted file name and should be checked when consistency is required.
recon_imag_vec

Reconstruct complex time-domain data from the real part of frequency-domain data.
mask_xy_ellipse

Mask the voxels outside an elliptical region spanning the MRSI dataset in the x-y plane.
peak_info

Search for the highest peak in a spectral region and return the frequency, height and FWHM.
plot_slice_fit_inter

Plot a 2D slice from an MRSI fit result object.
recon_twix_2d_mrsi

Reconstruct 2D MRSI data from a twix file loaded with read_mrs.
scale_amp_ratio_value

Scale fitted amplitudes to a ratio of signal amplitude.
reson_table2mrs_data

Generate mrs_data from a table of single Lorentzian resonances.
scale_amp_ratio

Scale fitted amplitudes to a ratio of signal amplitude.
sd.mrs_data

Calculate the standard deviation spectrum from an mrs_data object.
reslice_to_mrs

Reslice a nifti object to match the orientation of mrs data.
read_mrs

Read MRS data from the filesystem.
plot_spec_sd

Plot the spectral standard deviation.
plot_reg

Plot regressors as an image.
plot_slice_map_inter

Plot an interactive slice map from a data array where voxels can be selected to display a corresponding spectrum.
plot_slice_fit

Plot a 2D slice from an MRSI fit result object.
seconds

Return a time scale vector to match the FID of an MRS data object.
rep_dyn

Replicate a scan in the dynamic dimension.
read_lcm_coord

Read an LCModel formatted coord file containing fit information.
seq_steam_ideal_young

STEAM sequence with ideal pulses using the z-rotation gradient simulation method described by Young et al JMR 140, 146-152 (1999).
scale_mrs_amp

Scale an mrs_data object by a scalar or vector or amplitudes.
read_pulse_bruker

Read a Bruker formatted pulse file
set_Ntrans

Set the number of transients for an mrs_data object.
set_tqn_cmd

Set the command to run the TARQUIN command-line program.
sim_basis_1h_brain_press

Simulate a basis-set suitable for 1H brain MRS analysis acquired with a PRESS sequence. Note, ideal pulses are assumed.
set_tr

Set the repetition time of an MRS dataset.
sim_basis_1h_brain

Simulate a basis-set suitable for 1H brain MRS analysis acquired with a PRESS sequence. Note, ideal pulses are assumed.
smooth_dyns

Smooth data across the dynamic dimension with a Gaussian kernel.
print.mrs_data

Print a summary of mrs_data parameters.
read_basis

Read a basis file in LCModel .basis format.
re_weighting

Apply a weighting to the FID to enhance spectral resolution.
plot_slice_map

Plot a slice from a 7 dimensional array.
read_siemens_txt_hdr

Read the text format header found in Siemens IMA and TWIX data files.
print.fit_result

Print a summary of an object of class fit_result.
read_pulse_pta

Read a .pta formatted pulse file compatible with Siemens PulseTool.
scale_amp_water_ratio

Scale metabolite amplitudes as a ratio to the unsuppressed water amplitude.
rep_array_dim

Repeat an array over a given dimension.
sort_basis

Sort the basis-set elements alphabetically.
mask_xy_mat

Mask a 2D MRSI dataset in the x-y dimension.
stackplot

Produce a plot with multiple traces.
varpro_3_para_opts

Return a list of options for VARPRO based fitting with 3 free parameters.
ssp

Signal space projection method for lipid suppression.
sub_odd_from_even_dyns

Subtract the odd dynamic scans from the even dynamic scans.
seq_press_ideal

PRESS sequence with ideal pulses.
rm_dyns

Remove a subset of dynamic scans.
read_tqn_fit

Reader for csv fit results generated by TARQUIN.
sd.list

Calculate the standard deviation spectrum from an mrs_data object.
scale_amp_legacy

Apply water reference scaling to a fitting results object to yield metabolite quantities in units of "mmol per Kg wet weight".
resample_basis

Resample a basis-set to match a mrs_data acquisition.
rep_mrs

Replicate a scan over a given dimension.
scale_spec

Scale mrs_data to a spectral region.
set_ref

Set the ppm reference value (eg ppm value at 0Hz).
seq_pulse_acquire

Simple pulse and acquire sequence with ideal pulses.
set_td_pts

Set the number of time-domain data points, truncating or zero-filling as appropriate.
max_mrs

Apply the max operator to an MRS dataset.
set_def_acq_paras

Set the default acquisition parameters.
max_mrs_interp

Apply the max operator to an interpolated MRS dataset.
set_lcm_cmd

Set the command to run the LCModel command-line program.
sim_asy_pvoigt

Generate an asymmetric pseudo-Voigt resonance in the frequency domain.
set_lw

Apply line-broadening to an mrs_data object to achieve a specified linewidth.
sim_basis

Simulate a basis set object.
sim_th_excit_profile

Simulate an ideal pulse excitation profile by smoothing a top-hat function with a Gaussian.
sum_mrs_list

Return the sum of a list of mrs_data objects.
seq_steam_ideal

STEAM sequence with ideal pulses.
seq_mega_press_ideal

MEGA-PRESS sequence with ideal localisation pulses and Gaussian shaped editing pulse.
seq_steam_ideal_cof

STEAM sequence with ideal pulses and coherence order filtering to simulate gradient crushers.
seq_press_2d_shaped

PRESS sequence with shaped refocusing pulses.
scale_basis_amp

Scale a basis object by a scalar.
sim_resonances

Simulate a MRS data object containing a set of simulated resonances.
shift

Apply a frequency shift to MRS data.
shift_basis

Apply frequency shifts to basis set signals.
sim_noise

Simulate an mrs_data object containing simulated Gaussian noise.
spec_op

Perform a mathematical operation on a spectral region.
stackplot.fit_result

Plot the fitting results of an object of class fit_result with individual basis set components shown.
spec_decomp

Decompose an mrs_data object into white and gray matter spectra.
mean_mrs_list

Return the mean of a list of mrs_data objects.
spant_sim_fmrs_dataset

Simulate an example fMRS dataset for a block design fMRS experiment and export a BIDS structure.
sim_brain_1h

Simulate MRS data with a similar appearance to normal brain (by default).
set_mask_xy_mat

Set the masked voxels in a 2D MRSI dataset to given spectrum.
sim_mol

Simulate a mol_parameter object.
mean_vec_blocks

Calculate the mean of adjacent blocks in a vector.
trim_paths

Trim a vector of filesystem paths.
subtract_rest_task

Subtract mean rest spectrum from mean task spectrum after applying optimal linebroadening to the mean task spectrum. Usually used to correct for the BOLD lineshape narrowing effect in 1H fMRS data.
write_mrs

Write MRS data object to file.
sv_res_table

Output a table of fit amplitudes and error estimates for a single-voxel fit.
svs_1h_brain_analysis

Standard SVS 1H brain analysis pipeline.
write_mrs_nifti

Write MRS data object to file in NIFTI format.
tr

Return the repetition time of an MRS dataset.
zero_td_pts_end

Set mrs_data object data points at the end of the FID to zero.
sub_mean_dyns

Subtract the mean dynamic spectrum from a dynamic series.
sub_median_dyns

Subtract the median dynamic spectrum from a dynamic series.
sim_zero

Simulate an mrs_data object containing complex zero valued samples.
spant_simulation_benchmark

Simulate a typical metabolite basis set for benchmarking. Timing metrics will be printed on completion.
ortho3

Display an orthographic projection plot of a nifti object.
ortho3_inter

Display an interactive orthographic projection plot of a nifti object.
stackplot.mrs_data

Stackplot plotting method for objects of class mrs_data.
phase_ref_1h_brain

Corrected zero order phase and chemical shift offset in 1H MRS data from the brain.
plot.fit_result

Plot the fitting results of an object of class fit_result.
read_mrs_tqn

Read MRS data using the TARQUIN software package.
read_dkd_moco_log

Read the log from Dinesh's MoCo sLASER sequence.
plot_voi_overlay_seg

Plot a volume as an overlay on a segmented brain volume.
plot_voi_overlay

Plot a volume as an image overlay.
read_basis_niidir

Read a basis folder containing one NIfTI MRS file for each basis element.
te

Return the echo time of an MRS dataset.
zero_higher_orders

Zero all coherences including and above a given order.
sum_mrs

Sum two mrs_data objects.
vec2mrs_data

Convert a vector into a mrs_data object.
write_basis

Write a basis object to an LCModel .basis formatted file.
zf

Zero-fill MRS data in the time domain.
zf_xy

Zero-fill MRSI data in the k-space x-y direction.
td2fd

Transform time-domain data to the frequency-domain.
t_test_spec

Perform a t-test on spectral data points.
varpro_opts

Return a list of options for VARPRO based fitting.
sub_first_dyn

Subtract the first dynamic spectrum from a dynamic series.
varpro_basic_opts

Return a list of options for a basic VARPRO analysis.
sub_even_from_odd_dyns

Subtract the even dynamic scans from the odd dynamic scans.
write_basis_niidir

Write a basis object to folder containing one NIfTI MRS file for each basis element.
seq_slaser_ideal

sLASER sequence with ideal pulses.
scale_amp_molar

Apply water reference scaling to a fitting results object to yield metabolite quantities in millimolar (mM) units (mol / Litre of tissue). This function is depreciated, please use scale_amp_legacy instead.
segment_t1_fsl

Segment T1 weighted MRI data using FSL FAST and write to file. Runs deface and bet as preprocessing steps by default.
scale_amp_molar2molal_pvc

Convert default LCM/TARQUIN concentration scaling to molal units with partial volume correction.
resample_voi

Resample a VOI to match a target image space using nearest-neighbour interpolation.
seq_cpmg_ideal

CPMG style sequence with ideal pulses.
read_pulse_ascii

Read an ASCII formatted pulse file.
resample_img

Resample an image to match a target image space.
seq_spin_echo_ideal

Spin echo sequence with ideal pulses.
set_precomp_mode

Set the precompute mode.
svs_1h_brain_analysis_dev

Standard SVS 1H brain analysis pipeline.
set_precomp_verbose

Set the verbosity of the precompute function.
write_basis_tqn

Generate a basis file using TARQUIN.
svs_1h_brain_batch_analysis

Batch interface to the standard SVS 1H brain analysis pipeline.
sim_basis_mm_lip_lcm

Simulate a macromolecular and lipid basis-set suitable for 1H brain MRS analysis.
spin_sys

Create a spin system object for pulse sequence simulation.
td_conv_filt

Time-domain convolution based filter.
spant-package

spant: spectroscopy analysis tools.
sim_basis_tqn

Simulate a basis file using TARQUIN.
sum_coils

Calculate the sum across receiver coil elements.
spant_abfit_benchmark

Simulate and fit some spectra with ABfit for benchmarking purposes. Basic timing and performance metrics will be printed.
spm_pve2categorical

Convert SPM style segmentation files to a single categorical image where the numerical values map as: 0) Other, 1) CSF, 2) GM and 3) WM.
sum_dyns

Calculate the sum of data dynamics.
zero_fade_spec

Fade a spectrum to zero by frequency domain multiplication with a tanh function. Note this operation distorts data points at the end of the FID.
write_pulse_ascii

Write an ASCII formatted pulse file.
tdsr

Time-domain spectral registration.
Ndyns

Return the total number of dynamic scans in an MRS dataset.
Nspec

Return the total number of spectra in an MRS dataset.
Conj.mrs_data

Apply Conj operator to an MRS dataset.
Im.mrs_data

Apply Im operator to an MRS dataset.