Example
|
From Capsule version 1.2.0 and newer we recommend using two firmware versions:
Capsule is intended for working with devices based on physiological signals measurement and classification.
Basic paradigms are: EEG (NFB), PPG (Cardio), Movement data (gyroscope and accelerometer)
For using Capsule to build one's own application the dynamic libraries (.dll / .dylib) are included with a header files for Windows and MacOS operatings systems. Aso Apple Flamework included for iOS operating system and Shared Library for Android operating system.
Package contains example projects:
A GUI version of Capsule for Windows and MacOS operating systems is also included in this package.
Following OS versions are supported:
Basically, each Capsule API session with a device must include 6 stages:
C API parameter | Parameter description | Type | Value from | Value to |
---|---|---|---|---|
IndividualFrequency | IAF | float | 7 | 13 |
IndividualPeakFrequency | IAPF | float | 7 | 13 |
IndividualPeakFrequencyPower | iapf power | float | 0 | infinity (excluding) |
IndividualPeakFrequencySuppression | iapf suppression | float | 0 | infinity (excluding) |
IndividualBandwidth | individual alpha range width | float | 0 | 6 |
IndividualNormalizedPower | normalized alpha range power | float | 0 | 1 |
LowerFrequency | alpha range lower bound | float | 7 | 13 |
UpperFrequency | alpha range upper bound | float | 7 | 13 |
Heart Rate | heart rate (beats per minute/pulse) | float | 0 | 180 |
Stress Index (Baevskiy) | Stress Index (Baevskiy) | float | 0 | infinity (excluding) |
SAT Index (Kaplan) | SAT Index (Kaplan) | float | 0 | infinity (excluding) |
GravityBaseline | GravityBaseline | float | 0 | infinity (excluding) |
ProductivityBaseline | ProductivityBaseline | float | 0 | infinity (excluding) |
FatigueBaseline | FatigueBaseline | float | 0 | infinity (excluding) |
ReverseFatigueBaseline | ReverseFatigueBaseline | float | 0 | infinity (excluding) |
RelaxBaseline | RelaxBaseline | float | 0 | infinity (excluding) |
ConcentrationBaseline | ConcentrationBaseline | float | 0 | infinity (excluding) |
FatigueScore | FatigueScore | float | 0 | infinity (excluding) |
GravityScore | GravityScore | float | 0 | infinity (excluding) |
ConcentrationScore | ConcentrationScore | float | 0 | infinity (excluding) |
RelaxationScore | RelaxationScore | float | 0 | infinity (excluding) |
AccumulatedFatigue | AccumulatedFatigue | float | 0 | 10 |
FatigueGrowth | FatigueGrowth | int | 0 | 3 |
AlphaRangeBegin | alpha range start | float | 7 | 13 |
AlphaRangeEnd | alpha range end | float | 7 | 13 |
RelaxPoint | RelaxPoint | int | 0 | 5 |
StressPoint | StressPoint | int | 0 | 2 |
RelaxBaseline | RelaxBaseline | float | 0 | infinity (excluding) |
FatigueBaseline | FatigueBaseline | float | 0 | infinity (excluding) |
GravityBaseline | GravityBaseline | float | 0 | infinity (excluding) |
ConcentrationBaseline | ConcentrationBaseline | float | 0 | infinity (excluding) |
IsArtifacted | EEG artifacts | bool | TRUE | FALSE |
Focus | focus scale | float | 0 | 100 |
Chill | chill scale | float | 0 | 100 |
Stress | stress scale | float | 0 | 100 |
Anger | anger scale | float | 0 | 100 |
SelfControl | self-control scale | float | 0 | 100 |
Relaxation | Physiological States Value | float | 0 | 1 |
Fatigue | Physiological States Value | float | 0 | 1 |
Concentraition | Physiological States Value | float | 0 | 1 |
Involvement | Physiological States Value | float | 0 | 1 |
Stress | Physiological States Value | float | 0 | 1 |
None | Physiological States Value | float | 0 | 1 |
nfbArtifacts | Physiological States Value | bool | TRUE | FALSE |
cardioArtifacts | Physiological States Value | bool | TRUE | FALSE |
If you want to create data folier at other directory use methods clCClient_CreateWithDataDirectory and clCClient_CreateWithDataDirectoryAndName. Sometimes system wide administrator privileges may be required.
PPG and MEMS usage
The device can operate in two modes:
Signal / Resistance
To switch to resistance mode use clCDevice_SwitchMode(clCDevice, clC_DM_Resistance) Make sure the electrode quality is satisfactory before switching to signal mode.
To switch to signal mode use clCDevice_SwitchMode(clCDevice, clC_DM_Signal).
Signal + Resistance
Use clCDevice_SwitchMode(clCDevice, clC_DM_SignalAndResist) to work with signal+resistance mode.
Impedance measurement
The resistance value for each channel, in order to receive a good signal, is recommended to be lowered according to the following estimate:
Switch device to signal mode
You can use these methods any time after creating the device.
In signal mode received EEG data already free of miographic artefacts. If artefacts detected invalid value, are not sent via API.
The classifier unites accelerometer and gyroscope integrated in Neiry Headband Pro and is called clCMEMS
(MEMS - micro electro mechanical system) for brevity.
MEMS event contains multiple sensor readings coupled with timepoints
Licence required to work with "ready to use" metrics, based at physyological signals. Such as NFB, Productivity, Emotions, Cardio, States classification results. Filtered EEG signal also require licence.
RAW signal from device does not require licence, and can be used to build own classification.
First licence key verification require internet connection.
Licence key can be obtained from your device seller manager.
Before creating session license key must be verified, otherwise futher API methods won't work. License verification is performed via clCLicenseManager
class which can be obtained via clCClient_GetLicenseManager method. To request license verification you need to pass license key and connected device instance from clCDevice to the clCLicenseManager_VerifyLicense method. When the license is verified, the handler obtained with clCLicenseManager_GetOnLicenseVerifiedEvent is called. This handler has a bool
parameter which represents a success flag (true
if license verified successfully, otherwise false
).
This stage allows to create "session". After creation session's RAW data can be written in Capsule folder (HDF5 format), and further classification of physiological signals can be produced.
We recommend create only one session during working with device.
You can call clCNFBCalibrator_GetOnIndividualNFBCalibratedEvent
before initialization brain rhythms if you don't need to send callibration results to your server.
To get [IndividualFrequency, IndividualPeakFrequency, IndividualPeakFrequencyPower, IndividualPeakFrequencySuppression, IndividualBandwidth, IndividualNormalizedPower, LowerFrequency, UpperFrequency] a callback is used with a pointer to clCIndividualNFBData
, which is set via clCNFBCalibratorDelegateIndividualNFBCalibrated_Set
If calibration fails, clCNFBCalibrator_GetOnIndividualNFBCalibratedEvent
returns a fail reason.
Method clCNFBCalibrator_CalibrateIndividualNFB
requires 4 stages to train model:
Method clCNFBCalibrator_CalibrateIndividualNFBQuick
will require 1 stage to train model:
When [LowerFrequency, UpperFrequency, IndividualPeakFrequencySuppression] values are not needed, clCNFBCalibrator_CalibrateIndividualNFBQuick
calibration method should be used, due to its short duration and easier process.
To get [FeedbackData (Alpha, Beta, Theta), FeedbackSize, Timestamp] a callback is used with a pointer to clCNFBUserState
, which is set via clCNFBDelegateNFBUserState_Set
You can receive values of the following main brain rhythms without calibration (model training): Theta (4-7 Hz), Alpha (7-13 Hz), Beta (15-30 Hz). All values are sent in mV^2.
To get [GravityBaseline, ProductivityBaseline, FatigueBaseline, ReverseFatigueBaseline, RelaxBaseline, ConcentrationBaseline] a callback is used with a pointer to clCNFBMetricsProductivityBaselines, which is set via clCNFBMetricsProductivity_InitialBaselineCalibratedEvent_Set
To get [FatigueScore, GravityScore, ConcentrationScore, RelaxationScore, AccumulatedFatigue, FatigueGrowth] a callback is used with a pointer to clCNFBMetricsProductivityValues
, which is set via clCNFBMetricsProductivity_ValuesEvent_Set
To reset accumulated fatigue and start its calculation from zero method clCNFBMetricsProductivity_ResetAccumulatedFatigue is used.
To get [IAF, IAPF, IAPFPowerNormalized, AlphaRangeBegin, AlphaRangeEnd, RelaxPoint, StressPoint, RelaxBaseline, FatigueBaseline, GravityBaseline, ConcentrationBaseline, IsArtifacted] a callback is used with a pointer to clCNFBMetricsProductivityIndividualIndexes
, which is set via clCNFBMetricsProductivity_IndividualMeasuredEvent_Set
If physiological state is not detected value "no condition" will be received.
For physiological states like Fatigue or Stress values can be received every 2.5 min (if miographics artifacts are not detected)
To get [ProductivityScore] a callback is used with a pointer to clCNFBMetricsProductivityIndividualIndexes, which is set via clCNFBMetricsProductivity_UpdateEvent_Set, to get a delegate, you can use for example clCNFBMetricsProductivity_GetOnUpdateEvent_1min or clCNFBMetricsProductivity_GetOnUpdateEvent_5min, clCNFBMetricsProductivity_GetOnUpdateEvent_15min, clCNFBMetricsProductivity_GetOnUpdateEvent_30min, clCNFBMetricsProductivity_GetOnUpdateEvent_60min
IAPF and IAF values can be received once per calibration.
For indexes like Fatigue Score or Concentration Index values can be received every 0.1 sec.
Cognitive (Productivity) Score can be received every 0.1 sec. For momentum values clCNFBMetricsProductivity_GetOnUpdateEvent_1min should be used.
For physiological states like Fatigue or Stress values can be received every 2.5 min (if miographics artifacts are not detected).
To get [Focus, Chill, Stress, Anger, SelfControl] a callback is used with a pointer to clCEmotionalStates
, which is set via clCEmotionsDelegateEmotionalStatesUpdate_Set
For emotional states values can be received every 0.1 sec.
Full list of available methods can be found further in this documentation (File->File Members->Functions).
To get [relaxation, fatigue, none, concentration, involvement, stress, nfbArtifacts, cardioArtifacts] a callback is used with a pointer to clCPhysiologicalStatesValue
, which is set via clCPhysiologicalStatesDelegatePhysiologicalStatesUpdate_Set.
To get baselines of [alpha, beta, alphaGravity, betaGravity, concentration] a callback is used with a pointer to clCPhysiologicalStatesBaselines
, which is set via clCPhysiologicalStatesOnCalibratedEvent_Set. This callback is called after calibration and only once.
By default physiological state values are sent every 2 minute.
If you don't need to use metrics, you can work with raw signal.
MEMS
PPG
EEG
Create device as usual flow. Create session and get filtered signal event.
If you need to work with monopolar channels use:
Also you can work with bipolar mode. Use: