Pre-intensifying subsets of P300 alphabet

Forum for discussion on different user applications
Locked
Ray Ma
Posts: 14
Joined: 15 Feb 2010, 16:39

Pre-intensifying subsets of P300 alphabet

Post by Ray Ma » 13 Apr 2010, 00:51

Hi, so I've been intensifying subsets of the p300 alphabet by manipulating mSequence member. My question is, how should I modify the code to do pre-intensifying of the next subset of characters, and at the same time prohibit classification during the pre-sequence period. My purpose of doing this is to prime the subject about what characters he/she can use to spell in the next sequence. Any suggestions? Thanks very much!

mellinger
Posts: 1210
Joined: 12 Feb 2003, 11:06

Post by mellinger » 13 Apr 2010, 08:41

Hi,

I would suggest that you add a method

Code: Select all

virtual void DoPreSequence( const GenericSignal&, bool& doProgress )
to the P3SpellerTask class.

During the pre-sequence phase, this method will be called for each block of incoming data. In addition, setting the doProgress argument to false, you may keep the system in pre-sequence phase as long as you wish.

So what you probably need to do is to introduce a counter member variable which you set to zero from the OnPreSequence() method, and which you increment inside the newly created DoPreSequence() method. Depending on the state of the counter, you call

Code: Select all

Associations()[stimulusCode].Present();
and

Code: Select all

Associations()[stimulusCode].Conceal();
to highlight the stimuli associated with a certain stimulus code, and set doProgress to false during that pre-sequence stimulus presentation.

--Juergen

Ray Ma
Posts: 14
Joined: 15 Feb 2010, 16:39

Post by Ray Ma » 13 Apr 2010, 13:03

Hi Juergen,

Thanks very much for the timely reply! I've gotten it work. The following is my code:

Code: Select all

void P3SpellerTask::DoPreSequence(const GenericSignal &, bool &doProgress)
{
	mPreSeqCount +=1; // increment time-control counter
	if(mPreSeqCount <= 30)
	{
		doProgress = false;		
		for(int i= 0; i < mSequence.size(); i++)
		{
			Associations()[ mSequence.at(i) ].Present();
		} 
	}
	else // finish DoPreSeq
	{
		doProgress = true;
		for(int i= 0; i < mSequence.size(); i++)	
		{
			Associations()[ mSequence[i] ].Conceal();
		}
	}
}
But here's one more question. So I defined mPreSeqCount in P3SpellerTask.h, how should I compute its upper limit according to the parameter PreSequenceDuration?

Thanks again!

Ray

mellinger
Posts: 1210
Joined: 12 Feb 2003, 11:06

Post by mellinger » 14 Apr 2010, 06:39

Ray,

if you want to be consistent with the PreSequenceDuration parameter, you can either
  • rely on the StimulusTask base class to do the counting for you, or
  • set the upper limit from the PreSequenceDuration parameter in the OnInitialize event handler.
For the first option, just check whether doProgress has been set to true from the base class (and note that you need to call Present() only once):

Code: Select all

void P3SpellerTask::DoPreSequence(const GenericSignal &, bool &doProgress) 
{ 
   mPreSeqCount +=1; // increment time-control counter 
   if(mPreSeqCount == 1) 
   { 
      for(int i= 0; i < mSequence.size(); i++) 
      { 
         Associations()[ mSequence.at(i) ].Present(); 
      } 
   } 
   if(doProgress == true)
   { 
      for(int i= 0; i < mSequence.size(); i++)    
      { 
         Associations()[ mSequence[i] ].Conceal(); 
      } 
   } 
}
For the second option, add an int member variable mPreSequenceDuration to the P3SpellerTask class, and set it from the OnInitialize() event handler as follows:

Code: Select all

mPreSequenceDuration = MeasurementUnits::ReadAsTime( Parameter( "PreSequenceDuration" ) );
--Juergen

Locked

Who is online

Users browsing this forum: No registered users and 23 guests