# Real-Time Localization of Epileptogenic Foci EEG Signals: An FPGA-Based Implementation
## 3 Hardware Implementation and Computational Method
### Computation of the RT-EPI Algorithm
#### 3.4.1 Algorithm Description
Both designs need no more than 137 DSP slices, while BRAM usage is 95 MB for the \"single\" design (doubling to 185 MB the requirements for the \"double\" design, provided that, obviously, the 64-bit double precision data types doubles the memory needs of the single 32-bit data type). Note that the computational needs of the implementation in a Virtex 7 Xilinx FPGA device requires a reduced portion of its total resources; see Table 4. In fact, this application can be executed even on a small and cost-effective Xilinx XC6 SLX100 Spartan-6 FPGA, assuring a low-cost of implementation. Regarding the performance, it has been shown that the proposed implementation can perform all computation tasks at a maximum of 3.55 Hz when using the single data types, or 2.53 Hz when using double data types. That means that the single design can deliver outputs at a rhythm of 3.55 times by second. However, note that this 3.55 Hz of classification frequency (2.53 Hz for double design) is only effective after the first 5 s of acquisition time due to the 5 s segmentation. This implies a minimum latency time to achieve the first result from the beginning of an acquisition without artifacts of the EEG signal. From this 5 s latency, the proposed implementation is capable of handling overlapped time windows, delivering results at the maximum classification frequency. Thus, for the single design, a result will be provided each \(1/3.55=0.28\) seconds after the first 5 s window length. Thus, we have shown that an adequate selection of the set of features, classifier model and length of the window segment, allows one to obtain good classification accuracy results (above the average of previous related works) while maintaining a low computational load for the whole classification procedure. It enables us to move the classification procedure to the real-time field, embedded in a logic-reconfigurable FPGA. The proposed implementation can be carried out on a small portable device embedding a fast classification engine of epileptogenic focus. This device can serve as a help decision tool to assist neurosurgeons to refine the localization of the epileptogenic area during the resective epilepsy surgery in those cases where greater precision or confirmation were needed. ## 6 Conclusions

The locating of the epileptogenic focus using interictal EEG signals is generally a computerized analysis carried out off-line by neurosurgeons and epileptologists to determine the brain regions responsible for the initial seizure discharge. However, previous works tend to propose more computationally costly procedures the more recent they are. This work shows that an adequate selection of the set of features, classifier model and length of the window segment, allows one to obtain good classification accuracy results (above the average) while maintaining a low computational load. It enables the real-time implementation of the whole classification procedure, on an FPGA reconfigurable device, from accepting the raw EEG signals to the delivery of the classification outputs at a rhythm of up to 3.55 Hz. It opens the door to the use of the automatic classification as a decision-assisting tool during surgery, enabling neurosurgeons to refine the localization of the epileptogenic area during the resective epilepsy surgery. Concluding, it has been shown that the proposed hardware implementation of the epileptogenic foci locator can be embedded on a small portable device, embedding, thus, a fast classification engine of epileptogenic signals in epilepsy. Individual contributions: conceptualization, [PERSON]-M., A.G.M., V.V., K.G.H. and V.T.-M.; methodology, [PERSON]-M., J.V.F.-V. and M.B.-M.; software, [PERSON]-M., A.M. and J.V.F.V. ; formal analysis, [PERSON]-M., J.V.F.-V., A.M., M.B.-M. and A.R.-M.; writing--original draft preparation, J.V.F.-V.; writing--review and editing, [PERSON]-V., A.R.-M. and M.B.-M. All authors have read and agreed to the published version of the manuscript. The authors declare no conflict of interest.