Difference between revisions of "Event Related Potentials (ERPs)"

From Neuroelectric's Wiki
Jump to: navigation, search
(Presentation Software)
(Presentation)
Line 7: Line 7:
 
In the following section we detail how some of the most relevant presentation software can be configured to send markers to NIC.
 
In the following section we detail how some of the most relevant presentation software can be configured to send markers to NIC.
 
== Presentation ==
 
== Presentation ==
 +
The [http://www.neurobs.com/ Presentation] software allows to connect to a remote application by using sockets in the [http://www.neurobs.com/pres_docs/html/03_presentation/01_getting_started/04_scenarios/02_pcl_programs.htm PCL program section] of an experiment scenario. This socket can be used to send markers to NIC every time a stimuli is presented. The following [[Media:DemoPresentationTriggerNIC.sce.txt | ''example'']] shows how to proceed in order to send markers to NIC.
 +
 +
scenario = "Sending triggers to NIC";
 +
 +
begin;
 +
 +
text { caption = "Hello world!"; font_size = 24; } hello;
 +
 +
picture {
 +
    text hello;
 +
    x = 0; y = 100;
 +
} hello_pic;
 +
 +
trial {
 +
    picture hello_pic;
 +
    time = 0;
 +
} hello_trial;
 +
 +
begin_pcl;
 +
 +
bool isConnected = false;
 +
# socket creation
 +
socket s = new socket();
 +
 +
hello.set_caption( "Connecting to trigger server..." );
 +
hello.redraw();
 +
hello_trial.set_duration( 1000 );
 +
hello_trial.present();
 +
 +
# Connect to the NIC server. The example assumes that NIC runs
 +
# on the same computer as Presentation. Change "localhost" by the IP or
 +
# computer's name where NIC is running. The NIC server runs on port 1234.
 +
# The time-out at 5 secs (5000 ms) can be changed according to your needs.
 +
# 8 bits for the codification and no ecryption.
 +
isConnected = s.open( "localhost", 1234, 5000, socket::ANSI , socket::UNENCRYPTED );
 +
if isConnected == true
 +
then
 +
hello_trial.set_duration( 3000 );
 +
loop
 +
int i = 1
 +
until
 +
i > 50
 +
begin
 +
hello.set_caption( "Sending trigger # " + string( i ) );
 +
hello.redraw();
 +
# The NIC server process a trigger whenever it receives
 +
# a string with the following format:
 +
# <TRIGGER>xxx</TRIGGER>
 +
# where xxx is any number different from zero.
 +
s.send("<TRIGGER>" + string( i ) + "</TRIGGER>");
 +
hello_trial.present();
 +
 +
i = i + 1
 +
    end
 +
else
 +
hello.set_caption( "Time out connecting to the server" );
 +
hello.redraw();
 +
hello_trial.present();
 +
end
 +
 +
The line
 +
''isConnected = s.open( "localhost", 1234, 5000, socket::ANSI , socket::UNENCRYPTED );''
 +
can be simplified to
 +
''isConnected = s.open();
 +
if the parameters are set in "Settings->Advanced->TCP/IP Defaults" [[File:Presentation tcpip settings.png|200px|thumb|left| TCP/IP configuration settings in the Presentation software]]
  
 
== ePrime ==
 
== ePrime ==

Revision as of 11:13, 25 October 2013

About Event Related Potentials (ERPs)

Presentation Software

There are several software that can set-up an experiment which presents some stimulus (audio, images, video, etc.) to a subject in order to elicit ERPs in the EEG signal. It is very important that the recorded EEG data is synchronized with those stimulus in order to detect the ERPs when analyzing the data. The NIC software provides the basic infrastructure to receive those markers from this kind of software every time a stimuli is presented. Please refer to the Interacting_with_NIC section for the details on how NIC handles the reception of the markers.

In the following section we detail how some of the most relevant presentation software can be configured to send markers to NIC.

Presentation

The Presentation software allows to connect to a remote application by using sockets in the PCL program section of an experiment scenario. This socket can be used to send markers to NIC every time a stimuli is presented. The following example shows how to proceed in order to send markers to NIC.

scenario = "Sending triggers to NIC";

begin;

text { caption = "Hello world!"; font_size = 24; } hello;

picture {
   text hello;
   x = 0; y = 100;
} hello_pic;

trial {
   picture hello_pic;
   time = 0;
} hello_trial;

begin_pcl;

bool isConnected = false;
# socket creation
socket s = new socket();

hello.set_caption( "Connecting to trigger server..." );
hello.redraw();
hello_trial.set_duration( 1000 );
hello_trial.present();

# Connect to the NIC server. The example assumes that NIC runs
# on the same computer as Presentation. Change "localhost" by the IP or
# computer's name where NIC is running. The NIC server runs on port 1234.
# The time-out at 5 secs (5000 ms) can be changed according to your needs.
# 8 bits for the codification and no ecryption.
isConnected = s.open( "localhost", 1234, 5000, socket::ANSI , socket::UNENCRYPTED );
if isConnected == true
then
	hello_trial.set_duration( 3000 );
	loop
		int i = 1
	until
		i > 50
	begin
		hello.set_caption( "Sending trigger # " + string( i ) );
		hello.redraw();
		# The NIC server process a trigger whenever it receives 
		# a string with the following format:
		# <TRIGGER>xxx</TRIGGER>
		# where xxx is any number different from zero.
		s.send("<TRIGGER>" + string( i ) + "</TRIGGER>");
		hello_trial.present();
	
		i = i + 1
   end
else
	hello.set_caption( "Time out connecting to the server" );
	hello.redraw();
	hello_trial.present();
end

The line

isConnected = s.open( "localhost", 1234, 5000, socket::ANSI , socket::UNENCRYPTED );

can be simplified to

isConnected = s.open();

if the parameters are set in "Settings->Advanced->TCP/IP Defaults"

TCP/IP configuration settings in the Presentation software

ePrime