How to do real Time EEG seizure Detection/analysis?

Hello, I am writing a code that should be able to tell if a signal inputed into the code has a seizure or not. How can I change it so it analyses an eeg recording that may have seizures at some point and then give real time answer/showcases realtime if the current part of the recording has a seizure? I'm not sure where to get started and need some advice if possible.It may need some sort of window but i do not know how to go about it.

 Accepted Answer

I suggest you first consult with your neurologist, or whatever medical professional hired you to do this, and have them identify normal and abnormal eeg signals. We cannot do that for you. We only help with MATLAB code, and perhaps some simple algorithm development.
I suspect you can use traditional signal analysis, or a deep learning approach. If you have some characteristics of the signal that can be readily identified from the signal(s) then perhaps a traditional signal analysis approach would be successful. If not, you could try deep learning but you'd need a neurologist to categorize hundreds of signals as normal or one of some number of abnormal states, after which you can use those categorizations to train a deep learning classification network.
Here are some articles that may help you with algorithms:
As far as real time analysis, I think you may need the Data Acquisition Toolbox to somehow input your signals from the EEG machine into your computer. I can't help with that part but there may be examples in that toolbox's documentation. You may have to first capture and then look at short time segments, like import 2 second segment of signal, then process that segment, then grab and analyze the next segment.

4 Comments

Yes I've already been working on the seizure identification in MATLAB, I wasn't hired but it is a personal project since I've seen many similar projects online (these do not work with the dataset set I'm testing thus I was trying to remake my own but have faced some struggles). I'm trying both a deep learning approach and a thresholding approach for that, using the CHB MIT dataset, which has seizures and non seizures already labelled.
In terms of real time, I meant to replicate real time analysis, as I would input an EEG signal file that would be maybe a couple of minutes long, and then the code should analyse it all in segements of 2 seconds in which the program would respond if in each 2 seconds there's a seizure or not present. I have the data acqusition toolbox so I will look into segmentation more in depth, thank you for you reply, I will also look at the sources provided.
If you're reading your signal in from a file already stored on disk, then you're not doing real time analysis and you won't need the Data Acquisition Toolbox. I guess to simulate real time acquisition you could use fread to read in just enough samples that would correspond to 2 seconds, and then analyze that segment, and repeat for as long as there is still data in the file.
With a deep learning approach you don't need to say how a normal and abnormal signal are different (like different amplitudes or frequencies or whatever), you just need to have signals (or 2 second segments of signals) each labeled as normal or abnormal. And you need lots of them.
With a traditional analytical signal analysis approach you need to describe what is different, like the amplitude or whatever then design code to detect that. You don't need many sample waveforms for developing the algorithm, just a few that span the range, like from perfectly normal to questionable to definitely abnormal. Once it works on a handful of files, then you can apply it to however many files you have.
Thank you for the advice I've taken it into account, I've mostly finished the threshold code through amplitude differences and other features, and now I'm looking into using the buffer function for the real time simulation of the eeg bit since not sure the fread would be applicable.
I think you haven't looked into it enough. They do different things. From what I can see in the documentation buffer splits up a signal that is already in memory (already in a variable) into separate segments, so you need to have it already read in from disk. fread is the function that does the actual reading of the bytes into memory from a disk file. So you need fread. If you want to then use buffer on what fread retrieved from the file, then you can do that.

Sign in to comment.

More Answers (0)

Categories

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!