knitr::opts_chunk$set(fig.width = 5, fig.height = 4, echo = TRUE)
library(spant)

Reading raw data and plotting

library(spant)
fname <- system.file("extdata", "philips_spar_sdat_WS.SDAT", package = "spant")

# import raw data
mrs_data <- read_mrs(fname, format = "spar_sdat")

# output basic data structure
print(mrs_data)

# plot data in the frequency domain
plot(mrs_data, xlim = c(5, 0.5))

Basic preprocessing

# apply water filter and align to tNAA resonance
mrs_proc <- hsvd_filt(mrs_data)
mrs_proc <- align(mrs_proc, 2.01)
plot(mrs_proc, xlim = c(5, 0.5))

Basis simulation

# simulate a typical basis set for short TE brain analysis
basis <- sim_basis_1h_brain_press(mrs_proc)

# output basis info
print(basis)

# plot basis signals
stackplot(basis, xlim = c(4, 0.5))

Fitting

# perform VARPRO fitting to processed data
fit_res <- fit_mrs(mrs_proc, basis)

# plot the fit estimate, residual and baseline
plot(fit_res, xlim = c(4, 0.5))


neuroconductor-devel-releases/spant documentation built on Feb. 14, 2020, 1:34 p.m.