Background The simultaneous acquisition of electroencephalogram (EEG) and functional magnetic resonance imaging (fMRI) provides both high temporal and spatial resolution when measuring brain activity. A real-time analysis during a simultaneous EEG–fMRI acquisition is essential when studying neurofeedback and conducting effective brain activity monitoring. However, the ballistocardiogram (BCG) artifacts which are induced by heartbeat-related electrode movements in an MRI scanner severely contaminate the EEG signals and hinder a reliable real-time analysis. New method The optimal basis sets (OBS) method is an effective candidate for removing BCG artifacts in a traditional offline EEG–fMRI analysis, but has yet to be applied to a real-time EEG–fMRI analysis. Here, a novel real-time technique based on OBS method (rtOBS) is proposed to remove BCG artifacts on a moment-to-moment basis. Real-time electrocardiogram R-peak detection procedure and sliding window OBS method were adopted. Results A series of simulated data was constructed to verify the feasibility of the rtOBS technique. Furthermore, this method was applied to real EEG–fMRI data to remove BCG artifacts. The results of both simulated data and real EEG–fMRI data from eight healthy human subjects demonstrate the effectiveness of rtOBS in both the time and frequency domains. Comparison with existing methods A comparison between rtOBS and real-time averaged artifact subtraction (rtAAS) was conducted. The results suggest the efficacy and advantage of rtOBS in the real-time removal of BCG artifacts. Conclusions In this study, a novel real-time OBS technique was proposed for the real-time removal of BCG artifacts. The proposed method was tested using simulated data and applied to real simultaneous EEG–fMRI data. The results suggest the effectiveness of this method. 
A real-time method to reduce ballistocardiogram artifacts from EEG during fMRI based on optimal basis sets (OBS)