Load the spant package:
Get the path to a data file included with spant:
Read the file and save to the workspace as mrs_data
:
Output some basic information about the data:
print(mrs_data)
#> MRS Data Parameters
#> ----------------------------------
#> Trans. freq (MHz) : 127.7861
#> FID data points : 1024
#> X,Y,Z dimensions : 1x1x1
#> Dynamics : 1
#> Coils : 1
#> Voxel resolution (mm) : 20x20x20
#> Sampling frequency (Hz) : 2000
#> Reference freq. (ppm) : 4.65
#> Spectral domain : FALSE
Plot the spectral region between 5 and 0.5 ppm:
Apply a HSVD filter to the residual water region and align the spectrum to the tNAA resonance at 2.01 ppm:
Simulate a typical basis set for short TE brain analysis, print some basic information and plot:
basis <- sim_basis_1h_brain_press(mrs_proc)
print(basis)
#> Basis set parameters
#> -------------------------------
#> Trans. freq (MHz) : 127.786142
#> Data points : 1024
#> Sampling frequency (Hz) : 2000
#> Elements : 27
#>
#> Names
#> -------------------------------
#> -CrCH2,Ala,Asp,Cr,GABA,Glc,Gln,
#> GSH,Glu,GPC,Ins,Lac,Lip09,
#> Lip13a,Lip13b,Lip20,MM09,MM12,
#> MM14,MM17,MM20,NAA,NAAG,PCh,
#> PCr,sIns,Tau
stackplot(basis, xlim = c(4, 0.5), labels = basis$names, y_offset = 5)
Perform ABfit analysis of the processed data (mrs_proc
):
Plot the fit result:
Extract the estimated amplitudes from fit_res
and print as a ratio to total-creatine in column format:
amps <- fit_amps(fit_res)
print(t(amps / amps$TCr))
#>
#> X.CrCH2
#> Ala
#> Asp
#> Cr
#> GABA
#> Glc
#> Gln
#> GSH
#> Glu
#> GPC
#> Ins
#> Lac
#> Lip09
#> Lip13a
#> Lip13b
#> Lip20
#> MM09
#> MM12
#> MM14
#> MM17
#> MM20
#> NAA
#> NAAG
#> PCh
#> PCr
#> sIns
#> Tau
#> tNAA
#> tCr
#> tCho
#> Glx
#> tLM09
#> tLM13
#> tLM20