We are developing an external P300-based BCI application using the BCI2000Remote class. We use a sample frequency of 256Hz and a SampleBlockDuration parameter of 8.
When the last sequence of stimuli presentation starts, we enable a timer that reads every 8 ms the values of StimulusCodeRes and Signal(0,0) and stores them. Our application has 8 different stimuli so there are 8 different values for the StimulusCode state. When the last sequence of stimuli has finished, our application has read from 6 to 8 values for StimulusCodeRes, so it sometimes losses one or two values (it happens approximately 1 or 2 times out of 10). I have checked if it losses a value it is always one of the last four values: for instance, if the last random sequence of stimuli was: 5 3 8 4 7 2 1 6, it would storage: 5 3 8 4 7 1 6 or 5 3 8 4 7 2 6...
I am not sure where the problem is. Are we reading the data properly? What is the best way to read the P300 classification scores using BCI2000Remote?
Many thanks in advance.
Regards,
Rebeca
Code: Select all
/* These variables are declared and initialized previously */
static array<double^>^ ArraySCR = gcnew array<double^>(10);
// Array which stores the StimulusCodeRes values
static array<double^>^ ArrayCS = gcnew array<double^>(10);
// Array which stores the scores from the control signal
static int indexArrays = 0; //index which increases with new values of StimulusCodeRes
private: System::Void timer4_Tick(System::Object^ sender, System::EventArgs^ e)
{
double valueSCR = 0;
double valueCS = 0;
if(!bci->GetStateVariable("StimulusCodeRes", valueSCR))
{
MessageBox::Show("Error GetStimulusCodeRes: "+gcnew String( (bci->Result()).c_str() ));
}
if(!bci->GetControlSignal(1,1, valueCS))
{
MessageBox::Show("Error GetControlSignal: "+gcnew String( (bci->Result()).c_str() ));
}
if(valueSCR!=0)
{
bool control = false;
for (int k=0; k<8; k++)
{
if((double)ArraySCR[k] == valueSCR)
{
control = true;
k = 8;
}
}
if(control==false)
{
ArraySCR[indexArrays] = valueSCR;
ArrayCS[indexArrays] = valueCS;
indexArrays++;
}
}
}
