The Cambridge Electronic Design File System (CFS) is the file format used by the Signal Software Suite to record electrophysiological data, such as data from Transcranial Magnetic Stimulation experiments.
CED distributes a C library to read and write these files. However, this library only compiles on Windows. This library is an attempt to reimplement part of CED's CFS library using only platform-agnostic code compliant with the C standard. Some outdated features will be dropped, such as support for MS-DOS, or near/far pointers for 16-bit segmented memory architectures.
This library is intended for programmers who would like to add support for reading CED CFS files to a language, e.g., using the language's FFI. If you want a user-friendly way to read CFS files, I recommend the python wrapper for this project, pythonCFS, which can be easily installed using pip.
Re-implement the read-only parts of CED's public API.
Ensure CMake version 3.22 or later is installed.
git clone https://github.com/m0ose01/cfs.git && cd cfs
mkdir build && cd build
cmake ..
cmake --build .This will produce 2 binary files:
libcfsapi.so, a shared library containing a number of the CFS routines.cfstocsv, a command line program to convert CFS files to CSV format.
cfstocsv takes a CFS file as its first argument, and emits a csv file, containing the channel data for each data section.
./cfstocsv <filename> <output>
If the second argument is omitted, output goes to stdout.
libcfsapi.so can be used as a drop-in replacement for the CFS32.dll file provided by CED in some cases.
The following functions from the CFS library have been implemented.
- OpenCFSFile
- CloseCFSFile
- GetGenInfo
- GetFileInfo
- GetFileChan
- GetDSChan
- GetChanData
- GetVarDesc
- GetVarVal
This project is currently a work-in-progress, and should not yet be used in a real research environment. Currently, only reading of 32-bit 'equalspaced' integer channel data is supported/tested. This is something I would like to rectify in the future if possible, by generating test files with the original CFS library.