pythonmatlabsignalstopography

How to write topography function for eeg


I am writing a HW neurofeedback app. Which wotks like this: https://www.youtube.com/watch?v=pjCghiq5FoQ

In this case it is a demo which is not actually working. I have data from EEG and I want to plot them on the surface by LEDs. The technique is similar to this output: http://www.fieldtriptoolbox.org/_media/tutorial/natmeg_temp/natmeg_freq11.png?w=400&tok=6e5a3c

But I need to write it on my own because I need to light the LEDs instead to show 2D image. Basically I have no clue where to start.

My goal is to visualize spectral density for each EEG channel by each LED as you can see demo on YouTube.

I know I need signal and electrodes position in x, y, z e.g. identification of LED number on the sculpture.¨


Solution

  • you have multichannels EEG recordings. I suspect you have the positions of these channels. You also have the (rough) position of your LEDs on the head.

    Interpolate your data to find the power at the LED positions.

    ledInput = interp2(Xeeg,Yeeg,EEGpower,Xled,Yled),
    

    to find the RGB colors corrisponding to the power values:

    ledInput = rand(32); % create fake data for testing
    colorResolution = 256; % choose a color resolution
    colors = jet(colorResolution); % creates a colorbar of 256 elements. (you can change "jet" with any other colorbar of matlab) 
    ledInput = (ledInput-min(ledInput))/range(ledInput); % change range btwn 0 and 1
    ledInput = round(ledInput*(colorResolution-1))+1; % turn the power values into index for the colormap
    ledInput = colors(ledInput,:); % find the colors for your leds