The CTF/Neuromag acquisition software provides a shared memory in which the the data from the MEG channels and all auxiliary channels are available in real-time. The acq2ftx/neuromag2ft application transfers this data from the shared memory to a FieldTrip buffer on the acquisition computer. Matlab software running on another computer can then be used to analyze the real-time data. See the getting started page for setting up this interface on your MEG system.
Stolk A, Todorovic A, Schoffelen JM, Oostenveld R. Online and offline tools for head movement compensation in MEG. Neuroimage. 2013 Mar;68:39-48. doi: 10.1016/j.neuroimage.2012.11.047.
After initializing the MEG system, one starts the acq2ftx/neuromag2ft application. When subsequently starting Acquisition, the data is transferred in realtime to the FieldTrip buffer which can be read from any computer connected through a network. Point to the location of the buffer by correctly specifying cfg.dataset:
cfg = ; cfg.dataset = 'buffer://hostname:1972'; % get data from buffer ft_realtime_headlocalizer(cfg)
Repositioning within a recording session can be achieved by marking the head position indicator (HPI) coil positions at an arbitrary point in time, operationalized through clicking the 'Update' button. Black unfilled markers should appear which indicate the positions of the coils at the moment of buttonpress. Distance to these marked positions then become colorcoded.
Repositioning between a recording session, i.e. to a previous recording session, can be achieved by specifying cfg.template. Either by pointing to another dataset; e.g. cfg.template = 'subject01xxx.ds' (CTF275 systems only), or by pointing to a textfile created by clicking the Update button during a previous recording session; e.g. cfg.template = '29-Apr-2013-xxx.txt' (CTF275 and Neuromag systems).
Figure 1; Top (left plot) and back view (right plot) of the subject's head. Nasion is represented by a triangular marker and both aurical points by circular markers. To aid the subject with repositioning, the real-time fiducial positions are color coded to indicate the distances to the targets (green < 1.5 mm, orange < 3 mm, and red > 3 mm). If all three markers are within limits, the head turns lightblue (CTF only). Click on the image for the animation.
The above online head localization procedure can substantially reduce the influence of head movement within a session, e.g. using short repositioning instructions between experimental blocks, and also allows for accurate repositioning between sessions. However, residual head movement is likely to negatively impact statistical sensitivity and one may want to consider to incorporate information about these head movements into the offline analysis. For instance, incorporation of head position time-series into the general linear model, using ft_regressconfound, has been found to improve statistical sensitivity up to 30%.
In stead of reading data from the shared memory, one now reads data from a previously recorded MEG dataset. This can be done offline, on any computer running a recent version of Matlab.
cfg.bufferdata = 'first'; % read data from first until last segment cfg.template = 'previousdataset.ds'; cfg.dataset = 'previousdataset.ds'; ft_realtime_headlocalizer(cfg)
1) 'Initialize the MEG system'.
2) 'Start acq2ftx for real-time head localization'.
3) 'Start Acq'. You should see activity in the terminal in which acq2ftx is running.
4) Start Matlab on the 'real-time computer' by typing on the linux command line
5) Visualize the subject's head in real-time. At the Donders, Odin is the default FieldTrip buffer location and therefore, cfg.dataset does not need specification.
cfg = ; ft_realtime_headlocalizer(cfg)
*6) You can project the head localizer into the MSR by one buttonclick. Click the left button on the video matrix and the signal from the presentation computer is being overwritten by the head localizer computer. This way both experimenter and subject get to see the virtual representation of the subject's head.
*7) You can also reposition the subject according to a previous session. The headlocalizer dedicated computer has access to Odin's data directory, and thus, the headcoil coordinates. This is the .hc file, located in the .ds directory. Specify the template as follows and run the headlocalizer which should give you the markers from the start.
cfg.template = '/mnt/megdata/20100812/ArjSto_1200hz_20100812_01.ds'; ft_realtime_headlocalizer(cfg)
Keep in mind that Odin's data directory is automatically cleaned every now and then. If your template dataset has been removed, you could still read it from your own M disk in case you have backed it up there. Logout the meg user on the headlocalizer dedicated computer and login as yourself. Now run the headlocalizer with specifying the file location on your M disk (e.g. cfg.template = '/home/action/arjsto/MEG/ArjSto_1200hz_20100812_01.ds').