The present invention describes a method and apparatus to localize the electrical signals measured from a subject's scalp surface, preferably in near-real time, and to generate dynamic three-dimensional information of the electrical activity occurring within the cerebral cortex of the brain. In the preferred embodiment, it can produce images that can be immediately inspected and analyzed by an operator in near-real time, resulting in a powerful new cortical imaging modality, which we denote as Dynamic Electrocortical Imaging (DECI). The present invention involves the use of a computer, an electroencephalographic (EEG) amplifier, EEG electrodes, and custom software. It can measure healthy and diseased cortical events and states in both conscious and unconscious subjects. This is useful, as it allows for the diagnosis, monitoring and treatment of cortical disorders, while also furthering the understanding of the human brain and lending use to additional non-medical applications such as in entertainment, education, lie-detection and industry. The invention in one embodiment is implemented using software in conjunction with readily available EEG hardware. Furthermore, this same method can be applied to pre-existing data and when doing so, EEG hardware is not required. Having a practical near-real time 3D imaging system brings a far more accessible technology to doctors, researchers, individuals, and private clinics to better diagnose, monitor, treat and understand many of the conditions and abnormalities of the brain.