Hi,
I'm new to BCI2000. I'm currently trying to use FieldTripBuffer (run in matlab) as the Signal Processing module for P3Speller application. I have managed to read the raw signal and states such as StimulusCode in matlab. However, I have trouble find a way to sent the classification result to the application module. Follow the instruction in http://www.bci2000.org/phpbb/viewtopic.php?t=25
I tried to set the StimulusCodeRes and StimulusTypeRes to be greater than 0. However, nothing happened. Then I tried the Cursor Task and managed to control the cursor by sending value to the "Signal" state. So I figure it must be some rule in P3Speller application that I don't know. Could anyone explain to me how to set the stimulusCodeRes and StimulusTypeRes state to let the P3Speller work?
Thank you very much.
Yichuan
FieldTripBuffer and P3Speller
Re: FieldTripBuffer and P3Speller
Hi,
the P3Speller and StimulusPresentation modules await classification scores for all stimuli presented during a sequence. You need to set StimulusCodeRes to all values of the StimulusCode state that appeared since the previous classification, and the signal's 0,0 component to the classification score associated with the stimulus code. For information about how classification scores are further processed in the P3Speller and StimulusPresentation modules, see the documentation of the StimulusTask class (http://www.bci2000.org/wiki/index.php/P ... Task_Class).
Regards,
Juergen
the P3Speller and StimulusPresentation modules await classification scores for all stimuli presented during a sequence. You need to set StimulusCodeRes to all values of the StimulusCode state that appeared since the previous classification, and the signal's 0,0 component to the classification score associated with the stimulus code. For information about how classification scores are further processed in the P3Speller and StimulusPresentation modules, see the documentation of the StimulusTask class (http://www.bci2000.org/wiki/index.php/P ... Task_Class).
Regards,
Juergen
Re: FieldTripBuffer and P3Speller
Dear Juergen,
Thank you for your last reply. I've been trying to make it work from time to time during the last few weeks but still have no luck. Currently, I encountered the following two problems:
1. The P3 speller keeps spelling letter "A" but not the ones I specified in my test code. I used the following code in matlab to send a score corresponding to a stimuluscode:
function sentScore(filename,code,value)
sentEvent(filename,'Signal',double(value));
pause(0.005)
senEvent(filename,'StimulusCodeRes',int16(code));
pause(0.02)
sentEvent(filename,'Signal',double(0));
pause(0.005)
senEvent(filename,'StimulusCodeRes',int16(0));
pause(0.02)
end
function sendEvent(filename,type,value)
event=struct('type',type,...
'value',value,...
'offset',0,...
'duration',0,...
'sample',0);
ft_write_event(filename, event);
end
I suspected it might because of the difference in variable type for 'Signal' so I tried int16, int32, single and double, but no one works. I tried to implement all my testcode in Matlabsignalprocessing instead of filedtrip buffer and everything seems to be working fine. But in our real application, the asynchonized fieldtrip buffer is required.
2. It seems like if I don't send all classification scores before about 200ms after the last stimulus the following warning will be shown:
Warning: P3SpellerTars::Process:: Did not receive classification results for stimulus #11.
and all scores send after will not be accepted by the P3 speller. But this is very inconvenience since the epoch length is about 800ms in our setting. Is there a way I can postpone the decision making time of P3 speller?
Thank your very much
Yichuan
Thank you for your last reply. I've been trying to make it work from time to time during the last few weeks but still have no luck. Currently, I encountered the following two problems:
1. The P3 speller keeps spelling letter "A" but not the ones I specified in my test code. I used the following code in matlab to send a score corresponding to a stimuluscode:
function sentScore(filename,code,value)
sentEvent(filename,'Signal',double(value));
pause(0.005)
senEvent(filename,'StimulusCodeRes',int16(code));
pause(0.02)
sentEvent(filename,'Signal',double(0));
pause(0.005)
senEvent(filename,'StimulusCodeRes',int16(0));
pause(0.02)
end
function sendEvent(filename,type,value)
event=struct('type',type,...
'value',value,...
'offset',0,...
'duration',0,...
'sample',0);
ft_write_event(filename, event);
end
I suspected it might because of the difference in variable type for 'Signal' so I tried int16, int32, single and double, but no one works. I tried to implement all my testcode in Matlabsignalprocessing instead of filedtrip buffer and everything seems to be working fine. But in our real application, the asynchonized fieldtrip buffer is required.
2. It seems like if I don't send all classification scores before about 200ms after the last stimulus the following warning will be shown:
Warning: P3SpellerTars::Process:: Did not receive classification results for stimulus #11.
and all scores send after will not be accepted by the P3 speller. But this is very inconvenience since the epoch length is about 800ms in our setting. Is there a way I can postpone the decision making time of P3 speller?
Thank your very much
Yichuan
Re: FieldTripBuffer and P3Speller
I have difficulties to understand what your configuration looks like because the fieldtrip buffer was not designed to be used like that. BCI2000 expects a constant stream of evenly-paced signals from the buffer, rather than a signal event now and then.1. The P3 speller keeps spelling letter "A" but not the ones I specified in my test code.
I guess the problem specific to transmitting classification scores is that the fieldtrip buffer does not understand that the "Signal" event and the "StimulusCodeRes" event belong together. Could it be that another process is inserting "Signal" events into the fieldtrip buffer in parallel to your code?
When there is a parameter called "EpochLength" on the BCI2000 side, the P3Speller will use that to determine the time of classification. Create such a parameter in bci_Construct.m, or in the FieldtripBuffer's constructor, and set it to "800ms" (including the letters "m" and "s").2. It seems like if I don't send all classification scores before about 200ms after the last stimulus the following warning will be shown:
Warning: P3SpellerTars::Process:: Did not receive classification results for stimulus #11.
and all scores send after will not be accepted by the P3 speller. But this is very inconvenience since the epoch length is about 800ms in our setting. Is there a way I can postpone the decision making time of P3 speller?
Best regards,
Juergen
Who is online
Users browsing this forum: No registered users and 15 guests