diff --git a/docs/404.html b/docs/404.html index 51dc3ca7..efcfa260 100644 --- a/docs/404.html +++ b/docs/404.html @@ -12,7 +12,7 @@ - + @@ -39,7 +39,7 @@
@@ -122,7 +122,7 @@Site built with pkgdown 2.0.7.
+Site built with pkgdown 2.0.9.
diff --git a/docs/LICENSE-text.html b/docs/LICENSE-text.html index edfbd9db..c024836a 100644 --- a/docs/LICENSE-text.html +++ b/docs/LICENSE-text.html @@ -1,5 +1,5 @@ -Site built with pkgdown 2.0.7.
+Site built with pkgdown 2.0.9.
diff --git a/docs/articles/abfit-baseline-opts_files/figure-html/abfit_aic-1.png b/docs/articles/abfit-baseline-opts_files/figure-html/abfit_aic-1.png index 65a9b03f..7b354e92 100644 Binary files a/docs/articles/abfit-baseline-opts_files/figure-html/abfit_aic-1.png and b/docs/articles/abfit-baseline-opts_files/figure-html/abfit_aic-1.png differ diff --git a/docs/articles/abfit-baseline-opts_files/figure-html/abfit_bspline-1.png b/docs/articles/abfit-baseline-opts_files/figure-html/abfit_bspline-1.png index 859b59a1..0da03150 100644 Binary files a/docs/articles/abfit-baseline-opts_files/figure-html/abfit_bspline-1.png and b/docs/articles/abfit-baseline-opts_files/figure-html/abfit_bspline-1.png differ diff --git a/docs/articles/abfit-baseline-opts_files/figure-html/abfit_bspline_more-1.png b/docs/articles/abfit-baseline-opts_files/figure-html/abfit_bspline_more-1.png index d0f1d32d..b37e6a33 100644 Binary files a/docs/articles/abfit-baseline-opts_files/figure-html/abfit_bspline_more-1.png and b/docs/articles/abfit-baseline-opts_files/figure-html/abfit_bspline_more-1.png differ diff --git a/docs/articles/abfit-baseline-opts_files/figure-html/abfit_default-1.png b/docs/articles/abfit-baseline-opts_files/figure-html/abfit_default-1.png index 2b541c90..29b01e04 100644 Binary files a/docs/articles/abfit-baseline-opts_files/figure-html/abfit_default-1.png and b/docs/articles/abfit-baseline-opts_files/figure-html/abfit_default-1.png differ diff --git a/docs/articles/abfit-baseline-opts_files/figure-html/abfit_flex-1.png b/docs/articles/abfit-baseline-opts_files/figure-html/abfit_flex-1.png index 34d6d677..794df7ae 100644 Binary files a/docs/articles/abfit-baseline-opts_files/figure-html/abfit_flex-1.png and b/docs/articles/abfit-baseline-opts_files/figure-html/abfit_flex-1.png differ diff --git a/docs/articles/abfit-baseline-opts_files/figure-html/abfit_stiff-1.png b/docs/articles/abfit-baseline-opts_files/figure-html/abfit_stiff-1.png index d3727620..1a1b9bb3 100644 Binary files a/docs/articles/abfit-baseline-opts_files/figure-html/abfit_stiff-1.png and b/docs/articles/abfit-baseline-opts_files/figure-html/abfit_stiff-1.png differ diff --git a/docs/articles/index.html b/docs/articles/index.html index 10698206..cbcb747e 100644 --- a/docs/articles/index.html +++ b/docs/articles/index.html @@ -1,5 +1,5 @@ -Site built with pkgdown 2.0.7.
+Site built with pkgdown 2.0.9.
diff --git a/docs/articles/spant-intro.html b/docs/articles/spant-intro.html index aa3da6d1..f91bcb30 100644 --- a/docs/articles/spant-intro.html +++ b/docs/articles/spant-intro.html @@ -12,7 +12,7 @@ - + @@ -40,7 +40,7 @@ @@ -178,78 +178,79 @@Perform ABfit analysis of the processed data
(mrs_proc
):
+fit_res <- fit_mrs(mrs_proc, basis)
Plot the fit result:
-+plot(fit_res)
Unscaled amplitudes, CRLB error estimates and other useful fitting diagnostics, such as SNR, are given in the
-fit_res
results table:++#> 1 -8.418839 -8.418312fit_res$res_tab -#> X Y Z Dynamic Coil X.CrCH2 Ala Asp Cr -#> 1 1 1 1 1 1 0 8.228912e-06 3.548337e-05 4.020305e-05 -#> GABA Glc Gln GSH Glu GPC -#> 1 1.706754e-05 2.442067e-06 3.029726e-06 2.227786e-05 6.499645e-05 1.603288e-05 -#> Ins Lac Lip09 Lip13a Lip13b Lip20 MM09 -#> 1 5.902957e-05 5.818739e-06 2.362972e-05 2.635502e-06 0 0 9.887557e-06 -#> MM12 MM14 MM17 MM20 NAA NAAG -#> 1 6.546986e-06 2.59994e-05 2.245507e-05 9.207418e-05 5.981787e-05 1.556188e-05 -#> PCh PCr sIns Tau tNAA tCr tCho -#> 1 0 2.101297e-05 6.508636e-06 0 7.537975e-05 6.121601e-05 1.603288e-05 -#> Glx tLM09 tLM13 tLM20 X.CrCH2.sd Ala.sd -#> 1 6.802617e-05 3.351728e-05 3.518189e-05 9.207418e-05 2.383751e-06 4.353306e-06 +#> X Y Z Dynamic Coil X.CrCH2 Ala Asp Cr GABA +#> 1 1 1 1 1 1 0 8.133932e-06 3.547065e-05 4.02672e-05 1.697281e-05 +#> Glc Gln GSH Glu GPC Ins +#> 1 2.446596e-06 3.036132e-06 2.228048e-05 6.503217e-05 1.606706e-05 5.906155e-05 +#> Lac Lip09 Lip13a Lip13b Lip20 MM09 MM12 +#> 1 5.802284e-06 2.387704e-05 2.670653e-06 0 0 9.630788e-06 6.511381e-06 +#> MM14 MM17 MM20 NAA NAAG PCh +#> 1 2.603855e-05 2.238405e-05 9.203743e-05 6.011109e-05 1.536531e-05 0 +#> PCr sIns Tau tNAA tCr tCho +#> 1 2.101921e-05 6.504098e-06 0 7.54764e-05 6.12864e-05 1.606706e-05 +#> Glx tLM09 tLM13 tLM20 X.CrCH2.sd Ala.sd +#> 1 6.80683e-05 3.350783e-05 3.522059e-05 9.203743e-05 2.386861e-06 4.343919e-06 #> Asp.sd Cr.sd GABA.sd Glc.sd Gln.sd GSH.sd -#> 1 9.243626e-06 3.715175e-06 4.580082e-06 4.427045e-06 5.089143e-06 2.022836e-06 +#> 1 9.235326e-06 3.689004e-06 4.574407e-06 4.421681e-06 5.083001e-06 2.020426e-06 #> Glu.sd GPC.sd Ins.sd Lac.sd Lip09.sd Lip13a.sd -#> 1 5.086888e-06 2.525936e-06 2.091039e-06 5.311855e-06 4.118786e-06 1.328562e-05 +#> 1 5.082976e-06 2.602651e-06 2.093225e-06 5.301703e-06 4.119256e-06 1.328305e-05 #> Lip13b.sd Lip20.sd MM09.sd MM12.sd MM14.sd MM17.sd -#> 1 6.477225e-06 7.510915e-06 3.827221e-06 4.597884e-06 7.234429e-06 3.810268e-06 +#> 1 6.474481e-06 7.510908e-06 3.827554e-06 4.594019e-06 7.223367e-06 3.811301e-06 #> MM20.sd NAA.sd NAAG.sd PCh.sd PCr.sd sIns.sd -#> 1 8.602464e-06 1.015226e-06 1.215672e-06 2.174697e-06 3.108036e-06 7.233855e-07 -#> Tau.sd tNAA.sd tCr.sd tCho.sd Glx.sd tLM09.sd -#> 1 3.777984e-06 7.031059e-07 5.881706e-07 2.1135e-07 3.165045e-06 1.006532e-06 -#> tLM13.sd tLM20.sd phase lw shift asym -#> 1 1.572003e-06 3.018189e-06 11.15087 5.038937 -0.003427612 0.1764497 +#> 1 8.595853e-06 1.017712e-06 1.208985e-06 2.236873e-06 3.084598e-06 7.240068e-07 +#> Tau.sd tNAA.sd tCr.sd tCho.sd Glx.sd tLM09.sd +#> 1 3.759956e-06 7.031383e-07 5.890481e-07 2.110662e-07 3.16966e-06 1.006794e-06 +#> tLM13.sd tLM20.sd phase lw shift asym +#> 1 1.573147e-06 3.016809e-06 11.10963 5.023681 -0.00376505 0.1771067 #> res.deviance res.niter res.info -#> 1 7.300317e-05 28 2 +#> 1 7.307669e-05 28 2 #> res.message bl_ed_pppm #> 1 Relative error between `par' and the solution is at most `ptol'. 2.364083 -#> max_bl_flex_used full_res fit_pts ppm_range SNR SRR FQN -#> 1 FALSE 7.745303e-05 497 3.8 62.79191 51.44068 1.490027 +#> max_bl_flex_used full_res fit_pts ppm_range SNR SRR FQN +#> 1 FALSE 7.754368e-05 497 3.8 62.71687 51.3328 1.492722 #> tNAA_lw tCr_lw tCho_lw auto_bl_crit_7 auto_bl_crit_5.901 -#> 1 0.04565271 0.05199592 0.05438808 -8.904402 -8.947808 +#> 1 0.04562445 0.05189506 0.05438237 -8.900349 -8.944159 #> auto_bl_crit_4.942 auto_bl_crit_4.12 auto_bl_crit_3.425 auto_bl_crit_2.844 -#> 1 -8.980941 -9.003463 -9.016574 -9.023969 +#> 1 -8.977355 -9.000064 -9.013367 -9.02055 #> auto_bl_crit_2.364 auto_bl_crit_1.969 auto_bl_crit_1.647 auto_bl_crit_1.384 -#> 1 -9.027876 -9.027566 -9.014311 -8.963287 +#> 1 -9.024177 -9.023462 -9.009854 -8.958654 #> auto_bl_crit_1.17 auto_bl_crit_0.997 auto_bl_crit_0.856 auto_bl_crit_0.743 -#> 1 -8.848747 -8.694785 -8.565992 -8.488415 +#> 1 -8.844271 -8.690744 -8.562631 -8.485471 #> auto_bl_crit_0.654 auto_bl_crit_0.593 auto_bl_crit_0.558 auto_bl_crit_0.54 -#> 1 -8.449874 -8.432813 -8.425648 -8.42266 +#> 1 -8.447136 -8.430174 -8.423053 -8.420086 #> auto_bl_crit_0.532 auto_bl_crit_0.529 -#> 1 -8.421406 -8.420875
Note that signal names appended with “.sd” are the CRLB estimates for the uncertainty (standard deviation) in the metabolite quantity estimate. e.g. to calculate the percentage s.d. for tNAA:
-++#> [1] 0.9316001fit_res$res_tab$tNAA.sd / fit_res$res_tab$tNAA * 100 -#> [1] 0.9327517
Spectral SNR:
-++#> [1] 62.71687fit_res$res_tab$SNR -#> [1] 62.79191
Linewidth of the tNAA resonance in PPM:
-++#> [1] 0.04562445fit_res$res_tab$tNAA_lw -#> [1] 0.04565271
Ratios to total-creatine @@ -258,45 +259,45 @@
Ratios to total-creatine -
++#> tCho 0.26216356 +#> Glx 1.11065912 +#> tLM09 0.54674163 +#> tLM13 0.57468844 +#> tLM20 1.50175937fit_res_tcr_sc <- scale_amp_ratio(fit_res, "tCr") amps <- fit_amps(fit_res_tcr_sc) print(t(amps)) #> [,1] #> X.CrCH2 0.00000000 -#> Ala 0.13442417 -#> Asp 0.57964197 -#> Cr 0.65674069 -#> GABA 0.27880838 -#> Glc 0.03989262 -#> Gln 0.04949238 -#> GSH 0.36392207 -#> Glu 1.06175561 -#> GPC 0.26190670 -#> Ins 0.96428305 -#> Lac 0.09505257 -#> Lip09 0.38600560 -#> Lip13a 0.04305248 +#> Ala 0.13272001 +#> Asp 0.57876874 +#> Cr 0.65703313 +#> GABA 0.27694252 +#> Glc 0.03992071 +#> Gln 0.04954005 +#> GSH 0.36354683 +#> Glu 1.06111906 +#> GPC 0.26216356 +#> Ins 0.96369746 +#> Lac 0.09467490 +#> Lip09 0.38959768 +#> Lip13a 0.04357660 #> Lip13b 0.00000000 #> Lip20 0.00000000 -#> MM09 0.16151913 -#> MM12 0.10694891 -#> MM14 0.42471563 -#> MM17 0.36681686 -#> MM20 1.50408643 -#> NAA 0.97716047 -#> NAAG 0.25421252 +#> MM09 0.15714395 +#> MM12 0.10624512 +#> MM14 0.42486672 +#> MM17 0.36523688 +#> MM20 1.50175937 +#> NAA 0.98082268 +#> NAAG 0.25071313 #> PCh 0.00000000 -#> PCr 0.34325931 -#> sIns 0.10632244 +#> PCr 0.34296687 +#> sIns 0.10612627 #> Tau 0.00000000 -#> tNAA 1.23137299 +#> tNAA 1.23153582 #> tCr 1.00000000 -#> tCho 0.26190670 -#> Glx 1.11124799 -#> tLM09 0.54752473 -#> tLM13 0.57471702 -#> tLM20 1.50408643
+#> 1 1H 2.5Water reference scaling, AKA “absolute-quantification” @@ -304,29 +305,29 @@
Water reference sca
A more sophisticated approach to scaling metabolite values involves the use of a separate water-reference acquisition - which can be imported in the standard way:
-@@ -279,8 +279,9 @@+fname_wref <- system.file("extdata", "philips_spar_sdat_W.SDAT", package = "spant") mrs_data_wref <- read_mrs(fname_wref)
The following code assumes the voxel contains 100% white matter tissue and scales the metabolite values into molal (mM) units (mol / kg tissue water) based on the method described by Gasparovic et al MRM 2006 55(6):1219-26:
-++#> [1] 12.59789p_vols <- c(WM = 100, GM = 0, CSF = 0) TE = 0.03 TR = 2 fit_res_molal <- scale_amp_molal_pvc(fit_res, mrs_data_wref, p_vols, TE, TR) fit_res_molal$res_tab$tNAA -#> [1] 12.58176
An alternative method scales the metabolite values into molar (mM) units (mol / Litre of tissue) based on assumptions outlined in the LCModel manual and references therein (section 10.2). This approach may be preferred when comparing results to those obtained LCModel or TARQUIN.
-++#> [1] 6.826336fit_res_molar <- scale_amp_molar(fit_res, mrs_data_wref) fit_res_molar$res_tab$tNAA -#> [1] 6.817594
Note, while “absolute” units are attractive, a large number of assumptions about metabolite and water relaxation rates are necessary to arrive at these mM estimates. If you’re not confident at being able to @@ -354,7 +355,7 @@
Water reference sca diff --git a/docs/articles/spant-intro_files/figure-html/unnamed-chunk-10-1.png b/docs/articles/spant-intro_files/figure-html/unnamed-chunk-10-1.png index b84cd2d5..a8160510 100644 Binary files a/docs/articles/spant-intro_files/figure-html/unnamed-chunk-10-1.png and b/docs/articles/spant-intro_files/figure-html/unnamed-chunk-10-1.png differ diff --git a/docs/articles/spant-intro_files/figure-html/unnamed-chunk-7-1.png b/docs/articles/spant-intro_files/figure-html/unnamed-chunk-7-1.png index 15bdc4e5..94a3f545 100644 Binary files a/docs/articles/spant-intro_files/figure-html/unnamed-chunk-7-1.png and b/docs/articles/spant-intro_files/figure-html/unnamed-chunk-7-1.png differ diff --git a/docs/articles/spant-metabolite-simulation.html b/docs/articles/spant-metabolite-simulation.html index e6efca00..564fa989 100644 --- a/docs/articles/spant-metabolite-simulation.html +++ b/docs/articles/spant-metabolite-simulation.html @@ -12,7 +12,7 @@ - + @@ -40,7 +40,7 @@
Custom molecules#> L/G lineshape : 0 #> #> nucleus chem_shift -#> 1 1H 2.5 -custom_mol |> sim_mol() |> lb(2) |> zf() |> plot(xlim = c(4.4, 0.5))
Once your happy the new molecule is correct, please consider contributing it to the package if you think others would benefit.
@@ -304,7 +305,7 @@Site built with pkgdown 2.0.7.
+Site built with pkgdown 2.0.9.
diff --git a/docs/articles/spant-preprocessing.html b/docs/articles/spant-preprocessing.html index 28e38762..9544cf71 100644 --- a/docs/articles/spant-preprocessing.html +++ b/docs/articles/spant-preprocessing.html @@ -12,7 +12,7 @@ - + @@ -40,7 +40,7 @@ @@ -179,7 +179,7 @@Site built with pkgdown 2.0.7.
+Site built with pkgdown 2.0.9.
diff --git a/docs/articles/spant-preprocessing_files/figure-html/unnamed-chunk-10-1.png b/docs/articles/spant-preprocessing_files/figure-html/unnamed-chunk-10-1.png index 02bdd7ca..d9d919b3 100644 Binary files a/docs/articles/spant-preprocessing_files/figure-html/unnamed-chunk-10-1.png and b/docs/articles/spant-preprocessing_files/figure-html/unnamed-chunk-10-1.png differ diff --git a/docs/articles/spant-preprocessing_files/figure-html/unnamed-chunk-8-1.png b/docs/articles/spant-preprocessing_files/figure-html/unnamed-chunk-8-1.png index f8a9f999..9cc14061 100644 Binary files a/docs/articles/spant-preprocessing_files/figure-html/unnamed-chunk-8-1.png and b/docs/articles/spant-preprocessing_files/figure-html/unnamed-chunk-8-1.png differ diff --git a/docs/authors.html b/docs/authors.html index fd4064a4..34e6b241 100644 --- a/docs/authors.html +++ b/docs/authors.html @@ -1,5 +1,5 @@ -offset in number of data points from the end of the FID to +zero-fill. Default is NULL and will automatically set this to 50 points when +the FID distortion flag is set for the mrs_data.
add_noise_spec_snr(mrs_data, target_snr, sig_region = c(4, 0.5))
add_noise_spec_snr(
+ mrs_data,
+ target_snr,
+ sig_region = c(4, 0.5),
+ ref_data = NULL
+)
spectral limits to search for the strongest spectral data point.
measure the signal from the first scan in this reference data +and apply the same target noise level to mrs_data.
must be "hamming" or "gaussian".
must be "hamming", "hanning" or "gaussian".
R/mrs_data_proc.R
+ comb_coils_mrsi_gls.Rd
Combine MRSI coil data using the GLS method presented by An et al +JMRI 37:1445-1450 (2013).
+comb_coils_mrsi_gls(metab, noise_pts = 30, noise_mrs = NULL)
MRSI data containing metabolite data.
number of points from the end of the FIDs to use for noise +covariance estimation.
MRS data containing noise information for each coil.
coil combined MRSI data.
+R/mrs_data_proc.R
+ comb_coils_svs_gls.Rd
Combine SVS coil data using the GLS method presented by An et al +JMRI 37:1445-1450 (2013).
+comb_coils_svs_gls(
+ metab,
+ ref = NULL,
+ noise_pts = 256,
+ noise_mrs = NULL,
+ use_mean_sens = TRUE
+)
MRS data containing metabolite data.
MRS data containing reference data (optional).
number of points from the end of the FIDs to use for noise +covariance estimation.
MRS data containing noise information for each coil.
use the dynamic mean to estimate coil sensitivities.
coil combined MRS data.
+find_bids_mrs(path)
find_bids_mrs(path, output_full_path = FALSE)
path to the directory containing the BIDS structure.
output the full normalised data paths.
gen_baseline_reg(mrs_data)
gen_baseline_reg(mrs_data = NULL, tr = NULL, Ndyns = NULL, Ntrans = NULL)
mrs_data object for timing information.
repetition time.
number of dynamic scans stored, potentially less than Ntrans +if block averaging has been performed.
number of dynamic scans acquired.
mrs_data object for timing information.
repetition time.
number of dynamic scans stored, potentially less than Ntrans +if block averaging has been performed.
number of dynamic scans acquired.
match the output to the input mrs_data.
Expand a regressor matrix for a group analysis.
+gen_group_reg(regressor_df, n)
input regressor data frame.
number of datasets n the group.
gen_impulse_reg(onset, trial_type = NULL, mrs_data = NULL)
gen_impulse_reg(
+ onset,
+ trial_type = NULL,
+ mrs_data = NULL,
+ tr = NULL,
+ Ndyns = NULL,
+ Ntrans = NULL
+)
mrs_data object for timing information.
repetition time.
number of dynamic scans stored, potentially less than Ntrans +if block averaging has been performed.
number of dynamic scans acquired.
gen_poly_reg(mrs_data, degree)
gen_poly_reg(degree, mrs_data = NULL, tr = NULL, Ndyns = NULL, Ntrans = NULL)
the degree of the polynomial.
mrs_data object for timing information.
the degree of the polynomial.
repetition time.
number of dynamic scans stored, potentially less than Ntrans +if block averaging has been performed.
number of dynamic scans acquired.
mrs_data object for timing information.
repetition time.
number of dynamic scans stored, potentially less than Ntrans +if block averaging has been performed.
number of dynamic scans acquired.
time to reach a plateau from baseline in seconds.
glm_spec(mrs_data, regressor_df)
glm_spec(mrs_data, regressor_df, full_output = FALSE)
a data frame containing temporal regressors to be applied to each spectral datapoint.
append mrs_data and regressor_df to the output list.
R/fmrs.R
+ glm_spec_fmrs_fl.Rd
Perform first-level spectral GLM analysis of an fMRS dataset.
+a data frame containing temporal regressors to be applied +to each spectral datapoint.
directory containing preprocessed data generated by +the preproc_svs_dataset function.
vector of labels of scans to exclude, eg poor quality +data.
labels to describe each data set.
spectral range to include in the analysis.
vertical lines to add to the plot.
function will return key outputs, defaults to FALSE.
R/fmrs.R
+ glm_spec_fmrs_group.Rd
Perform group-level spectral GLM analysis of an fMRS dataset.
+glm_spec_fmrs_group(
+ regressor_df,
+ analysis_dir = "spant_analysis",
+ exclude_labels = NULL,
+ labels = NULL
+)
a data frame containing temporal regressors to be applied +to each spectral datapoint.
directory containing preprocessed data generated by +the preproc_svs_dataset function.
vector of labels of scans to exclude, eg poor quality +data.
labels to describe each data set.
R/fmrs.R
+ glm_spec_group_linhyp.Rd
Test a group-level spectral GLM linear hypothesis.
+glm_spec_group_linhyp(hmat, analysis_dir = "spant_analysis")
linear hypothesis matrix.
directory containing preprocessed data generated by +the preproc_svs_dataset function.
add a horizontal line at the specified value.
linetype for the horizontal line.
colour for the horizontal line.
draw a vertical line at the value of vline.
add a vertical line at the specified value.
draw a horizontal line at the value of hline.
linetype for the vertical line.
colour for the vertical line.
Complex rounding function taken from complexplus package to reduce the number -of spant dependencies.
Complex rounding function taken from complexplus package to reduce the number of spant dependencies.
Return a list of options for an ABfit analysis to maintain comparability with -analyses performed with version 1.9.0 (and earlier) of spant.
Return a list of options for an ABfit analysis to maintain comparability with analyses performed with version 1.9.0 (and earlier) of spant.
Append MRS data across the coil dimension, assumes they matched across the -other dimensions.
Append MRS data across the coil dimension, assumes they matched across the other dimensions.
Append MRS data across the dynamic dimension, assumes they matched across the -other dimensions.
Append MRS data across the dynamic dimension, assumes they matched across the other dimensions.
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.
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.
Perform zeroth-order phase correction based on the minimisation of the -squared difference between the real and magnitude components of the -spectrum.
Perform zeroth-order phase correction based on the minimisation of the squared difference between the real and magnitude components of the spectrum.
Convert a basis object to an mrs_data object - where basis signals are spread -across the dynamic dimension.
Convert a basis object to an mrs_data object - where basis signals are spread across the dynamic dimension.
Generate a spline basis, slightly adapted from : "Splines, knots, and -penalties", Eilers 2010.
Generate a spline basis, slightly adapted from : "Splines, knots, and penalties", Eilers 2010.
Covert a beta value in the time-domain to an equivalent linewidth in Hz: -x * exp(-i * t * t * beta).
Covert a beta value in the time-domain to an equivalent linewidth in Hz: x * exp(-i * t * t * beta).
Perform a polynomial fit, subtract and return the standard deviation of the -residuals.
Perform a polynomial fit, subtract and return the standard deviation of the residuals.
comb_coils()
Combine coil data based on the first data point of a reference signal.
Combine MRSI coil data using the GLS method presented by An et al JMRI 37:1445-1450 (2013).
Combine SVS coil data using the GLS method presented by An et al JMRI 37:1445-1450 (2013).
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 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.
Compute the vector cross product between vectors x and y. Adapted from -http://stackoverflow.com/questions/15162741/what-is-rs-crossproduct-function
Compute the vector cross product between vectors x and y. Adapted from http://stackoverflow.com/questions/15162741/what-is-rs-crossproduct-function
Decimate an MRS signal to half the original sampling frequency by filtering -in the frequency domain before down sampling.
Decimate an MRS signal to half the original sampling frequency by filtering in the frequency domain before down sampling.
Return (and optionally modify using the input arguments) a list of the -default acquisition parameters.
Return (and optionally modify using the input arguments) a list of the default acquisition parameters.
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 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.
Return a time scale vector of acquisition times for a dynamic MRS scan. The -first temporal scan is assigned a value of 0.
Return a time scale vector of acquisition times for a dynamic MRS scan. The first temporal scan is assigned a value of 0.
Estimate the standard deviation of the noise from a segment of an mrs_data -object.
Estimate the standard deviation of the noise from a segment of an mrs_data object.
Perform a zeroth order phase correction based on the phase of the first data -point in the time-domain.
Perform a zeroth order phase correction based on the phase of the first data point in the time-domain.
Perform a fft and fftshift on a matrix with each column replaced by its -shifted fft.
Perform a fft and fftshift on a matrix with each column replaced by its shifted fft.
Generate regressors by convolving a specified response function with a -stimulus.
Generate regressors by convolving a specified response function with a stimulus.
Expand a regressor matrix for a group analysis.
Return a character vector of common 1H molecules found in healthy human -brain.
Return a character vector of common 1H molecules found in healthy human brain.
Return a list of mol_parameter
objects suitable for 1H brain MRS
-analyses.
Return a list of mol_parameter
objects suitable for 1H brain MRS analyses.
Return a list of mol_parameter
objects suitable for 1H brain MRS
-analyses.
Return a list of mol_parameter
objects suitable for 1H brain MRS analyses.
Return a list of mol_parameter
objects suitable for 1H brain MRS
-analyses.
Return a list of mol_parameter
objects suitable for 1H brain MRS analyses.
Return a list of mol_parameter
objects suitable for 1H brain MRS
-analyses.
Return a list of mol_parameter
objects suitable for 1H brain MRS analyses.
Return a character vector of molecules included in the Gold Star Phantoms -SPECTRE phantom.
Return a character vector of molecules included in the Gold Star Phantoms SPECTRE phantom.
Return a character array of names that may be used with the
-get_mol_paras
function.
Return a character array of names that may be used with the get_mol_paras
function.
Return an array of amplitudes derived from fitting the initial points in the -time domain and extrapolating back to t=0.
Return an array of amplitudes derived from fitting the initial points in the time domain and extrapolating back to t=0.
Generate a mol_parameters
object for a simple spin system with one
-resonance.
Generate a mol_parameters
object for a simple spin system with one resonance.
glm_spec()
Perform a GLM analysis of dynamic MRS data in the spectral domain.
Perform first-level spectral GLM analysis of an fMRS dataset.
Perform group-level spectral GLM analysis of an fMRS dataset.
Test a group-level spectral GLM linear hypothesis.
Perform an ifft and ifftshift on a matrix with each column replaced by its -shifted ifft.
Perform an ifft and ifftshift on a matrix with each column replaced by its shifted ifft.
Check if the chemical shift dimension of an MRS data object is in the -frequency domain.
Check if the chemical shift dimension of an MRS data object is in the frequency domain.
Covert a linewidth in Hz to an equivalent alpha value in the time-domain ie: -x * exp(-t * alpha).
Covert a linewidth in Hz to an equivalent alpha value in the time-domain ie: x * exp(-t * alpha).
Covert a linewidth in Hz to an equivalent beta value in the time-domain ie: -x * exp(-t * t * beta).
Covert a linewidth in Hz to an equivalent beta value in the time-domain ie: x * exp(-t * t * beta).
Make a basis-set object from a directory containing LCModel formatted RAW -files.
Make a basis-set object from a directory containing LCModel formatted RAW files.
Mask the voxels outside an elliptical region spanning the MRSI dataset in the -x-y plane.
Mask the voxels outside an elliptical region spanning the MRSI dataset in the x-y plane.
Convert a matrix (with spectral points in the column dimension and dynamics -in the row dimensions) into a mrs_data object.
Convert a matrix (with spectral points in the column dimension and dynamics in the row dimensions) into a mrs_data object.
Matrix exponential function taken from complexplus package to reduce the -number of spant dependencies.
Matrix exponential function taken from complexplus package to reduce the number of spant dependencies.
Convert an mrs_data object to basis object - where basis signals are spread -across the dynamic dimension in the MRS data.
Convert an mrs_data object to basis object - where basis signals are spread across the dynamic dimension in the MRS data.
Create a BIDS file structure from a vector of MRS data paths or list of mrs_data objects.
Convert mrs_data object to a matrix, with spectral points in the column -dimension and dynamics in the row dimension.
Convert mrs_data object to a matrix, with spectral points in the column dimension and dynamics in the row dimension.
Convert mrs_data object to a vector.
Convert mrs_data object to a matrix, with spectral points in the column dimension and dynamics in the row dimension.
Create a BIDS directory and file structure from a list of mrs_data objects.
Convert mrs_data object to a vector.
Perform a fftshift on a matrix, with each column replaced by its shifted -result.
Perform a fftshift on a matrix, with each column replaced by its shifted result.
Perform an ifftshift on a matrix, with each column replaced by its shifted -result.
Perform an ifftshift on a matrix, with each column replaced by its shifted result.
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).
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).
Search for the highest peak in a spectral region and return the frequency, -height and FWHM.
Search for the highest peak in a spectral region and return the frequency, height and FWHM.
phase()
Apply phasing parameters to MRS data.
Corrected zero order phase and chemical shift offset in 1H MRS data from the brain.
Plot an interactive slice map from a data array where voxels can be selected -to display a corresponding spectrum.
Plot an interactive slice map from a data array where voxels can be selected to display a corresponding spectrum.
Save function results to file and load on subsequent calls to avoid repeat -computation.
Save function results to file and load on subsequent calls to avoid repeat computation.
Preprocess and perform quality assessment of a single SVS data set.
Preprocess and perform quality assessment of one or more SVS data sets.
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 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 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 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.
Reconstruct complex time-domain data from the real part of frequency-domain -data.
Reconstruct complex time-domain data from the real part of frequency-domain data.
Reconstruct complex time-domain data from the real part of frequency-domain -data.
Reconstruct complex time-domain data from the real part of frequency-domain data.
Resample a VOI to match a target image space using nearest-neighbour -interpolation.
Resample a VOI to match a target image space using nearest-neighbour interpolation.
Apply water reference scaling to a fitting results object to yield metabolite -quantities in millimolar (mM) units (mol / kg of tissue water).
Apply water reference scaling to a fitting results object to yield metabolite quantities in millimolar (mM) units (mol / kg of tissue water).
Apply water reference scaling to a fitting results object to yield metabolite -quantities in millimolar (mM) units (mol / kg of tissue water).
Apply water reference scaling to a fitting results object to yield metabolite quantities in millimolar (mM) units (mol / kg of tissue water).
Apply water reference scaling to a fitting results object to yield metabolite -quantities in millimolar (mM) units (mol / Litre of tissue).
Apply water reference scaling to a fitting results object to yield metabolite quantities in millimolar (mM) units (mol / Litre of tissue).
Convert default LCM/TARQUIN concentration scaling to molal units with partial -volume correction.
Convert default LCM/TARQUIN concentration scaling to molal units with partial volume correction.
MEGA-PRESS sequence with ideal localisation pulses and Gaussian shaped -editing pulse.
MEGA-PRESS sequence with ideal localisation pulses and Gaussian shaped editing pulse.
STEAM sequence with ideal pulses and coherence order filtering to simulate -gradient crushers.
STEAM sequence with ideal pulses and coherence order filtering to simulate gradient crushers.
STEAM sequence with ideal pulses using the z-rotation gradient simulation -method described by Young et al JMR 140, 146-152 (1999).
STEAM sequence with ideal pulses using the z-rotation gradient simulation method described by Young et al JMR 140, 146-152 (1999).
Set the number of time-domain data points, truncating or zero-filling as -appropriate.
Set the number of time-domain data points, truncating or zero-filling as appropriate.
Simulate a basis-set suitable for 1H brain MRS analysis acquired with a PRESS -sequence. Note, ideal pulses are assumed.
Simulate a basis-set suitable for 1H brain MRS analysis acquired with a PRESS sequence. Note, ideal pulses are assumed.
Simulate a basis-set suitable for 1H brain MRS analysis acquired with a PRESS -sequence. Note, ideal pulses are assumed.
Simulate a basis-set suitable for 1H brain MRS analysis acquired with a PRESS sequence. Note, ideal pulses are assumed.
Simulate a macromolecular and lipid basis-set suitable for 1H brain MRS -analysis.
Simulate a macromolecular and lipid basis-set suitable for 1H brain MRS analysis.
Simulate an ideal pulse excitation profile by smoothing a top-hat function -with a Gaussian.
Simulate an ideal pulse excitation profile by smoothing a top-hat function with a Gaussian.
Simulate and fit some spectra with ABfit for benchmarking purposes. Basic -timing and performance metrics will be printed.
Simulate and fit some spectra with ABfit for benchmarking purposes. Basic timing and performance metrics will be printed.
Example MEGA-PRESS data with significant B0 drift.
Simulate an example fMRS dataset for a block design fMRS experiment and export a BIDS structure.
Simulate a typical metabolite basis set for benchmarking. Timing metrics will -be printed on completion.
Simulate a typical metabolite basis set for benchmarking. Timing metrics will be printed on completion.
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.
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.
Plot the fitting results of an object of class fit_result
with
-individual basis set components shown.
Plot the fitting results of an object of class fit_result
with individual basis set components shown.
svs_1h_brain_batch_analysis()
Batch interface to the standard SVS 1H brain analysis pipeline.
Perform a t-test on spectral data points.
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.
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.
R/fmrs.R
+ mrs_data2bids.Rd
Create a BIDS file structure from a vector of MRS data paths or list of +mrs_data objects.
+mrs_data2bids(
+ mrs_data,
+ output_dir,
+ suffix = NULL,
+ sub = NULL,
+ ses = NULL,
+ task = NULL,
+ acq = NULL,
+ nuc = NULL,
+ voi = NULL,
+ rec = NULL,
+ run = NULL,
+ echo = NULL,
+ inv = NULL,
+ skip_existing = TRUE
+)
vector of MRS data paths or list of mrs_data objects.
the base directory to create the BIDS structure.
optional vector of file suffixes. Default behaviour is to +automatically determine these from the input data, however it is recommended +that they are specified to allow more efficient skipping of existing data.
optional vector of subject labels. If not specified, these will be +automatically generated as a series of increasing zero-padded integer values +corresponding to the mrs_data input indices.
optional vector of session labels.
optional vector of task labels.
optional vector of acquisition labels.
optional vector of nucleus labels.
optional vector of volume of interest labels.
optional vector of reconstruction labels.
optional vector of run indices.
optional vector of echo time indices.
optional vector of inversion indices.
skip any data files that have already been converted. +Defaults to TRUE, set to FALSE to force an overwrite of any existing data +files.
R/mrs_data_proc.R
+ mrs_data2spec_mat.Rd
Convert mrs_data object to a matrix, with spectral points in the column +dimension and dynamics in the row dimension.
+mrs_data2spec_mat(mrs_data, collapse = TRUE)
MRS data object or list of MRS data objects.
collapse all other dimensions along the dynamic dimension, eg +a 16x16 MRSI grid would be first collapsed across 256 dynamic scans.
MRS data matrix.
+R/rats.R
+ phase_ref_1h_brain.Rd
Corrected zero order phase and chemical shift offset in 1H MRS data from the +brain.
+phase_ref_1h_brain(mrs_data, mean_ref = FALSE, ret_corr_only = TRUE)
MRS data to be corrected.
apply the phase and offset of the mean spectrum to all +others. Default is FALSE.
return the corrected data only.
corrected MRS data.
+R/fmrs.R
+ preproc_svs.Rd
Preprocess and perform quality assessment of a single SVS data set.
+preproc_svs(path, label = NULL, output_dir = NULL, ref_inds = NULL)
path to the fMRS data file or IMA directory.
a label to describe the data set.
output directory.
a vector of 1-based indices for any water reference dynamic +scans.
R/fmrs.R
+ preproc_svs_dataset.Rd
Preprocess and perform quality assessment of one or more SVS data sets.
+preproc_svs_dataset(
+ paths,
+ labels = NULL,
+ output_dir = "spant_analysis",
+ exclude_labels = NULL,
+ overwrite = FALSE,
+ ref_inds = NULL,
+ return_results = FALSE
+)
paths to the fMRS data file or IMA directory.
labels to describe each data set.
output directory.
vector of labels of scans to exclude, eg poor quality +data.
overwrite saved results, defaults to FALSE.
a vector of 1-based indices for any water reference dynamic +scans.
function will return key outputs, defaults to FALSE.
an optional data frame to provide additional variables for use in subsequent analysis steps, eg id or grouping variables.
indicate if the data has a distorted FID due to a +brick-wall filter being used to downsample the data. Default is to auto +detect this from the data, but TRUE or FALSE options can be given to override +detection.
read_siemens_txt_hdr(input, version = "vd", verbose, offset = 0)
read_siemens_txt_hdr(input, version = "vd", verbose = FALSE, offset = 0)
R/amp_scaling.R
scale_amp_molal.Rd
R/amp_scaling.R
scale_amp_molal_pvc.Rd
reference value for ppm scale.
resonant nucleus.
number of dynamic scans to generate.
reference value for ppm scale.
resonant nucleus.
number of dynamic scans to generate.
An object of class mrs_data
of length 13.
An object of class mrs_data
of dimension 1 x 1 x 1 x 1 x 40 x 1 x 1024.
R/fmrs.R
+ spant_sim_fmrs_dataset.Rd
Simulate an example fMRS dataset for a block design fMRS experiment and +export a BIDS structure.
+spant_sim_fmrs_dataset(output_dir = NULL)
output directory for the BIDS data. Defaults to : +"HOME/sim_fmrs_dataset/data".
can be "sum" (default), "mean", "l2", "max", "min" or -"max-min".
can be "sum" (default), "mean", "l2", "max", "max_cplx, +"min" or "max-min".
Perform a t-test on spectral data points.
+t_test_spec(mrs_data, group)
an mrs_data object with spectra in the dynamic dimension.
vector describing the group membership of each dynamic spectrum.
a list of statistical results.
+vec2mrs_data(
vec,
- fs = def_fs(),
- ft = def_ft(),
- ref = def_ref(),
- nuc = def_nuc(),
+ mrs_data = NULL,
+ fs = NULL,
+ ft = NULL,
+ ref = NULL,
+ nuc = NULL,
dyns = 1,
fd = FALSE
)
the data vector.
example data to copy acquisition parameters from.
sampling frequency in Hz.
flag to indicate if the matrix is in the frequency domain (logical).
flag to indicate if the vector is in the frequency domain (logical).