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))
#> [,1]
#> X.CrCH2 0.00000000
#> Ala 0.15568250
#> Asp 0.54915337
#> Cr 0.66257177
#> GABA 0.28019056
#> Glc 0.06662722
#> Gln 0.07633755
#> GSH 0.35713892
#> Glu 1.10712407
#> GPC 0.26497630
#> Ins 0.99254985
#> Lac 0.09773717
#> Lip09 0.38151940
#> Lip13a 0.04570129
#> Lip13b 0.00000000
#> Lip20 0.00000000
#> MM09 0.17020239
#> MM12 0.11364802
#> MM14 0.44572073
#> MM17 0.42613263
#> MM20 1.54887468
#> NAA 0.97441523
#> NAAG 0.26926133
#> PCh 0.00000000
#> PCr 0.33742823
#> sIns 0.10905815
#> Tau 0.00000000
#> tNAA 1.24367657
#> tCr 1.00000000
#> tCho 0.26497630
#> Glx 1.18346161
#> tLM09 0.55172178
#> tLM13 0.60507004
#> tLM20 1.54887468