Control of BESA Research by external programs

From BESA® Wiki
Revision as of 09:26, 5 May 2021 by Robert (Talk | contribs)

(diff) ← Older revision | Approved revision (diff) | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search
Module information
Modules BESA Research Basic or higher
Version 5.2.2 or higher

Purpose and Procedure

This document describes how to start BESA Research from an external program (a patient database management program or an EEG review program) with a list of one or more files to be opened in BESA Research. It is recommended to create an icon BESA or BESA Research in the external program and to start BESA Research using this icon.

We recommend using the procedure described in Start BESA Research to open EEG data, since this will work in all cases, and the foc_link.sub file can be located in any arbitrary folder.

Start BESA Research to open EEG data

Use the following command to start BESA Research with the command line parameter: <foc_link.sub file path>\foc_link.sub The foc_link.sub file contains a list of the datasets to be loaded at program start. The file format is described below in Format of foc_link.sub. For example, to load EEGs in BESA 5.2.2 or higher (e.g. BESA Research 5.3) at program start (assumed to be installed in C:\BESA52 and file foc_link.sub file located in the BESA Research installation folder), apply the following command:

C:\BESA52\BESA.exe C:\BESA52\foc_link.sub

Open EEG data while BESA Research is running

If you want to load a different EEG data file while BESA Research is running, simply execute the same command as upon start of BESA Research after updating the file list in foc_link.sub, e.g. C:\BESA52\BESA.exe C:\BESA52\foc_link.sub BESA.exe interprets this call from a database or review program. It checks whether BesaMain.exe is already running. If yes, it keeps BesaMain.exe running, closes the old files, and opens the new file(s) listed in foc_link.sub. If not yet running, BESA.exe starts BesaMain.exe with the new file(s) listed in foc_link.sub. Thus, the procedure for changing an EEG file in BESA Research is the same as described in Start BESA Research to open EEG data for starting BESA Research with the first file(s).

( In older BESA versions (up to version 5.2) a different procedure was required that is still working but not required anymore: When BESA receives a WM_COMMAND message with Id 3000 (Id = (int)(LOWORD(wParam)), file foc_link.sub in the BESA installation folder was reread. While this feature is still working, it is not recommended anymore because the automatic handling by BESA.exe is much simpler and no WM_COMMAND message is needed. ) Notes:

  • Files that are currently open but not specified in foc_link.sub are closed. Only the specified files are opened.
  • When a file is closed in BESA Research, the corresponding entry in the foc_link.sub file is deleted.

Format of foc_link.sub

For each EEG to be loaded write the following lines to the foc_link.sub file StartedBy: <Your program name> EvtFilePath: <path + filename of the evt-File to be loaded for the EEG> EventCode: [<number>] <number> <number> ElecFilePath: <path + filename of the elp-File to be loaded for the EEG> ReviewDateTime: <YYYY-MM-DD/HH:MM:SS> FilePath: <path + filename of EEG to be loaded>

The first line, StartedBy (followed by a colon and a blank), is an optional tag that can be set to specify the name of your application which calls BESA Research. The second line, EvtFilePath (followed by a colon and a blank), is an optional tag that can be set to load events specified in an evt-file. If this tag is not defined, only the events found in the EEG data file are loaded. The third line, EventCode (followed by a colon and a blank), is an optional tag that can be set to define the type and range of your events stored in the event file specified in EvtFilePath. The first number defines the code (type) of your events (e.g. 1=Trigger). The second number defines the event ID range minimum and the third number stands for the maximum. If this tag is defined, BESA Research will remove all events from the EEG which IDs are within the defined range. Then the new events are loaded instead. If this tag is not defined, the new events are loaded in addition to existing events. This tag will be ignored if no EvtFilePath is defined. The fourth line, ElecFilePath (followed by a colon and a blank), is an optional tag that can be set to attach an electrode configuration specified in an elp-file. If this tag is not defined, the original/recorded electrode configuration found in the EEG-Data file is loaded. The fifth line, ReviewDateTime (followed by a colon and a blank), is an optional tag that can be set to specify a time at which the review should be started. If this tag is not defined, the review starts at the beginning of the file. The FilePath line must be the last line for each EEG entry and has to be defined. The tag is followed by path+filename (after the obligatory colon and blank). A maximum of 256 characters for path+filename is read.

Examples

Open one EEG data file at the beginning.

FilePath: D:\EEG\000822WC.eeg

Open one EEG data file at a defined position.

ReviewDateTime: 2008-07-02/12:18:12
FilePath: D:\EEG\000822WC.eeg

Open three EEG data files, position for second data file is specified.

FilePath: D:\EEG\000822WC.eeg
 
ReviewDateTime: 2008-07-02/12:18:12
FilePath: D:\EEG\000822WD.eeg
 
FilePath: D:\EEG\000822WE.eeg

We suggest to separate single EEG entries by an empty line, although this is not required.

Complete foc_link.sub entry with all possible tags

StartedBy: BESA Epilepsy
ElecFilePath: C:\ELP-FILES\000717WA-STD.elp
EvtFilePath: C:\EVT-FILES\000717WA-STD.evt
EventCode: 1 51 60
ReviewDateTime: 2008-07-02/14:20:12
FilePath: D:\EEG\000717WA.eeg