Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision Both sides next revision
development:realtime:ctf [2018/10/21 15:06]
42.49.180.224 [CTF]
development:realtime:ctf [2018/06/19 09:16] (current)
robert [Different software versions]
Line 16: Line 16:
 Multiple real-time interfaces have been developed over the years. The first version (ctf2ft_v1, originally known as AcqBuffer) only maintains the shared memory to allow it to be used as an ever-lasting ring buffer, but does not copy the data to the FieldTrip buffer. This version can be used in combination with the **ft_realtime_ctfproxy.m** function in MATLAB running on the acquisition computer. The header details must be read from the res4 file on the local filesystem. Although now **deprecated**,​ this is explained in more detail further down on this page.  Multiple real-time interfaces have been developed over the years. The first version (ctf2ft_v1, originally known as AcqBuffer) only maintains the shared memory to allow it to be used as an ever-lasting ring buffer, but does not copy the data to the FieldTrip buffer. This version can be used in combination with the **ft_realtime_ctfproxy.m** function in MATLAB running on the acquisition computer. The header details must be read from the res4 file on the local filesystem. Although now **deprecated**,​ this is explained in more detail further down on this page. 
  
-====== CTF ======+==== Network-transparent interface ​==== 
 + 
 +The second version (ctf2ft_v2, originally known as acq2ft) combines the access to shared memory with copying to the FieldTrip buffer to make the data available elsewhere on the network. It operates by grabbing one packet (setup or data) at a time out of the shared memory, and more or less directly transferring it into a FieldTrip buffer that is started by the **ctf2ft_v2** application itself, or a buffer that is running separately on the same computer or elsewhere on the network. 
 + 
 +The **ctf2ft_v2** application decodes header information from the **.res4** file pointed to by the //setup collection//​ packet, and thus knows by itself which channels contain triggers instead of relying on a 3rd application or Matlab script to write that information back to shared memory. On top of that, ** ctf2ft_v2** overallocates the shared memory by 1000 samples and is prepared to operate successfully even if the proprietary **Acq** application writes too much data into any slot. Instead of preparing the shared memory segment for access by a third application,​ it streams the data and events (decoded from the trigger channels) to a local or remote [[development:​realtime:​buffer|FieldTrip buffer]], as depicted by the following diagram: 
 + 
 +{{:​development:​realtime:​acq2ft_scheme_75.png|}} 
 + 
 +You need to start **ctf2ft_v2** before starting **Acq** so that the shared memory interface can be detected and connected to by the latter. 
 +You have the option of spawning a [[development:​realtime:​buffer|FieldTrip buffer]] server directly within **ctf2ft_v2**,​ using 
 +<​code>​ 
 +ctf2ft_v2 
 +</​code>​ 
 +to use the default port 1972, or using (note the minus) 
 +<​code>​ 
 +ctf2ft_v2 - port 
 +</​code>​ 
 +to spawn at server at the given ''​port''​. You can also tell **ctf2ft_v2** to stream the data to a buffer provided by another application (possibly on another machine), using 
 +<​code>​ 
 +ctf2ft_v2 hostname port 
 +</​code>​ 
 +Please note that for this to work, you will need to start up the remote buffer //before// **ctf2ft_v2**. 
 +Once **ctf2ft_v2** is happily up and running, you can start **Acq** from a different command line or using existing GUI tools. 
 + 
 +Since streaming the data to a remote [[development:​realtime:​buffer|FieldTrip buffer]] might incur a delay due to network traffic, **ctf2ft_v2** employs an internal ring buffer 
 +for up to 10 data packets and a simple (socket pair) mechanism to synchronize between copying data packets from the shared memory to the internal ring buffer, and streaming the data from the ring buffer to the [[development:​realtime:​buffer|FieldTrip buffer]]. This means that small delays should not interfere with the time-critical operation of clearing up slots in the shared memory segment, as long as the average throughput is high enough. 
 ==== Downsampling,​ channel selection, applying gains ==== ==== Downsampling,​ channel selection, applying gains ====