Difference between revisions of "Interacting with NIC"
Javier.acedo (talk | contribs) (→Sending Markers to NIC from other software or hardware) |
Javier.acedo (talk | contribs) (→Sending Markers to NIC from other software or hardware) |
||
Line 8: | Line 8: | ||
== Sending Markers to NIC from other software or hardware == | == Sending Markers to NIC from other software or hardware == | ||
+ | === Sending Markers using TCP/IP === | ||
<!-- talk about the marker server: port number, protocol --> | <!-- talk about the marker server: port number, protocol --> | ||
NIC provides a server that other software can connect to in order to receive markers. Those received markers are synchronized with the EEG streaming for further analysis. | NIC provides a server that other software can connect to in order to receive markers. Those received markers are synchronized with the EEG streaming for further analysis. | ||
Line 30: | Line 31: | ||
Please take as an example [[Media:Matlab Markers Example.zip | ''this'']] Matlab code which connects to NIC to send markers every time a tone is played back through the sound card. If you connected the output of the computer sound card to one of the Enobio electrodes you would be able to see the alignment between the markers and the played tones. | Please take as an example [[Media:Matlab Markers Example.zip | ''this'']] Matlab code which connects to NIC to send markers every time a tone is played back through the sound card. If you connected the output of the computer sound card to one of the Enobio electrodes you would be able to see the alignment between the markers and the played tones. | ||
+ | === Sending markers using LSL === | ||
<!-- talk about LSL client: string and integer markers --> | <!-- talk about LSL client: string and integer markers --> | ||
+ | NIC is compliant with the [https://code.google.com/p/labstreaminglayer/ Lab Streaming Layer (LSL)] protocol so makers can be co-registered with the EEG signal by setting up a LSL marker outlet (see this [https://code.google.com/p/labstreaminglayer/source/browse/LSL/liblsl/examples/C/SendStringMarkersC/SendStringMarkersC.c example]). | ||
+ | |||
+ | The LSL handles both the networking and time-synchronization isues between the sender and receiver hosts obtaining reliability on order of 1 ms (see the time-synchronization validation [https://code.google.com/p/labstreaminglayer/wiki/TimeSynchronizationValidation tests]). | ||
+ | |||
+ | [[File:NIC LSL settings.png|200px|thumb|left| NIC settings for configuring the reception of markers through LSL]] | ||
+ | NIC needs little configuration in order to receive the markers from a LSL outlet present in the local network. When the LSL marker outlet sends integer-type markers only the name of the outlet needs to be configured in NIC. | ||
+ | |||
+ | Please go to "''EEG Setup -> Settings -> Markers from Lab Streaming Layer''" and set the name that your LSL marker outlet has. NIC will automatically look for a marker outlet with this name and will connect to it. If the outlet sends integer-type integers then no further configuration is needed. All the received makers will be co-registered along with the EEG signal to the output files. | ||
+ | |||
+ | In case the outlet sends string-type markers then there are some considerations that have to be taken into account. The LSL outlet sending string-type markers has to format them as XML tags. The following example is taken from the string markers that the Presentation software sends when the LSL extension manager is installed (see the [[Event_Related_Potentials_(ERPs)#Presentation | Working with ERPs]] section). You can see that NIC will decode the string looking for the tag that is configured in the "''EEG Setup -> Settings -> Markers from Lab Streaming Layer''" settings, ''ecode'' in this case. | ||
+ | <pevent><etype>Picture</etype>'''<ecode>37</ecode>'''<unc>209.638092041016</unc>test</pevent> | ||
+ | |||
<!-- talk about TTL hardware triggering --> | <!-- talk about TTL hardware triggering --> | ||
Revision as of 10:11, 28 October 2013
In this page we describe how you can interact with NIC (Neuroelectrics Instrument Controller, the software for control with NE devices) using other software.
Contents
About Synchronization: general principles
Sending Markers to NIC from other software or hardware
Sending Markers using TCP/IP
NIC provides a server that other software can connect to in order to receive markers. Those received markers are synchronized with the EEG streaming for further analysis.
This NIC server is running in the TCP/IP port 1234. Up to five clients can simultaneously send markers to NIC by making a TCP/IP connection to this port.
Once a client is connected it needs to send the following string in order to send a marker:
<TRIGGER>XXXX</TRIGGER>
Where XXXX can represent any integer number different from zero (from -2147483647 to +2147483647). This marker will be co-registered in the output files generated by NIC to the corresponding EEG sample. For instance, in the output tabulated text file, there is a column just after the timestamp that is filled with zeros. When a marker is received its corresponding number is set to that column. See the following example:
... 26748 -27675 35631 42398 532666 64345 12376 40988 0 1382432459788 26865 -26683 35685 42450 532711 64821 12376 41046 0 1382432459790 26810 -26821 35531 41997 532821 64945 13164 41099 0 1382432459792 26749 -26995 35325 42008 532712 64377 13478 41286 0 1382432459794 26796 -27245 35932 42391 532923 64245 13620 41117 300 1382432459796 <-- Reception of the marker #300 26622 -27510 35501 42630 532876 64193 13031 40986 0 1382432459798 26751 -27912 35611 42003 532345 64344 12967 40731 0 1382432459800 ...
Please take as an example this Matlab code which connects to NIC to send markers every time a tone is played back through the sound card. If you connected the output of the computer sound card to one of the Enobio electrodes you would be able to see the alignment between the markers and the played tones.
Sending markers using LSL
NIC is compliant with the Lab Streaming Layer (LSL) protocol so makers can be co-registered with the EEG signal by setting up a LSL marker outlet (see this example).
The LSL handles both the networking and time-synchronization isues between the sender and receiver hosts obtaining reliability on order of 1 ms (see the time-synchronization validation tests).
NIC needs little configuration in order to receive the markers from a LSL outlet present in the local network. When the LSL marker outlet sends integer-type markers only the name of the outlet needs to be configured in NIC.
Please go to "EEG Setup -> Settings -> Markers from Lab Streaming Layer" and set the name that your LSL marker outlet has. NIC will automatically look for a marker outlet with this name and will connect to it. If the outlet sends integer-type integers then no further configuration is needed. All the received makers will be co-registered along with the EEG signal to the output files.
In case the outlet sends string-type markers then there are some considerations that have to be taken into account. The LSL outlet sending string-type markers has to format them as XML tags. The following example is taken from the string markers that the Presentation software sends when the LSL extension manager is installed (see the Working with ERPs section). You can see that NIC will decode the string looking for the tag that is configured in the "EEG Setup -> Settings -> Markers from Lab Streaming Layer" settings, ecode in this case.
<pevent><etype>Picture</etype><ecode>37</ecode><unc>209.638092041016</unc>test</pevent>