Type: Package
Title: Functional MRI Quality Assurance Routines
Version: 0.5.0
Date: 2026-02-20
Description: Methods for performing fMRI quality assurance (QA) measurements of test objects. Heavily based on the fBIRN procedures detailed by Friedman and Glover (2006) <doi:10.1002/jmri.20583>.
BugReports: https://github.com/martin3141/fmriqa/issues
License: GPL-3
RoxygenNote: 7.3.3
Imports: viridisLite, RNifti, ggplot2, reshape2, gridExtra, grid, tidyr, optparse, tcltk, RcppEigen, imager, pracma
Encoding: UTF-8
Suggests: testthat, covr, knitr, rmarkdown
VignetteBuilder: knitr
NeedsCompilation: no
Packaged: 2026-02-20 15:19:08 UTC; martin
Author: Martin Wilson [cre, aut]
Maintainer: Martin Wilson <martin.wilson111@gmail.com>
Repository: CRAN
Date/Publication: 2026-02-20 15:40:02 UTC

fmriqa: fMRI quality assurance routines

Description

The fmriqa package provides an implementation of the fMRI quality assurance analysis protocol detailed by Friedman and Glover (2006) <doi:10.1002/jmri.20583>.

Details

#' To learn more about fmriqa, start with the vignettes: 'browseVignettes(package = "fmriqa")'

For a full list of functions: 'help(package=fmriqa, help_type="html")'

Author(s)

Maintainer: Martin Wilson martin.wilson111@gmail.com

See Also

Useful links:


Combine fmriqa csv result files into a dataframe

Description

Combine fmriqa csv result files into a dataframe

Usage

combine_res_glob(pattern)

Arguments

pattern

glob pattern to match the csv result files (eg "*.csv")

Value

a dataframe of results


Run fMRI quality assurance procedure on a NIfTI data file

Description

Run fMRI quality assurance procedure on a NIfTI data file

Usage

run_fmriqa(
  data_file = NULL,
  roi_width = 21,
  slice_num = NULL,
  skip = 2,
  tr = NULL,
  pix_dim = NULL,
  poly_det_ord = 3,
  spike_detect = FALSE,
  x_pos = NULL,
  y_pos = NULL,
  plot_title = NULL,
  last_vol = NULL,
  gen_png = TRUE,
  gen_res_csv = TRUE,
  gen_pdf = FALSE,
  gen_spec_csv = FALSE,
  png_fname = NULL,
  res_fname = NULL,
  pdf_fname = NULL,
  spec_fname = NULL,
  verbose = TRUE,
  bg_smooth = 12,
  bg_shrink = 25,
  t1_canny = NULL,
  t2_canny = NULL
)

Arguments

data_file

input data in nifti format, a file chooser will open if not set

roi_width

roi analysis region in pixels (default=21)

slice_num

slice number for analysis (default=middle slice)

skip

number of initial volumes to exclude from the analysis (default=2)

tr

override the TR detected from data (seconds)

pix_dim

override the x,y,z pixel dimensions (mm) detected from data eg pixdim=c(3,3,3)

poly_det_ord

polynomial order used for detrending (default=3)

spike_detect

generate k-space spike-detection plot (default=FALSE)

x_pos

x position of ROI (default=center of gravity)

y_pos

y position of ROI (default=center of gravity)

plot_title

add a title to the png and pdf plots

last_vol

last volume number to use in the analysis

gen_png

output png plot (default=TRUE)

gen_res_csv

output csv results (default=TRUE)

gen_pdf

output pdf plot (default=FALSE)

gen_spec_csv

output csv of spectral points (default=FALSE)

png_fname

png plot filename

res_fname

csv results filename

pdf_fname

pdf plot filename

spec_fname

csv spectral data filename

verbose

provide text output while running (default=TRUE)

bg_smooth

amount to smooth background image before calculating the maximum BG percent metric (default=12mm)

bg_shrink

amount to shrink the BG image away from the object to avoid residual object signal in the maximum BG percent metric (default=25mm)

t1_canny

threshold for weak edges for Canny edge detector (defaults to auto detect)

t2_canny

threshold for strong edges for Canny edge detector (defaults to auto detect)

Value

dataframe of QA metrics

Examples

fname <- system.file("extdata", "qa_data.nii.gz", package = "fmriqa")
res <- run_fmriqa(data_file = fname, gen_png = FALSE, gen_res_csv = FALSE, tr = 3)


Run fMRI quality assurance procedure on a set of NIfTI data files

Description

Run fMRI quality assurance procedure on a set of NIfTI data files

Usage

run_fmriqa_glob(pattern, ...)

Arguments

pattern

glob expresion to match analysis files

...

options to pass to run_fmriqa function