Package: spant 2.23.0

spant: MR Spectroscopy Analysis Tools

Tools for reading, visualising and processing Magnetic Resonance Spectroscopy data. The package includes methods for spectral fitting: Wilson (2021) <doi:10.1002/mrm.28385> and spectral alignment: Wilson (2018) <doi:10.1002/mrm.27605>.

Authors:Martin Wilson [cre, aut], Yong Wang [ctb], John Muschelli [ctb]

spant_2.23.0.tar.gz
spant_2.23.0.zip(r-4.5)spant_2.23.0.zip(r-4.4)spant_2.23.0.zip(r-4.3)
spant_2.23.0.tgz(r-4.4-x86_64)spant_2.23.0.tgz(r-4.4-arm64)spant_2.23.0.tgz(r-4.3-x86_64)spant_2.23.0.tgz(r-4.3-arm64)
spant_2.23.0.tar.gz(r-4.5-noble)spant_2.23.0.tar.gz(r-4.4-noble)
spant_2.23.0.tgz(r-4.4-emscripten)spant_2.23.0.tgz(r-4.3-emscripten)
spant.pdf |spant.html
spant/json (API)
NEWS

# Install 'spant' in R:
install.packages('spant', repos = c('https://martin3141.r-universe.dev', 'https://cloud.r-project.org'))

Peer review:

Bug tracker:https://github.com/martin3141/spant/issues

Datasets:

On CRAN:

brainmrimrsmrshubspectroscopy

8.26 score 23 stars 57 scripts 952 downloads 1 mentions 342 exports 34 dependencies

Last updated 2 months agofrom:33f5ccbb7b. Checks:OK: 9. Indexed: yes.

TargetResultDate
Doc / VignettesOKOct 26 2024
R-4.5-win-x86_64OKOct 26 2024
R-4.5-linux-x86_64OKOct 26 2024
R-4.4-win-x86_64OKOct 26 2024
R-4.4-mac-x86_64OKOct 26 2024
R-4.4-mac-aarch64OKOct 26 2024
R-4.3-win-x86_64OKOct 26 2024
R-4.3-mac-x86_64OKOct 26 2024
R-4.3-mac-aarch64OKOct 26 2024

Exports:abfit_optsabfit_opts_v1_9_0acquireadd_noiseadd_noise_spec_snralignapodise_xyappend_basisappend_coilsappend_dynsappend_regsapply_axesapply_mrsapply_pulsearray2mrs_dataauto_phaseback_extrap_arbasis2dyn_mrs_databasis2mrs_databbasebc_alsbc_constantbc_gaussbc_polybc_splinebeta2lwbin_speccalc_basis_corr_matcalc_basis_crlbscalc_coil_noise_corcalc_coil_noise_sdcalc_design_efficiencycalc_ed_from_lambdacalc_peak_info_veccalc_sd_polycalc_spec_diffcalc_spec_snrcheck_lcmcheck_tqncirc_maskcoherence_filtercollapse_to_dynscomb_coilscomb_coils_mrsi_glscomb_coils_svs_glscomb_fit_list_fit_tablescomb_fit_list_result_tablescomb_fit_tablescomb_metab_refconv_mrscrop_basiscrop_speccrop_td_ptscrop_td_pts_endcrop_td_pts_potcrop_xycrossprod_3ddecimate_mrs_fddecimate_mrs_tddeconv_mrsdef_acq_parasdef_fsdef_ftdef_Ndef_nucdef_refdicom_readerdiff_mrsdownsample_mrs_fddownsample_mrs_tddyn_acq_timeseccelliptical_maskest_noise_sdfd_conv_filtfd_gauss_smofd2tdfind_bids_mrsfind_mrs_filesfit_ampsfit_diagsfit_mrsfit_res2csvfit_t1_ti_arrayfit_t1_tr_arrayfit_t2_te_arrayfp_phasefp_phase_correctfp_scalefsft_dynsft_shiftft_shift_matgausswin_2dgen_baseline_reggen_bold_reggen_conv_reggen_Fgen_F_xygen_group_reggen_Igen_impulse_reggen_poly_reggen_trap_regget_1h_brain_basis_namesget_1h_brain_basis_parasget_1h_brain_basis_paras_v1get_1h_brain_basis_paras_v2get_1h_brain_basis_paras_v3get_1h_braino_basis_namesget_1h_spectre_basis_namesget_2d_psfget_acq_parasget_basis_subsetget_dynsget_even_dynsget_fh_dynsget_fit_mapget_fpget_guassian_pulseget_head_dynsget_lcm_cmdget_metabget_mol_namesget_mol_parasget_mrsi_voiget_mrsi_voxelget_mrsi_voxel_xy_psfget_mrsi2d_segget_odd_dynsget_refget_seg_indget_sh_dynsget_sliceget_spin_numget_subsetget_svs_voiget_tail_dynsget_td_ampget_tqn_cmdget_uncoupled_molget_voi_cogget_voi_segget_voi_seg_psfget_voxelglm_specglm_spec_fmrs_flglm_spec_fmrs_groupglm_spec_group_linhypgrid_shift_xygridplothsvdhsvd_filthsvd_vechzift_shiftift_shift_matimg2kspace_xyImzapint_specinterleave_dynsinv_even_dynsinv_odd_dynsis_fdkspace2img_xyl2_reglblofdclw2alphalw2betamake_basis_from_rawmask_dynsmask_fit_resmask_xymask_xy_cornersmask_xy_ellipsemask_xy_matmat2mrs_datamatexpmax_mrsmax_mrs_interpmean_dyn_blocksmean_dyn_pairsmean_dynsmean_mrs_listmean_vec_blocksmedian_dynsmod_tdmrs_data2basismrs_data2bidsmrs_data2matmrs_data2spec_matmrs_data2vecmvfftshiftmvifftshiftn2coordNcoilsNdynsnifti_flip_lrNptsNspecNtransNxNyNzone_page_pdfortho3ortho3_interpeak_infopg_extrap_xyphasephase_ref_1h_brainplot_bcplot_regplot_slice_fitplot_slice_fit_interplot_slice_mapplot_slice_map_interplot_spec_sdplot_voi_overlayplot_voi_overlay_segppmprecomppreproc_svspreproc_svs_datasetqn_statesratsre_weightingread_basisread_ima_coil_dirread_ima_dyn_dirread_lcm_coordread_mrsread_mrs_tqnread_pulse_asciiread_pulse_brukerread_pulse_ptaread_siemens_txt_hdrread_tqn_fitread_tqn_resultreadNiftirecon_imagrecon_imag_vecrecon_twix_2d_mrsirectangular_maskrep_array_dimrep_dynrep_mrsresample_basisresample_imgresample_voireslice_to_mrsreson_table2mrs_datarm_dynsscale_amp_molalscale_amp_molal_pvcscale_amp_molarscale_amp_molar2molal_pvcscale_amp_ratioscale_amp_ratio_valuescale_amp_water_ratioscale_basis_ampscale_basis_from_singletscale_mrs_ampscale_specsdsecondsseq_cpmg_idealseq_mega_press_idealseq_press_2d_shapedseq_press_idealseq_pulse_acquireseq_slaser_idealseq_spin_echo_idealseq_steam_idealseq_steam_ideal_cofseq_steam_ideal_youngset_def_acq_parasset_lcm_cmdset_lwset_mask_xy_matset_Ntransset_precomp_modeset_precomp_verboseset_refset_td_ptsset_tqn_cmdset_trshiftshift_basissim_basissim_basis_1h_brainsim_basis_1h_brain_presssim_basis_mm_lip_lcmsim_basis_tqnsim_brain_1hsim_molsim_noisesim_resonancessim_th_excit_profilesim_zerosmooth_dynssort_basisspant_abfit_benchmarkspant_sim_fmrs_datasetspant_simulation_benchmarkspec_decompspec_opspin_sysspm_pve2categoricalsspstackplotsub_first_dynsub_mean_dynssub_median_dynssum_coilssum_dynssum_mrssum_mrs_listsvs_1h_brain_analysissvs_1h_brain_analysis_devsvs_1h_brain_batch_analysist_test_spectd_conv_filttd2fdtdsrtetrvarpro_3_para_optsvarpro_basic_optsvarpro_optsvec2mrs_datawrite_basiswrite_basis_tqnwrite_mrswrite_pulse_asciiwriteNiftizero_fade_speczero_higher_orderszero_td_pts_endzfzf_xy

Dependencies:abindclidotCall64expmfieldsglueirlbajsonlitelatticelifecyclemagrittrmapsMASSMatrixminpack.lmmmandnloptrnumDerivplyrpracmaptwRcppRcppArmadilloRcppDERcppEigenrlangRNiftiRNiftyRegsignalspamstringistringrvctrsviridisLite

ABfit baseline options

Rendered fromabfit-baseline-opts.Rmdusingknitr::rmarkdownon Oct 26 2024.

Last update: 2024-04-12
Started: 2020-02-18

Basis simulation

Rendered fromspant-basis-simulation.Rmdusingknitr::rmarkdownon Oct 26 2024.

Last update: 2024-04-12
Started: 2021-05-04

Common preprocessing steps

Rendered fromspant-preprocessing.Rmdusingknitr::rmarkdownon Oct 26 2024.

Last update: 2024-04-12
Started: 2020-03-11

Introduction to spant

Rendered fromspant-intro.Rmdusingknitr::rmarkdownon Oct 26 2024.

Last update: 2024-04-12
Started: 2017-04-26

Metabolite simulation

Rendered fromspant-metabolite-simulation.Rmdusingknitr::rmarkdownon Oct 26 2024.

Last update: 2024-04-12
Started: 2021-04-29

Readme and manuals

Help Manual

Help pageTopics
spant: spectroscopy analysis tools.spant-package spant
Return a list of options for an ABfit analysis.abfit_opts
Return a list of options for an ABfit analysis to maintain comparability with analyses performed with version 1.9.0 (and earlier) of spant.abfit_opts_v1_9_0
Simulate pulse sequence acquisition.acquire
Add noise to an mrs_data object.add_noise
Add noise to an mrs_data object to match a given SNR.add_noise_spec_snr
Align spectra to a reference frequency using a convolution based method.align
Apodise MRSI data in the x-y direction with a k-space filter.apodise_xy
Combine a pair of basis set objects.append_basis
Append MRS data across the coil dimension, assumes they matched across the other dimensions.append_coils
Append MRS data across the dynamic dimension, assumes they matched across the other dimensions.append_dyns
Append multiple regressor data frames into a single data frame.append_regs
Apply a function over specified array axes.apply_axes
Apply a function across given dimensions of a MRS data object.apply_mrs
Simulate an RF pulse on a single spin.apply_pulse
Apply Arg operator to an MRS dataset.Arg.mrs_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.array2mrs_data
Perform zeroth-order phase correction based on the minimisation of the squared difference between the real and magnitude components of the spectrum.auto_phase
Back extrapolate time-domain data points using an autoregressive model.back_extrap_ar
Convert a basis object to a dynamic mrs_data object.basis2dyn_mrs_data
Convert a basis object to an mrs_data object - where basis signals are spread across the dynamic dimension.basis2mrs_data
Generate a spline basis, slightly adapted from : "Splines, knots, and penalties", Eilers 2010.bbase
Baseline correction using the ALS method.bc_als
Remove a constant baseline offset based on a reference spectral region.bc_constant
Apply and subtract a Gaussian smoother in the spectral domain.bc_gauss
Fit and subtract a polynomial to each spectrum in a dataset.bc_poly
Fit and subtract a smoothing spline to each spectrum in a dataset.bc_spline
Covert a beta value in the time-domain to an equivalent linewidth in Hz: x * exp(-i * t * t * beta).beta2lw
Bin equally spaced spectral regions.bin_spec
Estimate the correlation matrix for a basis set.calc_basis_corr_mat
Estimate the CRLB for each element in a basis set.calc_basis_crlbs
Calculate the noise correlation between coil elements.calc_coil_noise_cor
Calculate the noise standard deviation for each coil element.calc_coil_noise_sd
Calculate the efficiency of a regressor data frame.calc_design_efficiency
Calculate the effective dimensions of a spline smoother from lambda.calc_ed_from_lambda
Calculate the FWHM of a peak from a vector of intensity values.calc_peak_info_vec
Perform a polynomial fit, subtract and return the standard deviation of the residuals.calc_sd_poly
Calculate the sum of squares differences between two mrs_data objects.calc_spec_diff
Calculate the spectral SNR.calc_spec_snr
Check LCModel can be runcheck_lcm
Check the TARQUIN binary can be runcheck_tqn
Create a logical circular mask spanning the full extent of an n x n matrix.circ_mask
Zero all coherence orders other than the one supplied as an argument.coherence_filter
Collapse MRS data by concatenating spectra along the dynamic dimension.collapse_to_dyns collapse_to_dyns.fit_result collapse_to_dyns.mrs_data
Combine coil data based on the first data point of a reference signal.comb_coils
Combine MRSI coil data using the GLS method presented by An et al JMRI 37:1445-1450 (2013).comb_coils_mrsi_gls
Combine SVS coil data using the GLS method presented by An et al JMRI 37:1445-1450 (2013).comb_coils_svs_gls
Combine all fitting data points from a list of fits into a single data frame.comb_fit_list_fit_tables
Combine the fit result tables from a list of fit results.comb_fit_list_result_tables
Combine all fitting data points into a single data frame.comb_fit_tables
Combine a reference and metabolite mrs_data object.comb_metab_ref
Apply Conj operator to an MRS dataset.Conj.mrs_data
Convolve two MRS data objects.conv_mrs
Crop 'basis_set' object based on a frequency range.crop_basis
Crop 'mrs_data' object based on a frequency range.crop_spec
Crop 'mrs_data' object data points in the time-domain.crop_td_pts
Crop 'mrs_data' object data points at the end of the FID.crop_td_pts_end
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.crop_td_pts_pot
Crop an MRSI dataset in the x-y directioncrop_xy
Compute the vector cross product between vectors x and y. Adapted from http://stackoverflow.com/questions/15162741/what-is-rs-crossproduct-functioncrossprod_3d
Decimate an MRS signal to half the original sampling frequency by filtering in the frequency domain before down sampling.decimate_mrs_fd
Decimate an MRS signal by filtering in the time domain before downsampling.decimate_mrs_td
Deconvolve two MRS data objects.deconv_mrs
Return (and optionally modify using the input arguments) a list of the default acquisition parameters.def_acq_paras
Return the default sampling frequency in Hz.def_fs
Return the default transmitter frequency in Hz.def_ft
Return the default number of data points in the spectral dimension.def_N
Return the default nucleus.def_nuc
Return the default reference value for ppm scale.def_ref
A very simple DICOM reader.dicom_reader
Apply the diff operator to an MRS dataset in the FID/spectral dimension.diff_mrs
Downsample an MRS signal by a factor of 2 using an FFT "brick-wall" filter.downsample_mrs_fd
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.downsample_mrs_td
Return a time scale vector of acquisition times for a dynamic MRS scan. The first temporal scan is assigned a value of 0.dyn_acq_times
Eddy current correction.ecc
Create an elliptical mask stored as a matrix of logical values.elliptical_mask
Estimate the standard deviation of the noise from a segment of an mrs_data object.est_noise_sd
Frequency-domain convolution based filter.fd_conv_filt
Apply a Gaussian smoother in the spectral domain.fd_gauss_smo
Transform frequency-domain data to the time-domain.fd2td
Search for MRS data files in a BIDS filesystem structure.find_bids_mrs
Find valid MRS data files recursively from a directory path.find_mrs_files
Extract the fit amplitudes from an object of class 'fit_result'.fit_amps
Calculate diagnostic information for object of class 'fit_result'.fit_diags
Perform a fit based analysis of MRS data.fit_mrs
Write fit results table to a csv file.fit_res2csv
Fit a T1 recovery curve, from multiple TIs, to a set of amplitudes.fit_t1_ti_array
Fit a T1 recovery curve, from multiple TRs, to a set of amplitudes.fit_t1_tr_array
Fit a T2 relaxation curve, from multiple TEs, to a set of amplitudes.fit_t2_te_array
Return the phase of the first data point in the time-domain.fp_phase
Perform a zeroth order phase correction based on the phase of the first data point in the time-domain.fp_phase_correct
Scale the first time-domain data point in an mrs_data object.fp_scale
Return the sampling frequency in Hz of an MRS dataset.fs
Apply the Fourier transform over the dynamic dimension.ft_dyns
Perform a fft and ffshift on a vector.ft_shift
Perform a fft and fftshift on a matrix with each column replaced by its shifted fft.ft_shift_mat
Create a two dimensional Gaussian window function stored as a matrix.gausswin_2d
Generate baseline regressor.gen_baseline_reg
Generate BOLD regressors.gen_bold_reg
Generate regressors by convolving a specified response function with a stimulus.gen_conv_reg
Generate the F product operator.gen_F
Generate the Fxy product operator with a specified phase.gen_F_xy
Expand a regressor matrix for a group analysis.gen_group_reg
Generate the I product operator for a single spin.gen_I
Generate impulse regressors.gen_impulse_reg
Generate polynomial regressors.gen_poly_reg
Generate trapezoidal regressors.gen_trap_reg
Return a character vector of common 1H molecules found in healthy human brain.get_1h_brain_basis_names
Return a list of 'mol_parameter' objects suitable for 1H brain MRS analyses.get_1h_brain_basis_paras
Return a list of 'mol_parameter' objects suitable for 1H brain MRS analyses.get_1h_brain_basis_paras_v1
Return a list of 'mol_parameter' objects suitable for 1H brain MRS analyses.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 character vector of molecules included in the GE BRAINO phantom.get_1h_braino_basis_names
Return a character vector of molecules included in the Gold Star Phantoms SPECTRE phantom.get_1h_spectre_basis_names
Get the point spread function (PSF) for a 2D phase encoded MRSI scan.get_2d_psf
Return acquisition parameters from a MRS data object.get_acq_paras
Return a subset of the input basis.get_basis_subset
Extract a subset of dynamic scans.get_dyns
Return even numbered dynamic scans starting from 1 (2,4,6...).get_even_dyns
Return the first half of a dynamic series.get_fh_dyns
Get a data array from a fit result.get_fit_map
Return the first time-domain data point.get_fp
Generate a gaussian pulse shape.get_guassian_pulse
Return the first scans of a dynamic series.get_head_dyns
Print the command to run the LCModel command-line program.get_lcm_cmd
Extract the metabolite component from an mrs_data object.get_metab
Return a character array of names that may be used with the 'get_mol_paras' function.get_mol_names
Get a 'mol_parameters' object for a named molecule.get_mol_paras
Generate an affine for nifti generation.get_mrs_affine
Generate a MRSI VOI from an 'mrs_data' object.get_mrsi_voi
Generate a MRSI voxel from an 'mrs_data' object.get_mrsi_voxel
Generate a MRSI voxel PSF from an 'mrs_data' object.get_mrsi_voxel_xy_psf
Calculate the partial volume estimates for each voxel in a 2D MRSI dataset.get_mrsi2d_seg
Return odd numbered dynamic scans starting from 1 (1,3,5...).get_odd_dyns
Extract the reference component from an mrs_data object.get_ref
Get the indices of data points lying between two values (end > x > start).get_seg_ind
Return the second half of a dynamic series.get_sh_dyns
Return a single slice from a larger MRSI dataset.get_slice
Return the spin number for a given nucleus.get_spin_num
Extract a subset of MRS data.get_subset
Generate a SVS acquisition volume from an 'mrs_data' object.get_svs_voi
Return the last scans of a dynamic series.get_tail_dyns
Return an array of amplitudes derived from fitting the initial points in the time domain and extrapolating back to t=0.get_td_amp
Print the command to run the TARQUIN command-line program.get_tqn_cmd
Generate a 'mol_parameters' object for a simple spin system with one resonance.get_uncoupled_mol
Calculate the centre of gravity for an image containing 0 and 1's.get_voi_cog
Return the white matter, gray matter and CSF composition of a volume.get_voi_seg
Return the white matter, gray matter and CSF composition of a volume.get_voi_seg_psf
Return a single voxel from a larger mrs dataset.get_voxel
Perform a GLM analysis of dynamic MRS data in the spectral domain.glm_spec
Perform first-level spectral GLM analysis of an fMRS dataset.glm_spec_fmrs_fl
Perform group-level spectral GLM analysis of an fMRS dataset.glm_spec_fmrs_group
Test a group-level spectral GLM linear hypothesis.glm_spec_group_linhyp
Grid shift MRSI data in the x/y dimension.grid_shift_xy
Arrange spectral plots in a grid.gridplot
Arrange spectral plots in a grid.gridplot.mrs_data
HSVD of an mrs_data object.hsvd
HSVD based signal filter.hsvd_filt
HSVD of a complex vector.hsvd_vec
Return the frequency scale of an MRS dataset in Hz.hz
Perform an iffshift and ifft on a vector.ift_shift
Perform an ifft and ifftshift on a matrix with each column replaced by its shifted ifft.ift_shift_mat
Apply Im operator to an MRS dataset.Im.mrs_data
Image plot method for objects of class mrs_data.image.mrs_data
Transform 2D MRSI data to k-space in the x-y direction.img2kspace_xy
Complex rounding function taken from complexplus package to reduce the number of spant dependencies.Imzap
Integrate a spectral region.int_spec
Interleave the first and second half of a dynamic series.interleave_dyns
Invert even numbered dynamic scans starting from 1 (2,4,6...).inv_even_dyns
Invert odd numbered dynamic scans starting from 1 (1,3,5...).inv_odd_dyns
Check if the chemical shift dimension of an MRS data object is in the frequency domain.is_fd
Check if an object is defined, which is the same as being not NULL.is.def
Transform 2D MRSI data from k-space to image space in the x-y direction.kspace2img_xy
Perform l2 regularisation artefact suppression.l2_reg
Apply line-broadening (apodisation) to MRS data or basis object.lb lb.basis_set lb.list lb.mrs_data
Correct linear frequency drift.lofdc
Covert a linewidth in Hz to an equivalent alpha value in the time-domain ie: x * exp(-t * alpha).lw2alpha
Covert a linewidth in Hz to an equivalent beta value in the time-domain ie: x * exp(-t * t * beta).lw2beta
Make a basis-set object from a directory containing LCModel formatted RAW files.make_basis_from_raw
Mask an MRS dataset in the dynamic dimension.mask_dyns
Mask fit result spectra depending on a vector of bool values.mask_fit_res
Mask an MRSI dataset in the x-y directionmask_xy
Mask the four corners of an MRSI dataset in the x-y plane.mask_xy_corners
Mask the voxels outside an elliptical region spanning the MRSI dataset in the x-y plane.mask_xy_ellipse
Mask a 2D MRSI dataset in the x-y dimension.mask_xy_mat
Convert a matrix (with spectral points in the column dimension and dynamics in the row dimensions) into a mrs_data object.mat2mrs_data
Matrix exponential function taken from complexplus package to reduce the number of spant dependencies.matexp
Apply the max operator to an MRS dataset.max_mrs
Apply the max operator to an interpolated MRS dataset.max_mrs_interp
Calculate the mean of adjacent dynamic scans.mean_dyn_blocks
Calculate the pairwise means across a dynamic data set.mean_dyn_pairs
Calculate the mean dynamic data.mean_dyns
Return the mean of a list of mrs_data objects.mean_mrs_list
Calculate the mean of adjacent blocks in a vector.mean_vec_blocks
Calculate the mean spectrum from an mrs_data object.mean.list
Calculate the mean spectrum from an mrs_data object.mean.mrs_data
Calculate the median dynamic data.median_dyns
Apply the Modulus operator to the time-domain MRS signal.mod_td
Apply Mod operator to an MRS dataset.Mod.mrs_data
Convert an mrs_data object to basis object - where basis signals are spread across the dynamic dimension in the MRS data.mrs_data2basis
Create a BIDS file structure from a vector of MRS data paths or list of mrs_data objects.mrs_data2bids
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.mrs_data2spec_mat
Convert mrs_data object to a vector.mrs_data2vec
Perform a fftshift on a matrix, with each column replaced by its shifted result.mvfftshift
Perform an ifftshift on a matrix, with each column replaced by its shifted result.mvifftshift
Print fit coordinates from a single index.n2coord
Return the total number of coil elements in an MRS dataset.Ncoils
Return the total number of dynamic scans in an MRS dataset.Ndyns
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).nifti_flip_lr
Return the number of data points in an MRS dataset.Npts
Return the total number of spectra in an MRS dataset.Nspec
Return the total number of acquired transients for an MRS dataset.Ntrans
Return the total number of x locations in an MRS dataset.Nx
Return the total number of y locations in an MRS dataset.Ny
Return the total number of z locations in an MRS dataset.Nz
Export a one-page pdf of a single fit resultone_page_pdf
Display an orthographic projection plot of a nifti object.ortho3
Display an interactive orthographic projection plot of a nifti object.ortho3_inter
Search for the highest peak in a spectral region and return the frequency, height and FWHM.peak_info
Papoulis-Gerchberg (PG) algorithm method for k-space extrapolation.pg_extrap_xy
Apply phasing parameters to MRS data.phase
Corrected zero order phase and chemical shift offset in 1H MRS data from the brain.phase_ref_1h_brain
Convenience function to plot a baseline estimate with the original data.plot_bc
Plot regressors as an image.plot_reg
Plot a 2D slice from an MRSI fit result object.plot_slice_fit
Plot a 2D slice from an MRSI fit result object.plot_slice_fit_inter
Plot a slice from a 7 dimensional array.plot_slice_map
Plot an interactive slice map from a data array where voxels can be selected to display a corresponding spectrum.plot_slice_map_inter
Plot the spectral standard deviation.plot_spec_sd
Plot a volume as an image overlay.plot_voi_overlay
Plot a volume as an overlay on a segmented brain volume.plot_voi_overlay_seg
Plot the fitting results of an object of class 'fit_result'.plot.fit_result
Plotting method for objects of class mrs_data.plot.mrs_data
Return the ppm scale of an MRS dataset or fit result.ppm ppm.fit_result ppm.mrs_data
Save function results to file and load on subsequent calls to avoid repeat computation.precomp
Preprocess and perform quality assessment of a single SVS data set.preproc_svs
Preprocess and perform quality assessment of one or more SVS data sets.preproc_svs_dataset
Print a summary of an object of class 'fit_result'.print.fit_result
Print a summary of mrs_data parameters.print.mrs_data
Get the quantum coherence matrix for a spin system.qn_states
Robust Alignment to a Target Spectrum (RATS).rats
Apply a weighting to the FID to enhance spectral resolution.re_weighting
Apply Re operator to an MRS dataset.Re.mrs_data
Read a basis file in LCModel .basis format.read_basis
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.read_ima_coil_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.read_ima_dyn_dir
Read an LCModel formatted coord file containing fit information.read_lcm_coord
Read MRS data from a file.read_mrs
Read MRS data using the TARQUIN software package.read_mrs_tqn
Read an ASCII formatted pulse file.read_pulse_ascii
Read a Bruker formatted pulse fileread_pulse_bruker
Read a .pta formatted pulse file compatible with Siemens PulseTool.read_pulse_pta
Read the text format header found in Siemens IMA and TWIX data files.read_siemens_txt_hdr
Reader for csv fit results generated by TARQUIN.read_tqn_fit
Reader for csv results generated by TARQUIN.read_tqn_result
Reconstruct complex time-domain data from the real part of frequency-domain data.recon_imag
Reconstruct complex time-domain data from the real part of frequency-domain data.recon_imag_vec
Reconstruct 2D MRSI data from a twix file loaded with read_mrs.recon_twix_2d_mrsi
Create a rectangular mask stored as a matrix of logical values.rectangular_mask
Repeat an array over a given dimension.rep_array_dim
Replicate a scan in the dynamic dimension.rep_dyn
Replicate a scan over a given dimension.rep_mrs
Resample a basis-set to match a mrs_data acquisition.resample_basis
Resample an image to match a target image space.resample_img
Resample a VOI to match a target image space using nearest-neighbour interpolation.resample_voi
Reslice a nifti object to match the orientation of mrs data.reslice_to_mrs
Generate mrs_data from a table of single Lorentzian resonances.reson_table2mrs_data
Remove a subset of dynamic scans.rm_dyns
Apply water reference scaling to a fitting results object to yield metabolite quantities in millimolar (mM) units (mol / kg of tissue water).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).scale_amp_molal_pvc
Apply water reference scaling to a fitting results object to yield metabolite quantities in millimolar (mM) units (mol / Litre of tissue).scale_amp_molar
Convert default LCM/TARQUIN concentration scaling to molal units with partial volume correction.scale_amp_molar2molal_pvc
Scale fitted amplitudes to a ratio of signal amplitude.scale_amp_ratio
Scale fitted amplitudes to a ratio of signal amplitude.scale_amp_ratio_value
Scale metabolite amplitudes as a ratio to the unsuppressed water amplitude.scale_amp_water_ratio
Scale a basis object by a scalar.scale_basis_amp
Scale a basis-set to be consistent with spant assumptions for water scaling.scale_basis_from_singlet
Scale an mrs_data object by a scalar or vector or amplitudes.scale_mrs_amp
Scale mrs_data to a spectral region.scale_spec
Calculate the standard deviation spectrum from an mrs_data object.sd
Calculate the standard deviation spectrum from an mrs_data object.sd.mrs_data
Return a time scale vector to match the FID of an MRS data object.seconds
CPMG style sequence with ideal pulses.seq_cpmg_ideal
MEGA-PRESS sequence with ideal localisation pulses and Gaussian shaped editing pulse.seq_mega_press_ideal
PRESS sequence with shaped refocusing pulses.seq_press_2d_shaped
PRESS sequence with ideal pulses.seq_press_ideal
Simple pulse and acquire sequence with ideal pulses.seq_pulse_acquire
sLASER sequence with ideal pulses.seq_slaser_ideal
Spin echo sequence with ideal pulses.seq_spin_echo_ideal
STEAM sequence with ideal pulses.seq_steam_ideal
STEAM sequence with ideal pulses and coherence order filtering to simulate gradient crushers.seq_steam_ideal_cof
STEAM sequence with ideal pulses using the z-rotation gradient simulation method described by Young et al JMR 140, 146-152 (1999).seq_steam_ideal_young
Set the default acquisition parameters.set_def_acq_paras
Set the command to run the LCModel command-line program.set_lcm_cmd
Apply line-broadening to an mrs_data object to achieve a specified linewidth.set_lw
Set the masked voxels in a 2D MRSI dataset to given spectrum.set_mask_xy_mat
Set the number of transients for an mrs_data object.set_Ntrans
Set the precompute mode.set_precomp_mode
Set the verbosity of the precompute function.set_precomp_verbose
Set the ppm reference value (eg ppm value at 0Hz).set_ref
Set the number of time-domain data points, truncating or zero-filling as appropriate.set_td_pts
Set the command to run the TARQUIN command-line program.set_tqn_cmd
Set the repetition time of an MRS dataset.set_tr
Apply a frequency shift to MRS data.shift
Apply frequency shifts to basis set signals.shift_basis
Simulate a basis set object.sim_basis
Simulate a basis-set suitable for 1H brain MRS analysis acquired with a PRESS sequence. Note, ideal pulses are assumed.sim_basis_1h_brain
Simulate a basis-set suitable for 1H brain MRS analysis acquired with a PRESS sequence. Note, ideal pulses are assumed.sim_basis_1h_brain_press
Simulate a macromolecular and lipid basis-set suitable for 1H brain MRS analysis.sim_basis_mm_lip_lcm
Simulate a basis file using TARQUIN.sim_basis_tqn
Simulate MRS data with a similar appearance to normal brain (by default).sim_brain_1h
Simulate a 'mol_parameter' object.sim_mol
Simulate an mrs_data object containing simulated Gaussian noise.sim_noise
Simulate a MRS data object containing a set of simulated resonances.sim_resonances
Simulate an ideal pulse excitation profile by smoothing a top-hat function with a Gaussian.sim_th_excit_profile
Simulate an mrs_data object containing complex zero valued samples.sim_zero
Smooth data across the dynamic dimension with a Gaussian kernel.smooth_dyns
Sort the basis-set elements alphabetically.sort_basis
Simulate and fit some spectra with ABfit for benchmarking purposes. Basic timing and performance metrics will be printed.spant_abfit_benchmark
Example MEGA-PRESS data with significant B0 drift.spant_mpress_drift
Simulate an example fMRS dataset for a block design fMRS experiment and export a BIDS structure.spant_sim_fmrs_dataset
Simulate a typical metabolite basis set for benchmarking. Timing metrics will be printed on completion.spant_simulation_benchmark
Decompose an mrs_data object into white and gray matter spectra.spec_decomp
Perform a mathematical operation on a spectral region.spec_op
Create a spin system object for pulse sequence simulation.spin_sys
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.spm_pve2categorical
Signal space projection method for lipid suppression.ssp
Produce a plot with multiple traces.stackplot
Plot the fitting results of an object of class 'fit_result' with individual basis set components shown.stackplot.fit_result
Stackplot plotting method for objects of class mrs_data.stackplot.mrs_data
Subtract the first dynamic spectrum from a dynamic series.sub_first_dyn
Subtract the mean dynamic spectrum from a dynamic series.sub_mean_dyns
Subtract the median dynamic spectrum from a dynamic series.sub_median_dyns
Calculate the sum across receiver coil elements.sum_coils
Calculate the sum of data dynamics.sum_dyns
Sum two mrs_data objects.sum_mrs
Return the sum of a list of mrs_data objects.sum_mrs_list
Standard SVS 1H brain analysis pipeline.svs_1h_brain_analysis
Standard SVS 1H brain analysis pipeline.svs_1h_brain_analysis_dev
Batch interface to the standard SVS 1H brain analysis pipeline.svs_1h_brain_batch_analysis
Perform a t-test on spectral data points.t_test_spec
Time-domain convolution based filter.td_conv_filt
Transform time-domain data to the frequency-domain.td2fd
Time-domain spectral registration.tdsr
Return the echo time of an MRS dataset.te
Return the repetition time of an MRS dataset.tr
Return a list of options for VARPRO based fitting with 3 free parameters.varpro_3_para_opts
Return a list of options for a basic VARPRO analysis.varpro_basic_opts
Return a list of options for VARPRO based fitting.varpro_opts
Convert a vector into a mrs_data object.vec2mrs_data
Write a basis object to an LCModel .basis formatted file.write_basis
Generate a basis file using TARQUIN.write_basis_tqn
Write MRS data object to file.write_mrs
Write MRS data object to file in NIFTI format.write_mrs_nifti
Write an ASCII formatted pulse file.write_pulse_ascii
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.zero_fade_spec
Zero all coherences including and above a given order.zero_higher_orders
Set 'mrs_data' object data points at the end of the FID to zero.zero_td_pts_end
Zero-fill MRS data in the time domain.zf zf.basis_set zf.list zf.mrs_data
Zero-fill MRSI data in the k-space x-y direction.zf_xy