spatial filter

Concerning processing components: filters, file load/save, visualizations, communication ...
Post Reply
iuri
Posts: 15
Joined: Thu Jul 02, 2009 12:05 pm

spatial filter

Post by iuri »

Hi there,

I am creating a new scenario on openeeg. Basically i already built the steps and placed all the boxes i need to work with.
now i am trying to properly set the parameters according with the pre-recorded data i am using.

I am stuck at spatial filter box. I wonder what values i need to put in the parameter "spatial filter coefficients".

i looked at the parameters of spatial filter box from a sample scenario of openvibe, see bellow:
Spatial Filter Coefficients: 4 0 -1 0 -1 -1 0 0 -1 0 0 4 0 -1 0 0 -1 -1 0 -1 (20 values)
Number of Output channels: 2
Number of Input channels: 10

So, I see the spatial filter coefficients are related to the input signal channels. The channel selector box of the sample scenario contains:
Channels List: C3;C4;FC3;FC4;C5;C1;C2;C6;CP3;CP4 (10 channels)

i wonder if my intuition is correct: from 10 channels to 20 values , does it make sense?

So, on my channel selector box i have the channels
Channels List: C3;C4;Cz;F3;F4;P3;P4;O1;O2; (9 channels)

as i have 9 channels on my channel selector, i must have 18 values in the spatial coefficients.
That's why i set: Spatial Filter Coefficients: 4 0 -1 0 -1 0 0 -1 0 0 4 0 -1 0 0 -1 0 -1

although, i strongly believe that the values and its positions must be properly synchronized to each channel, however i need some definitions: (p.s. i am concerned what a spatial filter does).
a) what is the spatial filter coefficients?
b) what does it do?
c) what would be the correct values to set on it according with my channels list?

cheers,

yrenard
Site Admin
Posts: 645
Joined: Fri Sep 01, 2006 3:39 pm
Contact:

Re: spatial filter

Post by yrenard »

Iuri,

the spatial filter generates a number of output channels from another number of input channels, each output channel being a linear combination of the input channels.
For example, lets say ICj is the jth input channel, OCk is the kth output channel, and Sjk is the coefficient for the jth input channel and kth output channel in the Spatial filter matrix.

Then the output channels are computed this way :

OCk = Sum on j ( Sjk * ICj )

Is it clear to you what the spatial filter does ?

For the coefficient orders, all the coefficients for the first output followed by all the coefficients for the second output and so on...

In the example you point out (guess it is the motor imagery BCI), you have :
Spatial Filter Coefficients: 4 0 -1 0 -1 -1 0 0 -1 0 0 4 0 -1 0 0 -1 -1 0 -1 (20 values)
Number of Output channels: 2
Number of Input channels: 10
Channels List: C3;C4;FC3;FC4;C5;C1;C2;C6;CP3;CP4 (10 channels)
So the output channels are :

OC1 = 4 * C3 + 0 * C4 + (-1) * FC3 + 0 * FC4 + (-1) * C5 + (-1) * C1 + 0 * C2 + 0 * C6 + (-1) * CP3 + 0 * CP4 = 4 * C3 - FC3 - C5 - C1 - CP3
OC2 = 0 * C3 + 4 * C4 + 0 * FC3 + (-1) * FC4 + 0 * C5 + 0 * C1 + (-1) * C2 + (-1) * C6 + 0 * CP3 + (-1) * CP4 = 4 * C4 - FC4 - C2 - C6 - CP4

This is basically a Surface Laplacian around C4 and C5.

For your question what would be the correct values to set on it according with my channels list, I would answer depends on what you want to do. In the case of the motor imagery, we wanted to reduce noise and this gave good results.

Hope this helps,
Best regards,
Yann

yrenard
Site Admin
Posts: 645
Joined: Fri Sep 01, 2006 3:39 pm
Contact:

Re: spatial filter

Post by yrenard »

iuri,

as I was writing my last message, I realized that the documentation for the spatial filter was almost empty so I used our discussion to update this documentation. You can see it on the spatial filter dedicated page. I'm waiting for your feedback :)

Best regards,
Yann

iuri
Posts: 15
Joined: Thu Jul 02, 2009 12:05 pm

Re: spatial filter

Post by iuri »

and from where did you take the coefficients?
4 0 -1 0 -1 -1 0 0 -1 0 0 4 0 -1 0 0 -1 -1 0 -1

i opened the .gdf i am using, in order to see from where the coefficients come.
But i don't find any reference of them. It means, there is no such a structure in the gdf file that stores the spatial filter coefficients

are you using covariance matrices to calculate them? or i am totally wrong here. am i ?

ps. yes, i am using the sample file real-hand-movements.gdf from openvibe

very good! as the time i learn we both contribute on documentation! :)

yrenard
Site Admin
Posts: 645
Joined: Fri Sep 01, 2006 3:39 pm
Contact:

Re: spatial filter

Post by yrenard »

Iuri,

you're right, those coefficients aren't stored in the GDF file. They are part of the signal processing pipeline we used for motor movement imagination (the GDF file only contains signal, no signal processing there).

Such coefficients could be learned or optimized offline from previously recorded signals... This is what's done e.g. in the xDAWN algorithm for P300 enhancement. But in our case, we fixed them by hand in order to have a surface laplacian as I said before.

I hope that clears the situation.
Best regards,
Yann

iuri
Posts: 15
Joined: Thu Jul 02, 2009 12:05 pm

Re: spatial filter

Post by iuri »

Yann,

I changed the spatial coefficients to some different positions in attempt to have similar results of the motor imagery sample available on openvibe.

However, the resulting presentation seems to be not calibrated. Which means, after whatever red arrow comes up (i.e. left or right), the blue bar always shows up on the right with its maximum length. Instead of be synchronized.

It turned out to be a "trial by error procedure" to get the properly results synchronized to the arrows.
as it is 18 values i get a 18! possibilities of trials to find the properly combination and succeed!
That's just nonsense :)

yrenard
Site Admin
Posts: 645
Joined: Fri Sep 01, 2006 3:39 pm
Contact:

Re: spatial filter

Post by yrenard »

Iuri,

you are right, this is non sense. There's no chance you can optimize the filter by hand. Surface Laplacian is a very specific filter know to have particular properties, this is why we fixed it by hand - but we did not try to optimize it, we just fixed it. We did not play with the coefficients by hand !! Never. As I said before and I may have not been clear enough, such spatial filter can be trained or optimized. This is an offline process. Check the xDAWN article I pointed out for an example.

Now for what you're trying to do, obviously, you seem not to have any spatial filter trainer / optimizer available. So consider using something similar to the Surface Laplacian (that basically computes a 2D derivate over the scalp). Or avoid using spatial filter at all.

Also, it is not clear to me whether you re-trained the classifier or not...

Tell me if that answers your questions.
Best regards,
Yann

iuri
Posts: 15
Joined: Thu Jul 02, 2009 12:05 pm

Re: spatial filter

Post by iuri »

Hi yann,

I need to learn about laplacian surfaces read xDAWN article again and understand the process described on it, in order to calculate the best coefficients to the spatial filter. I let you know about.

I tried to run the program without spatial classifier at all (in the offline training and in the online classifier) and it didn't present the properly results, i.e. the blue-bar was not balanced.

Yes i did re-train the classifier

cheers,

Post Reply