Real-time recording of the electroencephalogram (EEG) and functional magnetic resonance imaging (fMRI) may reveal the brain's activity at high temporal and spatial resolution. However, the EEG recorded during fMRI scanning is corrupted by large repetitive artifacts, called Gradient artifacts which are generated by the switched MR gradients. In addition, Ballistocardiographic artifacts (BCG) are overlaid on the EEG resulting from heart beat related body movements and blood flow changes. This thesis presents generic methods to remove fMRI environment-related artifacts from EEG data with the minimization of residual artifacts. Firstly, methods for removing gradient and BCG artifacts have been presented in this thesis which is based on capturing temporal variations in the artifacts by carrying out temporal principal component analysis (PCA) and recognition of a set of basis functions which describe the temporal variations in the artifacts. FASTR (fMRI Artifact Slice Template Removal) algorithm is used here for subtracting gradient artifacts in which a unique artifact template is generated for each slice as the local moving average plus a linear combination of basis functions that describe the variation of residuals. The basis functions are derived by performing temporal principal component analysis (PCA) on the artifact residuals and selecting the dominant components to serve as a basis set. QRS complexes are identified for the purpose of pulse artifact removal. These methods are implemented as an FMRIB toolbox in EEGLAB. The algorithms employed here give satisfactory results by removing all the artifacts. This artifact reducing analysis offers possibilities for improved neurological research and clinical neurosurgical applications.