PhysioPreprocess PhysioPreprocess logo

Preprocessing Functions for PhysioExperiment Objects

PhysioPreprocess provides a comprehensive preprocessing toolkit for multi-modal physiological signal data. Built on top of PhysioCore, it delivers 30 exported functions covering digital filtering (Butterworth, FIR, notch), resampling and interpolation, ICA-based artifact removal, bad channel detection, baseline correction, re-referencing, and reproducible preprocessing pipelines -- all operating directly on PhysioExperiment objects.

Installation

You can install PhysioPreprocess from r-universe:

# the containers build on Bioconductor, so its repositories are needed too
install.packages("BiocManager", repos = "https://cloud.r-project.org")
install.packages("PhysioPreprocess",
  repos = c("https://x-biosignal.r-universe.dev", BiocManager::repositories()))

Or install the development version from GitHub:

# install.packages("remotes", repos = "https://cloud.r-project.org")
remotes::install_github("x-biosignal/PhysioPreprocess")

Quick Start

library(PhysioPreprocess)

# Create sample EEG data (4 seconds, 4 channels, 250 Hz)
signal_matrix <- matrix(rnorm(1000 * 4), nrow = 1000, ncol = 4)

pe <- PhysioExperiment(
  assays = list(raw = signal_matrix),
  samplingRate = 250
)

# Apply a 1-40 Hz bandpass Butterworth filter
pe <- butterworthFilter(pe, low = 1, high = 40, order = 4)

# Remove 50 Hz line noise with a notch filter
pe <- notchFilter(pe, freq = 50)

# Re-reference to the average of all channels
pe <- rereference(pe, ref_type = "average")

# Check reference status
isAverageReferenced(pe)  # TRUE

Features

Digital Filters

A full suite of frequency-domain filters for physiological signals:

Resampling

Flexible sample rate conversion and multi-rate signal support:

Artifact Handling

Automated and semi-automated artifact detection and removal:

Baseline Correction

Remove baseline drift and DC offsets:

Re-referencing

Electrode re-referencing for EEG and related modalities:

Pipeline API

Build reproducible, shareable preprocessing chains:

# Build a reusable preprocessing pipeline
pipeline <- createPipeline(
  list(fn = butterworthFilter, low = 1, high = 40),
  list(fn = notchFilter, freq = 50),
  list(fn = rereference, ref_type = "average")
)

# Apply to any PhysioExperiment
pe_clean <- applyPipeline(pe, pipeline)

Dependencies

PhysioExperiment Ecosystem

PhysioPreprocess is part of the PhysioExperiment ecosystem, a suite of R packages for multi-modal physiological signal analysis:

Package Description
PhysioCore Core data structures and accessors
PhysioIO File I/O (EDF, HDF5, BIDS, CSV, MAT)
PhysioPreprocess Signal preprocessing and artifact removal
PhysioAnalysis Spectral analysis, epoching, statistics, visualization
PhysioMoCap Motion capture data processing
PhysioOpenSim OpenSim biomechanical modeling integration

Visit the r-universe page to browse all available packages.

License

MIT License. See LICENSE for details.

Author

Yusuke Matsui

Governance & support

Part of the Physio ecosystem. Community and policy documents (Code of Conduct, Contributing, Governance, Support, Security, and Deprecation & lifecycle) live in the umbrella repository.