The invention discloses a brain
signal online denoising method in a
nuclear magnetic resonance environment. The method comprises the steps of 1) conducting high-pass filtering on collected brain electrical signals; 2) conducting up-sampling on the filtered signals and
synchronizing the brain electrical signals with markers sent by a fMRI device; 3) constructing a sliding window to construct a
noise template Atau for preliminary denoising; 4)
slicing a
signal Sh mixed with
noise into a slice with a length of T*w points, fitting the
noise template with slice date through
least squares to obtainfitting parameters ytau, and subtracting ytau*Atau from the Sh to obtain a
signal Sr with residual artifacts; 5) conducting PCA on the signal Sr, sorting each component according to degree of relevance, taking the largest
m components as an optimal base betaj(j=1,2,...,m) of
gradient noise, fitting the optimal base with the Sr through the
least squares to obtain fitting parameter aj(j=1,2,...,m),subtracting N from the Sr, and conducting denoising through the construction of a
gradient noise template and denoising through the PCA to eventually eliminate the
gradient noise. The brain signal online denoising method in the
nuclear magnetic resonance environment has the advantages that real-time denoising can be conducted on the signals to meet demands of
data processing speed of an online experiment.