Page 1 of 1

Error in parameters file

Posted: 24 Jun 2010, 23:50
by nadu
Hi !

I am running the BCI2000 v2.0. I am trying to run a P300 Web browser application. My application is able to connect to the Operator module.
However when I load the parameters file and click "set config", it throws an error -
- Row index out of range when accessing a parameter value, terminating Application module.

My parameters file is pasted below -

Code: Select all


System:Configuration matrix OperatorVersion= { Framework Revision Build } 1 2.0 2671,%202010/02/16%2016:38:00 2010/02/17%2019:12:12 // operator module version information
System:State%20Vector int StateVectorLength= 11 16 1 30 // length of the state vector in bytes
Source:Signal%20Properties:DataIOFilter int SourceCh= 16 16 1 % // number of digitized and stored channels
Source:Signal%20Properties:DataIOFilter int SampleBlockSize= 8 32 1 % // number of samples transmitted at a time
Source:Signal%20Properties:DataIOFilter int SamplingRate= 256 256Hz 1 % // sample rate
Source:Signal%20Properties:DataIOFilter list ChannelNames= 0 // list of channel names
Source:Signal%20Properties:DataIOFilter floatlist SourceChOffset= 16 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 % % // Offset for channels in A/D units
Source:Signal%20Properties:DataIOFilter floatlist SourceChGain= 16 0.033 0.033 0.033 0.033 0.033 0.033 0.033 0.033 0.033 0.033 0.033 0.033 0.033 0.033 0.033 0.033 0.003 % % // gain for each channel (A/D units -> muV)
Storage:Data%20Location:DataIOFilter string DataDirectory= ..\data\P300 ..\data % % // path to top level data directory (directory)
Storage:Session:DataIOFilter string SubjectName= test Name % % // subject alias
Storage:Session:DataIOFilter string SubjectSession= 001 001 % % // three-digit session number
Storage:Session:DataIOFilter string SubjectRun= 00 00 % % // two-digit run number
Storage:Documentation:DataIOFilter string ID_System= % // BCI2000 System Code
Storage:Documentation:DataIOFilter string ID_Amp= % // BCI2000 Amp Code
Storage:Documentation:DataIOFilter string ID_Montage= % // BCI2000 Cap Montage Code
Visualize:Timing:DataIOFilter int VisualizeTiming= 1 1 0 1 // visualize system timing (0=no, 1=yes) (boolean)
Visualize:Source%20Signal:DataIOFilter int VisualizeSource= 1 1 0 1 // visualize raw brain signal (0=no, 1=yes) (boolean)
Visualize:Source%20Signal:DataIOFilter int VisualizeSourceDecimation= 1 1 1 % // decimation factor for raw brain signal
Visualize:Source%20Signal:DataIOFilter int VisualizeSourceTime= 2 2 0 % // how much time in Source visualization
Visualize:Source%20Signal:DataIOFilter int SourceMin= -100muV -100muV % % // raw signal vis Min Value
Visualize:Source%20Signal:DataIOFilter int SourceMax= 100muV 100muV % % // raw signal vis Max Value
Source:SignalGeneratorADC int ModulateAmplitude= 1 0 0 1 // Modulate the amplitude with the mouse (0=no, 1=yes) (boolean)
Source:SignalGeneratorADC int SineChannelX= 0 0 0 % // Channel number of sinewave controlled by mouse x position
Source:SignalGeneratorADC int SineChannelY= 0 0 0 % // Channel number of sinewave controlled by mouse y position (0 for all)
Source:SignalGeneratorADC int SineChannelZ= 0 0 0 % // Channel number of sinewave controlled by mouse key state
Source:SignalGeneratorADC float SineFrequency= 10 10Hz % % // Frequency of sine wave
Source:SignalGeneratorADC int SineAmplitude= 100muV 100muV % % // Amplitude of sine wave
Source:SignalGeneratorADC int NoiseAmplitude= 30muV 30muV % % // Amplitude of white noise (common to all channels)
Source:SignalGeneratorADC int DCOffset= 60muV 0muV % % // DC offset (common to all channels)
Source:SignalGeneratorADC string OffsetMultiplier= StimulusType StimulusType % % // Expression to multiply offset by
Source:SignalGeneratorADC int RandomSeed= 0 0 0 1 // Initialization value for random number generator (initialize from time if 0)
Source:SignalGeneratorADC int SignalType= 0 0 0 2 // numeric type of output signal:  0: int16, 1: float32, 2: int32 (enumeration)
Storage:Documentation:BCI2000FileWriter int SavePrmFile= 0 1 0 1 // save additional parameter file (0=no, 1=yes) (boolean)
Storage:Documentation:BCI2000FileWriter string StorageTime= % // time of beginning of data storage
Source:Alignment:AlignmentFilter int AlignChannels= 1 0 0 1 // align channels in time (0=no, 1=yes)
Source:Alignment:AlignmentFilter floatlist SourceChTimeOffset= 0 0 % % // time offsets for all source channels (may be empty)
Source:Online%20Processing:TransmissionFilter list TransmitChList= 4 1 2 3 4 // list of transmitted channels
System:Core%20Connections string SignalSourcePort= 53915 4200 1024 65535 // the SignalSource module's listening port
System:Core%20Connections string SignalSourceIP= 143.215.100.52 127.0.0.1 % % // the SignalSource module's listening IP
System:Configuration matrix SignalSourceVersion= { Framework Revision Build } 1 2.0 2671,%202010/02/16%2016:38:00 2010/02/17%2019:12:12 // SignalSource version information
System:Configuration matrix SignalSourceFilterChain= 8 { Filter%20Name Position%20String } DataIOFilter 0 SignalGeneratorADC 1 NullFileWriter 1 BCI2000FileWriter 1 EDFFileWriter 1 GDFFileWriter 1 AlignmentFilter 1.1 TransmissionFilter 1.2 // SignalSource filter chain
Visualize:Processing%20Stages int VisualizeAlignmentFilter= 0 0 0 1 // Visualize AlignmentFilter output (boolean)
Visualize:Processing%20Stages int VisualizeTransmissionFilter= 0 0 0 1 // Visualize TransmissionFilter output (boolean)
Filtering:SpatialFilter int SpatialFilterType= 0 2 0 3 // spatial filter type 0: none, 1: full matrix, 2: sparse matrix, 3: common average reference (CAR) (enumeration)
Filtering:SpatialFilter:SpatialFilter intlist SpatialFilterCAROutput= 0 // list of output channels for the CAR if used
Filtering:SpatialFilter:SpatialFilter matrix SpatialFilter= 4 4 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 % % // columns represent input channels, rows represent output channels
Filtering:P3TemporalFilter int EpochLength= 600ms 500ms 0 % // Length of data epoch from stimulus onset
Filtering:P3TemporalFilter int EpochsToAverage= 3 1 0 % // Number of epochs to average
Visualize:P3TemporalFilter int VisualizeP3TemporalFiltering= 1 0 0 1 // Visualize averaged epochs (0=no 1=yes) (boolean)
Visualize:P3TemporalFilter int TargetERPChannel= 1 1 % % // Input channel for which to display ERP data
Filtering:LinearClassifier matrix Classifier= 2 { input%20channel input%20element%20(bin) output%20channel weight } 1 4 1 1 1 6 2 1 // Linear classification matrix in sparse representation
System:Core%20Connections string SignalProcessingPort= 53916 4200 1024 65535 // the SignalProcessing module's listening port
System:Core%20Connections string SignalProcessingIP= 143.215.100.52 127.0.0.1 % % // the SignalProcessing module's listening IP
System:Configuration matrix SignalProcessingVersion= { Framework Revision Build } 1 2.0 2671,%202010/02/16%2016:38:00 2010/02/17%2019:12:12 // SignalProcessing version information
System:Configuration matrix SignalProcessingFilterChain= 3 { Filter%20Name Position%20String } SpatialFilter 2.A P3TemporalFilter 2.B LinearClassifier 2.C // SignalProcessing filter chain
Visualize:Processing%20Stages int VisualizeSpatialFilter= 0 0 0 1 // Visualize SpatialFilter output (boolean)
Visualize:Processing%20Stages int VisualizeLinearClassifier= 0 0 0 1 // Visualize LinearClassifier output (boolean)
Connector:ConnectorInput list ConnectorInputFilter= 1 * // list of state names or signal elements to allow, "*" for any, signal elements as in "Signal(1,0)"
Connector:ConnectorInput string ConnectorInputAddress= localhost:20320 localhost:20320 % % // IP address/port to read from, e.g. localhost:20320
P300BrainBrowser:Window:WebBrowserTask int NumberOfSequences= 3 15 1 % // Number of stimuli sequences presented to the user
P300BrainBrowser:Window:WebBrowserTask int PostSetInterval= 120 60 0 10000 // Duration after set of n intensifications in units of SampleBlocks
P300BrainBrowser:Window:WebBrowserTask int PreSetInterval= 60 60 0 10000 // Duration before set of n intensifications in units of SampleBlocks
P300BrainBrowser:Window:WebBrowserTask int OnTime= 4 10 0 5000 // Duration of intensification in units of SampleBlocks
P300BrainBrowser:Window:WebBrowserTask int OffTime= 1 10 0 5000 // Interval between intensification in units of SampleBlocks
P300BrainBrowser:Window:WebBrowserTask int OnlineMode= 1 0 0 1 // Online mode (0=no, 1=yes) (boolean)
P300BrainBrowser:Window:WebBrowserTask string HomeUrl= http://www.google.com // The URL of the document the browser should initially load
P300BrainBrowser:Window:WebBrowserTask string TargetIds= % // Space delimited list of the XHTML id attributes of the HTML elements the user should target (if online mode is unchecked)
P300BrainBrowser:Window:WebBrowserTask int StimulusFlashStyle= 1 0 0 2 // The style of stimulus flash  0 = Box 1 = Bitmap 2 = Inverse (enumeration)
P300BrainBrowser:Window:WebBrowserTask int StimulusFlashAlpha= 255 255 0 255 // The opacity level of the stimulus
P300BrainBrowser:Window:WebBrowserTask string StimulusFlashBorderColor= 0x00FFFF 0x00FFFF 0x000000 0xFFFFFF // The border color of the stimulus box (color)
P300BrainBrowser:Window:WebBrowserTask string StimulusFlashFillColor= 0x00FFFF 0x00FFFF 0x000000 0xFFFFFF // The fill color of the stimulus box (color)
P300BrainBrowser:Window:WebBrowserTask string StimulusFlashBitmap= % // Path to a bitmap to be used as the stimulus flash
P300BrainBrowser:Window:WebBrowserTask int FeedbackDuration= 2s 2s % % // Duration of a feedback trial
ConfigConnector:ConfigConnectorFilter string ConfigurationOutputAddress= localhost:20323 // IP address to send this configuration data, e.g. localhost:20323
Connector:ConnectorOutput string ConnectorOutputAddress= localhost:20321 localhost:20320 % % // IP address/port to write to, e.g. localhost:20320
System:Core%20Connections string ApplicationPort= 53918 4200 1024 65535 // the Application module's listening port
System:Core%20Connections string ApplicationIP= 143.215.100.52 127.0.0.1 % % // the Application module's listening IP
System:Configuration matrix ApplicationVersion= { Framework Revision Build } 1 2.0 2671,%202010/02/16%2016:38:00 17:27:42%20Jun%2018%202010 // Application version information
System:Configuration matrix ApplicationFilterChain= 4 { Filter%20Name Position%20String } ConnectorInput 2.9999 WebBrowserTask 3 ConfigConnectorFilter 3.1 ConnectorOutput 3.9999 // Application filter chain
Visualize:Processing%20Stages int VisualizeConfigConnectorFilter= 0 0 0 1 // Visualize ConfigConnectorFilter output (boolean)
Any help on where I m going wrong would really help!

thanks!
nadu

Posted: 25 Jun 2010, 08:45
by mellinger
Nadu,

it appears that your code tries to read a parameter value at a non-existing row index. You will need to find a place in the code that looks like

Code: Select all

int myValue = Parameter("MyParameter")(row, col);
and fix the erroneous row index.

--Juergen

Posted: 01 Jul 2010, 13:17
by nadu
Hi Juergen !

Stepping through the code I found out that the code breaks down at -

This is the ConnectorFilter code modified -

Code: Select all

// send configuration data
for( int parameter = 0; parameter < Parameters->Size(); ++parameter )
{
		string parameterName = ( *Parameters )[ parameter ].Name();
		mConnection << parameterName << ' '
			<< Parameter( parameterName.c_str() ) << endl;
}
It breaks down when the parameterName = ChannelNames

I know this is vague, but any direction that you can suggest with your experience will be great

thanks
nadu

Posted: 02 Jul 2010, 08:27
by mellinger
Hi Nadu,

in your code, you send out each parameter's value at index (0,0), by referring to Parameter( parameterName ) without specifying any indices. Thus, you assume that each parameter has at least one value, and this assumption breaks down at the first parameter that is empty.

For a quick fix to this problem, you might write

Code: Select all

if( Parameter( parameterName )->NumValues() > 0 )
  mConnection << ...
Best,
Juergen

Thanks a lot !

Posted: 02 Jul 2010, 12:47
by nadu
Juergen, thanks a ton!

It worked.

cheers
nadu

Re: Error in parameters file

Posted: 01 Apr 2011, 15:20
by nadu
Hi Juergen,

I have a Neural Browser application that is sending configuration data to BCI2000 in the following manner

Code:

Code: Select all

// send configuration data
for( int parameter = 0; parameter < Parameters->Size(); ++parameter )
{
      string parameterName = ( *Parameters )[ parameter ].Name();
      mConnection << parameterName << ' '
         << Parameter( parameterName.c_str() ) << endl;
      // for logging 
      bcierr << "Parameter name = "<< parameterName<<endl;
      bcierr << "Value= " <<Parameter( parameterName.c_str() )<<endl;

}
The output that I see in the log for the Classifier parameter is "1", thats the first element of the matrix (of 559 elements) that I have. Is there another way to send all the matrix values?
Similarly for the Parameter name = ChannelNames, output I see is F3 in the log, whereas I have F3 F4 C3 C4 P3 P4 F7 F8 T7 T8 P7 P8 FZ CZ OZ PZ in my parameter file.

Is this correct way to pass values to BCI 2000. Any help/direction would be really helpful.

/** Update **/
Parameters of type ParamRef. Can that be an issue?

Thanks
nadu

Re: Error in parameters file

Posted: 04 Apr 2011, 08:46
by mellinger
Hi Nadu,

I'm not sure whether I understand the context of your question. Are you sending parameters to BCI2000? If yes, over what interface? Also, you use the Environment::Parameter() function, and the Parameters object, which are available in BCI2000 filters. Why do you want to send parameters to BCI2000 from a BCI2000 filter, i.e. from inside BCI2000? Where does the mConnection stream connect to? On that stream, you are using your own parameter format rather than the BCI2000 "parameter line" format, so it appears you are not sending parameters to BCI2000 but somewhere else.

Also, by using the Environment::Parameter() function the way you do, you are sending only the first value of each parameter. To send multiple parameter values, use Parameter( name )( index ), or Parameter( name )( row, column ), but you need to iterate over indices, and in your parameter message, you must somehow send the number of values, or the number of rows and columns, for the parameter as well, i.e. you need to change your self-defined format to accommodate that extra information. Parameter dimensions are available using Parameter( name )->NumValues(), Parameter( name )->NumRows(), and Parameter( name )->NumColumns().

Hope this helps,
Juergen