Threshold

About Brain Computer Interfaces, EEG, neurofeedback, related event announcements, jobs, etc.
Post Reply
hamed
Posts: 15
Joined: Thu Feb 09, 2017 4:58 pm

Threshold

Post by hamed »

Hi all

I want to make a threshold for my signal in openvibe.
for example if my signal higher power than zero the threshold box output set to 1 if lower than 0 my output set to 0

Do you know how can i make a threshold ?

Thanks

tgaugry
Posts: 68
Joined: Thu Feb 09, 2017 10:17 am

Re: Threshold

Post by tgaugry »

Hi,

What you are trying to do can be achieve in multiple ways.
You could for example amplify your signal and use the crop box, or the spatial filter or use the dsp.

The joined example solution use the dsp box, as it feels more natural (to me at least).

Cheers !
Attachments
forum_answer_threshold.xml
(14.51 KiB) Downloaded 523 times

hamed
Posts: 15
Joined: Thu Feb 09, 2017 4:58 pm

Re: Threshold

Post by hamed »

Dear tgaugry

Thanks a lot for your attention and reply
here i explain about my project more.
there is a spaceship scenario in openvibe. As you know in this scenario the output is beta power.
Now i want to do a project like this one.
if beta power be higher than my threshold (for example 0.2) the OSC controller send number 1 to
IP port 127.0.0.1 :3000 and if beta power lower than my threshold send 0
my another software when receive 1 run and when receive 0 stop.
my software works just with 0 and 1

could you please help me about this issues?

tgaugry
Posts: 68
Joined: Thu Feb 09, 2017 10:17 am

Re: Threshold

Post by tgaugry »

Hi,

The "Beta power" boxes are just signal display. It does not modify the signal.
If you want to apply previous threshold to this scenario, you just have to insert the DSP box with more or less the same formula (

Code: Select all

(x > 0.2) ? 1 : 0
instead of

Code: Select all

(x > 0) ? 1 : 0
) between the Beta Power signal display and the Simple dsp.

Hope that helps !

hamed
Posts: 15
Joined: Thu Feb 09, 2017 4:58 pm

Re: Threshold

Post by hamed »

Dear tgaugry

I don't want to modify the signal.
when i use this formula in DSP box, the output is a signal.
I want to send just a binary code. when the signal is higher than my threshold it should send 1 via OSC controller and if lower than my threshold it should send 0
just 1 or 0 no signal.

Thanks a lot

tgaugry
Posts: 68
Joined: Thu Feb 09, 2017 10:17 am

Re: Threshold

Post by tgaugry »

Hi,

From what I understand, it seems that you want to send an event on rising and falling edge with OSC (and not each sample like i assumed earlier).

To achieve that :
- Take the output from the box just before the Beta Power signal display box
- Connect it to a dsp with formula (x > 0.2) ? 1 : -1
- Connect the dsp output to a Sign change detector
- Connect it to an OSC Controller
That's it. The only thing left is to configure The OSC controller & the stimulation sent by the Sign change detector.

Tell me if that solves your problem.

hamed
Posts: 15
Joined: Thu Feb 09, 2017 4:58 pm

Re: Threshold

Post by hamed »

Hi
thanks a lot for your reply
your suggestion done.
I receive something in my another software but it's not 1 or 0.
a screenshot of my work attached
I want to do something like this code with openvibe box.
with this Matlab code my software works well.

markerGo=uint8('1');
markerStop=uint8('0');

hudps = dsp.UDPSender('RemoteIPPort',3000); % Sets up UDP Sender port

if(BetaValue>Threshold)
hudps(markerGo);
else
hudps(markerStop);
end

release(hudps); %When you're done, release the udp port
Attachments
2.jpg
2.jpg (137.84 KiB) Viewed 23641 times

tgaugry
Posts: 68
Joined: Thu Feb 09, 2017 10:17 am

Re: Threshold

Post by tgaugry »

Hi,

I see that you are missing a box DSP box; you have to add another dsp box after the original one (or merge the 2 expressions), not replace it.

Also, did you change the triggered stimulation in the sign change detector box ?
Stimulation code list is available at http://openvibe.inria.fr/stimulation-codes/.
You'll likely be interested in OVTK_StimulationId_Number_00 and OVTK_StimulationId_Number_01.

Cheers !

hamed
Posts: 15
Joined: Thu Feb 09, 2017 4:58 pm

Re: Threshold

Post by hamed »

I changed some stimulation but couldn't find 1 or 0
if this box send 1 or 0 that was perfect.
maybe this box output is not uint8
Attachments
3.jpg
3.jpg (103.11 KiB) Viewed 23639 times

tgaugry
Posts: 68
Joined: Thu Feb 09, 2017 10:17 am

Re: Threshold

Post by tgaugry »

OVTK_StimulationId_Number_00 and OVTK_StimulationId_Number_01 should give you values 0 and 1, respectively.
Could you give me the actual value you get using these stimulations ?

hamed
Posts: 15
Joined: Thu Feb 09, 2017 4:58 pm

Re: Threshold

Post by hamed »

I can receive just a character.
I guss i can't receive 1 or 0 because the output of this box is not unit8
here i have just :D Received
but with my Matlab code i have 1 Received or 0 Received

markerGo=uint8('1');
markerStop=uint8('0');
Attachments
4.jpg
4.jpg (26.57 KiB) Viewed 23638 times

tgaugry
Posts: 68
Joined: Thu Feb 09, 2017 10:17 am

Re: Threshold

Post by tgaugry »

You are likely right, I also think this is due to types conversion.

You will have to check how you do the conversion on your application side.

hamed
Posts: 15
Joined: Thu Feb 09, 2017 4:58 pm

Re: Threshold

Post by hamed »

Maybe i should make some changes in the sign change box codes

Post Reply