## 1 Introduction  
Electroencephalography (EEG) is a non-invasive neurophysiological technique that measures the variation in electrical potentials by means of electrodes positioned over the scalp [1]. This variation in potentials is associated with neural activity that is generated inside the brain, referred to as source space, and propagates to the surface, named sensor space [1]. The analysis of EEG recordings can be used as a proxy to better understand neural mechanisms in health and disease. So far, most EEG studies have relied on analyses conducted in the sensor space, to make inferences on neural responses to specific stimuli (event-related potential analysis) [2, 3] or modulations of neural oscillations during task performance (event-related synchronization/desynchronization analysis) [4, 5, 6, 7]. Over the last years, there has been a growing interest in using electrophysiological techniques to study functional interactions between distant brain regions, namely functional connectivity, especially in the resting-state condition. Different resting-state networks (RSNs), among which are the default mode (DMN), the dorsal (DAN) and the ventral (VAN) attention, the language (LN), the somatomotor (SMN) and the visual (VN) networks, have been detected first using magnetoencephalography [8, 9] and then EEG [10, 11, 12, 13]. The use of high-density EEG (hdEEG) systems capable of recording more than 100 signals at different scalp locations have been crucial to reliably measure functional connectivity and map RSNs [14; 15; 16; 17]. Specifically, dedicated analysis workflows for hdEEG data were developed to improve the reconstruction of neural activity in the brain [10; 11; 12; 18; 19; 20; 21], including tools for signal pre-processing, head modeling and source localization. The use of an appropriate head modeling strategy is deemed fundamental to take advantage of the superior scalp coverage provided by hdEEG [22; 23; 24; 25]. The localization of neural generators requires indeed the modeling of neural activity propagation from the sources, located inside the brain, to the potentials measured by EEG sensors over the scalp. The linear relationship between source activity and EEG measures is mathematically modeled by means of the leadfield matrix [17; 26]. Notably, an accurate realistic head model has been found to have a direct positive impact on the performance of source localization algorithms [14; 16; 17; 27; 28; 29]. Two factors primarily contribute to the accuracy of head modeling: head image segmentation and EEG electrode positioning. The segmentation of the head image, which can be obtained using the magnetic resonance (MR) imaging technique, permits the modeling of the topological and physical properties of each head tissue compartment. To this end, different MR segmentation methods were proposed, whose accuracy depends on the space where such segmentation is performed--individual [22; 25; 30] or template [31; 32; 33; 34]--and on the number of considered tissues, which typically ranges from 3 to 12 [10; 22; 25; 30; 35; 36; 37; 38]. In a recent study, we introduced MR-TIM, a computational method for automated head image segmentation in 12 tissue classes [25]. Importantly, we demonstrated the superior performance of MR-TIM compared to existing methods, which can identify 12 tissue classes by warping a segmented template image to individual space [10], or can segment the real MR image into 3 to 5 tissue classes directly in the individual space [35; 38]. The accuracy of electrode positions is also very important for the generation of the leadfield matrix. Electrode positions can be obtained before or after the EEG measurements using digitization [39; 40], photogrammetry [41; 42] and 3D scanning [43; 44; 45; 46] techniques. These are influenced to a variable extent by single-electrode localization errors [47] as well as by errors related to the co-registration of the whole set of electrodes to the head shape [48].