You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
# Libxdf – a C++ library for loading [XDF](https://github.com/sccn/xdf/wiki/Specifications"Extensible Data Format") files
1
+
# LibXDF – a C++ library for loading XDF files
2
2
3
-
[](http://www.repostatus.org/#active)
LibXDF is a cross-platform C++ library for loading multimodal signals stored in [XDF](https://github.com/sccn/xdf/wiki/Specifications"Extensible Data Format") files.
4
+
It is used in the biosignal viewing application [SigViewer](https://github.com/cbrnr/sigviewer) and the LSL application [XDFStreamer](https://github.com/labstreaminglayer/App-XDFStreamer/) and can also be integrated into other C++ applications.
5
5
6
-
*[Introduction](#intro)
7
-
*[Quick-Start Guide](#quick)
8
-
*[Download](#download)
9
-
*[Documentation](#doc)
10
-
*[Reference](#reference)
11
-
*[Support](#support)
12
6
7
+
## Quick start
13
8
14
-
## <aname="intro"></a>Introduction
9
+
The source code and prebuilt binaries are available as [releases](https://github.com/Yida-Lin/libxdf/releases) (you may need to expand the list of assets to find the downloads).
15
10
16
-
Libxdf is a cross-platform C++ library for loading multimodal, multi-rate signals stored in [XDF](https://github.com/sccn/xdf/wiki/Specifications"Extensible Data Format") files.
17
-
Libxdf is used in the biosignal viewing application [SigViewer](https://github.com/cbrnr/sigviewer) and the LSL application [XDFStreamer](https://github.com/labstreaminglayer/App-XDFStreamer/). It can also be integrated into other C++ applications.
18
-
19
-
Libxdf is open-source, free, and actively maintained.
20
-
21
-
## <aname="quick"></a>Quick-Start Guide
22
-
23
-
### <aname="download"></a>Download
24
-
25
-
* Find Source and Prebuilt Binaries on the [releases page](https://github.com/Yida-Lin/libxdf/releases).
26
-
* You may need to expand the list of Assets to find the downloads.
27
-
* For Linux Debian (Ubuntu) users: `sudo dpkg -i libxdf-{version}-Linux.deb`
28
-
* For Windows and Mac users: simply extract the archive somewhere convenient.
29
-
30
-
### Building libxdf
31
-
32
-
If the release does not have assets for your platform or they do not work for you for some other reason, then
33
-
Libxdf can be conveniently built either using `qmake` or `cmake`. Configuration files for both build tools are included with the source.
34
-
35
-
To build with cmake from command prompt / terminal:
11
+
If a particular release does not have assets for your platform or they do not work for you for some other reason, then
12
+
libXDF can be built with [CMake](https://cmake.org) using the following two commands:
variable (e.g. add `-DBUILD_SHARED_LIBS=ON` to the first cmake command above).
19
+
This builds and installs a static library in `./build/install`, but you can build a shared library by adding `-DBUILD_SHARED_LIBS=ON` to the first CMake command.
46
20
47
-
### Use in conjunction with [SigViewer](https://github.com/cbrnr/sigviewer)
48
21
49
-
Libxdf is a built-in component of [SigViewer](https://github.com/cbrnr/sigviewer). If you wish to build SigViewer from source, follow these steps:
22
+
## Integrating into C++ applications
50
23
51
-
1. Download `xdf.h` and `libxdf.a` from the [release](https://github.com/Yida-Lin/libxdf/releases) page.
52
-
2. Copy `xdf.h` into `sigviewer/external/include`
53
-
3. Copy `libxdf.a` into `sigviewer/external/lib`
54
-
4. Build and run Sigviewer
24
+
If you want to use libXDF in C++ applications, follow these steps:
55
25
26
+
1. Install a prebuilt binary release or build libXDF from source as described above.
27
+
2. If you use CMake, add the following lines to your `CMakeLists.txt` to find and link against libXDF:
56
28
57
-

29
+
```CMake
30
+
find_package(libxdf REQUIRED
31
+
HINTS ${XDF_INSTALL_ROOT}
32
+
PATH_SUFFIXES share
33
+
)
34
+
target_link_libraries(${PROJECT_NAME}
35
+
PRIVATE
36
+
# ... other dependencies
37
+
XDF::xdf
38
+
)
39
+
```
58
40
59
-
Example: SigViewer using _libxdf_ to display signals in an XDF file.
41
+
If `libxdf` is not in a standard system library location, pass `-DXDF_INSTALL_ROOT=path/to/libxdf` to specify its path.
42
+
3. In your source code, `#include "xdf.h"`, instantiate an object of the `Xdf` class, and call the `load_xdf` method.
60
43
61
-
### Use in other C++ applications
44
+
For example:
62
45
63
-
1. Install a prebuilt binary release or build from source as above.
64
-
2. For CMake users:
65
-
* In your project's CMakeLists.txt, use the following snippet:
66
-
```CMake
67
-
find_package(libxdf REQUIRED
68
-
HINTS ${XDF_INSTALL_ROOT}
69
-
PATH_SUFFIXES share
70
-
)
71
-
target_link_libraries(${PROJECT_NAME}
72
-
PRIVATE
73
-
# ... other dependencies
74
-
XDF::xdf
75
-
)
76
-
```
77
-
* If the libxdf package was installed or extracted into a folder other than a standard system library folder, you will have to pass a cmake command line argument to indicate where to find it: `-DXDF_INSTALL_ROOT=path/to/libxdf`
78
-
3. In your source code, `#include "xdf.h"`, instantiate an object of the `Xdf` class and call the `load_xdf` method.
46
+
```C++
47
+
#include "xdf.h"
79
48
80
-
Example:
49
+
Xdf XDFdata;
50
+
XDFdata.load_xdf("example.xdf");
51
+
```
81
52
82
-
```C++
83
-
#include "xdf.h"
53
+
Functions must be called in a specific order. For example, calling `subtractMean` before loading data leads to undefined behavior.
84
54
85
-
Xdf XDFdata;
86
-
XDFdata.load_xdf("C:/example.xdf");
87
-
```
88
-
89
-
To resample the signals to e.g. 100Hz:
90
-
91
-
```C++
92
-
XDFdata.resample(100);
93
-
```
94
-
95
-
The functions in libxdf must be called following a certain order. For instance, if you call the `subtractMean` function before you load any data, it will cause undefined behavior.
96
-
97
-
The recommended order is shown here. Only `load_xdf` is mandatory.
Libxdf depends on third party libraries [Pugixml v1.8](http://pugixml.org/) for XML parsing and [Smarc](http://audio-smarc.sourceforge.net/) for resampling.
108
65
109
-
## <aname="doc"></a> Documentation
110
-
Detailed documentation was generated via [Doxygen](http://www.stack.nl/~dimitri/doxygen/index.html) and is available [here](docs/html/class_xdf.html).
66
+
## Documentation
111
67
112
-
## <aname="SigViewer"></a> SigViewer Online Repo
113
-
SigViewer Online Repository is [here](repository/Updates.xml).
68
+
Detailed documentation is available [here](docs/html/class_xdf.html).
114
69
115
-
## <aname="reference"></a> Reference
116
-
If you use this code in your project, please cite:
117
-
```
118
-
Yida Lin, Clemens Brunner, Paul Sajda and Josef Faller. SigViewer: Visualizing Multimodal Signals Stored in XDF (Extensible Data Format) Files. The 39th Annual International Conference of the IEEE Engineering in Medicine and Biology Society.
119
-
```
120
-
Direct link: https://arxiv.org/abs/1708.06333
121
70
122
-
Bibtex format:
123
-
```
124
-
@article{lin2017sigviewer,
125
-
title={SigViewer: visualizing multimodal signals stored in XDF (Extensible Data Format) files},
126
-
author={Lin, Yida and Brunner, Clemens and Sajda, Paul and Faller, Josef},
127
-
journal={arXiv},
128
-
pages={arXiv--1708},
129
-
year={2017}
130
-
}
131
-
```
71
+
## References
72
+
73
+
If you use libXDF in your project, please consider citing the following [conference paper](https://arxiv.org/abs/1708.06333):
74
+
75
+
> Yida Lin, Clemens Brunner, Paul Sajda and Josef Faller. *SigViewer: Visualizing Multimodal Signals Stored in XDF (Extensible Data Format) Files.* The 39th Annual International Conference of the IEEE Engineering in Medicine and Biology Society.
132
76
133
-
## <aname="support"></a>Support
134
-
[Email author](mailto:yida.lin@outlook.com) or report a new [issue](https://github.com/Yida-Lin/libxdf/issues).
77
+
LibXDF depends on third party libraries [pugixml](http://pugixml.org/) for XML parsing and [Smarc](http://audio-smarc.sourceforge.net/) for resampling.
0 commit comments