creating a bipolar derivation

Concerning processing components: filters, file load/save, visualizations, communication ...
KJeffrey
Posts: 74
Joined: Wed Jul 20, 2022 6:47 pm

creating a bipolar derivation

Post by KJeffrey »

I wish to simulate EOG signals using a bipolar derivation such as F9-F10 for the horizonal eye channel. Is the an existing Box that can be set up to do this? Seems simple.

-Jeff

Thomas
Posts: 213
Joined: Wed Mar 04, 2020 3:38 pm

Re: creating a bipolar derivation

Post by Thomas »

Hi Jeff,

There might be boxes to help you out with this one.
Could you explain a bit more how you want to achieve this ? Are you looking for classificaiton boxes, or some maths to process F9-F10 ?

Thanks,
Thomas

KJeffrey
Posts: 74
Joined: Wed Jul 20, 2022 6:47 pm

Re: creating a bipolar derivation

Post by KJeffrey »

I just need to be able to do the subtraction and pass on to the next stage, which in this case would be to the EOG Denoising Calibration Box prior to the actual classification training, and to the Denoising Box during the classification training. This will essentially create the EOG channels the we are not recording with our particular system.

I think there is a Laplacian derivation, which is essentially channel math; this is just channel match with a couple of channels.

Thanks,
-Jeff

KJeffrey
Posts: 74
Joined: Wed Jul 20, 2022 6:47 pm

Re: creating a bipolar derivation

Post by KJeffrey »

Hello,

I am still waiting on a response.

-Jeff

Thomas
Posts: 213
Joined: Wed Mar 04, 2020 3:38 pm

Re: creating a bipolar derivation

Post by Thomas »

Hi Jeff,

Sorry for not replying earlier.

I think you can use the Simple DSP box (documentation).

You can use it with 2 inputs, one being a signal containing F9 and the other a signal containing F10, and type "a-b" as the equation.
You can filter F9 and F10 from your signal using the "Channel Selector" box (documentation).

Hope this helps,

Thomas

KJeffrey
Posts: 74
Joined: Wed Jul 20, 2022 6:47 pm

Re: creating a bipolar derivation

Post by KJeffrey »

Thomas,
I tried to follow your suggestion, but it failed.
I am attaching the scenario.
EOG_remove scenario 2023-08-02_17-12-13.png
EOG_remove scenario 2023-08-02_17-12-13.png (62.71 KiB) Viewed 45767 times
-Jeff
Attachments
EOG_remove.xml
(43.07 KiB) Downloaded 1317 times

Thomas
Posts: 213
Joined: Wed Mar 04, 2020 3:38 pm

Re: creating a bipolar derivation

Post by Thomas »

Hi Jeff,

First of all the scenario looks fine.

As the the error message states, the box is not happy with the equation you typed.
Indeed, the box is processing the incoming signals but does not know the channels F9, Fp1, etc.

The variables that can be used are the letter of the alphabet in the same order as the inputs (e.g. F9 should be written 'a' in the equation).

Your equation should therefore be:

Code: Select all

( (a-c) + (b-d) ) / 2
For more, all the equation specs are detailed in the box documentation page.

Hope this helps,
Thomas

KJeffrey
Posts: 74
Joined: Wed Jul 20, 2022 6:47 pm

Re: creating a bipolar derivation

Post by KJeffrey »

Thomas,

I got the equations and channel naming worked out based on what you pointed out to me. Now I need a good way to test it. I extracted a 43 second segment from a pilot subject's EEG data in Matlab. To do so I had to use Matlab and ended up with a BrainVision format file. Then I re-discovered OpenViBE cannot handle multiplexed data. So I tried the entire OV data file but it is 19 minutes long. I plotted the VEOG and it ran through the whole file once, then the display stopped there but the scenario kept going. I coled the VEOG and that stopped the scendario. But a b-matrix was not calcualted.

How can I extract a segment from the OV file and save it as a separate file for testing? And stop the scenario? It appears I need to send an OVTK_GDF_End_Of_Session trigger from somewhere.

Thanks,
-Jeff

KJeffrey
Posts: 74
Joined: Wed Jul 20, 2022 6:47 pm

Re: creating a bipolar derivation

Post by KJeffrey »

A follow-up to the last post:

Attached is the current scenario to test EOG derivation and EOG Denoising. Here is a screenshot as well:
EOG_remove scenario 2023-08-03_16-25-24.png
EOG_remove scenario 2023-08-03_16-25-24.png (34.31 KiB) Viewed 45758 times
You can see that I created HEOG and VEOG, but only used the VEOG since I did not know how to combine them. In the eog-calibration example, two EOG channels were simply selected from the complete set of channels. That does not work here. Can you tell me how to combine these into one stream so I can feed that to the [EOG_Denoising_Calibration]?

-Jef
Attachments
EOG_remove.xml
(47.48 KiB) Downloaded 1333 times

Thomas
Posts: 213
Joined: Wed Mar 04, 2020 3:38 pm

Re: creating a bipolar derivation

Post by Thomas »

Jeff,

You can merge to signals together into one with the Signal Merge box (documentaiton).

When you ran the scenario through the whole data, the display stopped because there was no more data, but the scenario kept running since it didn't know it had to stop. A Player Controller box is needed in order to stop the scenario automatically. You can follow the same process as the one I explained in my last answer to your other post.

The b-matrix was not calculated, because the EOG calibration box is expecting stimulations on its stimulation input in order to know the segment of data it needs to process. It is explained in the box documentation.

To extract a segment of the scenario, you could possibly try to use a Stream Switch box (documentation), that allow you to direct the data stream to one output or the other. This way you can have a file writer on input 1 and play with stimulations (and a keyboard stimulator) to direct the stream to the desired output when you want and for the duration you want.
This process is manual however.
I believe some box combinations could automate the process, but maybe a simple option (if you know Python), would be to use the python box in order to programmatically passthrough the stream only on the desired segment using python timers.
Here is some documentation on python scripting in OpenViBE.

Hope this helps,
Thomas

KJeffrey
Posts: 74
Joined: Wed Jul 20, 2022 6:47 pm

Re: creating a bipolar derivation

Post by KJeffrey »

Thomas,

The Signal Merge worked well.
I added a Stim Validator and Player Controller to stop the scenario, as I did for test_CWT. Here is the result:
EOG_remove 2023-08-07_21-29-06.png
EOG_remove 2023-08-07_21-29-06.png (91.3 KiB) Viewed 45736 times
I did not attempt the next part to extract a segment as I did not fully understand it and thought to first get it working with the first stimulation. This also seems to be getting off the main track. I want to implement the scenario as close as possible to the way it will be run on a subject, and just be able to look at the results to make sure they are correct.

-Jeff

KJeffrey
Posts: 74
Joined: Wed Jul 20, 2022 6:47 pm

Re: creating a bipolar derivation

Post by KJeffrey »

Here is the scenario.
-Jeff
Attachments
EOG_remove.xml
(46.22 KiB) Downloaded 1335 times

Thomas
Posts: 213
Joined: Wed Mar 04, 2020 3:38 pm

Re: creating a bipolar derivation

Post by Thomas »

Hi Jeff,

So I had a look at the code because there error messages were a bit surprising to me.

I realised that the implementation of the EOG Denoising Calibration box does not play well with the stimulation based epoching.

Indeed, the box automatically triggers the calibration processing when it stops receiving data, therefore, after receiving the first epoch from the StimulationBasedEpoching, the box stops receiving signal. In reality it will receive some more on the next epoch, but this depends on the stimulations in the signal and the EOG Denoising Calibration box does not know about it.

The box is intended to work with continuous signal incoming and to receive stimulations for the windows of interest.
You can see the way it works by running the scenarios provided with OpenViBE. There are in your user folder, and then AppData\Roaming\OpenVIBE-3.5.0\scenarios\box-tutorials\eog-removal.

I've modified your scenario to remove the epoching, and I've added a Lua box (very similar to the suggested python script in my previous reply), that will send the right triggers to the EOG Denoising box. It is configurable to set the desired window.

Hope this helps, let me know how you get on with it.

Thomas
Attachments
EOGDenoisingWindows.txt
(477 Bytes) Downloaded 1252 times
EOG_remove.xml
(48.51 KiB) Downloaded 1326 times

KJeffrey
Posts: 74
Joined: Wed Jul 20, 2022 6:47 pm

Re: creating a bipolar derivation

Post by KJeffrey »

Thomas,

Thanks for this as well and the extra custom work you had to do. This was the result on the file I used before, smokeCue_GS.ov:
testEOG BS 2023-08-14_22-06-50.png
testEOG BS 2023-08-14_22-06-50.png (122.13 KiB) Viewed 45720 times
I will try to upload this file to DropBox, but it is probably too big.

I also tried it on the file I created today, uploaded in another thread (test_2023_0814_1blk_15trl.ov)
test_short 2023-08-14_22-11-17.png
test_short 2023-08-14_22-11-17.png (119.78 KiB) Viewed 45720 times
Very odd that it claimed the sample is 7 seconds, when it is actually 147 seconds

Thomas
Posts: 213
Joined: Wed Mar 04, 2020 3:38 pm

Re: creating a bipolar derivation

Post by Thomas »

Hi Jeff,

Thanks for sharing the files to reproduce the issue (which I did!).

From what I see, the files you have recorded are not continuous data but non continuous epochs.
We can see this in the signal display box: chunks of signal get displayed every second or so.

This is problematic since at some point, the gap between two epochs is just big enough for the EOG Denoising Calibration box to believe there is no signal anymore and to trigger the calibration processing.

Using OpenViBE, I would recommend recording data as raw as possible and then reapply filters while playing the data again. It allows for better control on the data.

Kind regards,
Thomas

Post Reply