arrow-left

All pages
gitbookPowered by GitBook
1 of 8

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

queryProfile

This method returns the list of all the training profiles of the user.

hashtag
Parameters

Name

Type

Required

Description

hashtag
Result

The result is an array of objects , or an empty array if the user has no profile. Each object includes these fields:

hashtag
Example

cortexToken

string

yes

A token returned by authorize.

uuid

string

The unique ID of this profile.

name

string

The name of the profile.

readOnly

boolean

If a headset is created before v3.6.5, the profile will become read-only when upgrading to v3.6.5. See readonly profile. This field is available since v3.6.5.

eegChannels

array

The list of EEG channels of a headset with which this profile can be loaded. For example, if eegChannels of a profile is ["AF3","T7","Pz","T8","AF4"], this profile can be loaded for Insight headset. This field is available since v3.6.5.

{
    "id": 1,
    "jsonrpc": "2.0",
    "method": "queryProfile",
    "params": {
        "cortexToken": "xxx"
    }
}
{
    "id": 1,
    "jsonrpc": "2.0",
    "result": [
        {
            "uuid":"xxx"
            "name":"Profile A",
            "readOnly":false,
            "eegChannels":["AF3","T7","Pz","T8"
        },
        {
            "uuid":"yyy"
            "name":"Profile B",
            "readOnly":true,
            "eegChannels":["AF3","F7","F3","FC5"
        }
    ]
}
,
"
AF4
"
]
,
"
T7
"
,
"
P7
"
,
"
O1
"
,
"
O2
"
,
"
P8
"
,
"
T8
"
,
"
FC6
"
,
"
F4
"
,
"
F8
"
,
"
AF4
"
]

Readonly profile

If you upgrade from EmotivBCI before v3.6.5, you should notice that we change the format of training profiles so that the existing training profile (i.e. created before v3.6.5) will not be fully supported. We call them readonly profiles which can only run at a live mode and cannot run on training mode.

These readonly training profiles only support headsets with 14 EEG channels (i.e. EPOC X and Flex with EPOC X config mapping).

getCurrentProfile

This method returns the training profile that is currently loaded for a specific headset.

hashtag
Parameters

Name

Type

Required

Description

hashtag
Result

The result is an object containing these fields:

hashtag
Examples

BCI

You can use the Cortex API to develop a brain–computer interface (BCI), using facial expressions, mental commands, or both.

circle-info

Before you start programming your own BCI, it is strongly recommended that you use EmotivBCIarrow-up-right to get familiar with the main BCI features of Cortex. You should also check out the EmotivBCI Node-RED Toolboxarrow-up-right.

circle-info

To use the BCI features with an EPOC Flex headset, you must use a special EEG mapping. Please see for details.

To get the results of the facial expression detection and the mental command detection, you must to the data streams "fac" and "com" respectively.

To use the mental command detection, you must a training profile that contains training data for at least one action. For the facial expression detection, the training is optional.

hashtag
Profile

A profile is a persistent object that stores training data for the facial expression and mental command detections. A profile belongs to a user and is synchronized to the EMOTIV cloud.

You can use to list the profiles of the current user. Use to manage the profiles, and also to load or unload a profile for a headset. You can use to add training data to a profile.

Before v3.6.5, a profile can be loaded for both Epoc/Flex and Insight. Since v3.6.5, a profile can only be loaded for Epoc/Flex or Insight since their EEG channels are different. If you upgrade from version before 3.6.5, the existing profiles will become readonly. See

hashtag
Training workflow

The training works that same for the mental command detection and the facial expression detection. However, they don't use the same actions, events or controls. So you should call to know what actions, controls and events you can use for each detection.

Before you start a training, you must to the data stream "sys" to receive the training events from Cortex. Then you can follow these steps:

  1. Start the training by calling with the action you want to train and the control "start".

  2. On the "sys" stream, you receive the event "started".

  3. After a few seconds, you receive one of these two events:

After step 2, but before step 3, you can send the control "reset" to cancel the training.

The following chart illustrates the flow of BCI training with corresponding request for each step:

hashtag
Getting live actions

The following chart illustrates the streaming of Mental Commands data in live:

loadGuestProfile

This method loads an empty profile for a headset. You can use this method to quickly load a profile, without having to create a profile with setupProfile.

hashtag
Parameters

Name

Type

Required

hashtag
Result

The result is an object containing these fields:

hashtag
Examples

getDetectionInfo

This method returns useful information about the mental command training or the facial expression training.

hashtag
Parameters

Name

Type

Required

Description

hashtag
Result

The result is an object containing information about the detection you specified in the parameters.

hashtag
Examples

hashtag
Mental command

hashtag
Facial expression

cortexToken

string

yes

A token returned by authorize.

headset

string

yes

A headset id returned by queryHeadsets.

Name

Type

Description

name

string

The name of the loaded profile, or null if no profile was loaded for this headset.

loadedByThisApp

boolean

true if the profile was loaded by your application, false if it was loaded by another application.

This field was added in Cortex 2.1

{
    "id": 1,
    "jsonrpc": "2.0",
    "method": "getCurrentProfile",
    "params": {
        "cortexToken": "xxx",
        "headset": "EPOCPLUS-12341234"
    }
}
{
    "id": 1,
    "jsonrpc": "2.0",
    "result": {
        "name": "my profile",
        "loadedByThisApp": true
    }
}

Description

cortexToken

string

yes

A token returned by authorize.

headset

string

yes

A headset id returned by queryHeadsets.

Name

Type

Description

action

string

Is always "load".

name

string

Is always "Guest Profile".

message

string

A success message.

{
    "id": 1,
    "jsonrpc": "2.0",
    "method": "loadGuestProfile",
    "params": {
        "cortexToken": "xxx",
        "headset": "INSIGHT-12341234"
    }
}
{
    "id": 1,
    "jsonrpc": "2.0",
    "result": {
        "action": "load",
        "name": "Guest Profile",
        "message": "..."
    }
}

Event "succeeded", the training is a success. Now you must accept it or reject it.

  • Event "failed", the data collected during the training is of poor quality, you must start over from the beginning.

  • Call training with the control "accept" to add the training to the profile. Or you can use the control "reject" to reject this training, and then you must start over from the beginning.

  • Cortex sends the event "completed" to confirm that the training was successfully completed.

  • You should save the profile to persist this training. If you unload the profile without saving, then the training is lost.

  • Data Subscription
    subscribe
    load
    queryProfile
    setupProfile
    training
    Readonly training profile.
    getDetectionInfo
    subscribe
    training

    The different types of signature that you can get or set with .

    detection

    string

    yes

    Must be "mentalCommand" or "facialExpression".

    Name

    Type

    Description

    actions

    array of strings

    The actions that this detection can detect.

    controls

    array of strings

    The list of the status you can use when you call the training method.

    events

    array of strings

    The events you can receive in the "sys" data stream when you train this detection.

    signature

    {
        "id": 1,
        "jsonrpc": "2.0",
        "method": "getDetectionInfo",
        "params": {
            "detection": "mentalCommand"
        }
    }
    {
        "id": 1,
        "jsonrpc": "2.0",
        "result": {
            "actions": [
                "neutral",
                "push",
                "pull",
                "lift",
                "drop",
                "left",
                "right",
                "rotateLeft",
                "rotateRight",
                "rotateClockwise",
                "rotateCounterClockwise",
                "rotateForwards",
                "rotateReverse",
                "disappear"
            ],
            "controls": [
                "start",
                "accept",
                "reject",
                "erase",
                "reset"
            ],
            "events": [
                "MC_Started",
                "MC_Succeeded",
                "MC_Failed",
                "MC_Completed",
                "MC_DataErased",
                "MC_Rejected",
                "MC_Reset",
                "MC_AutoSamplingNeutralCompleted",
                "MC_SignatureUpdated"
            ],
            "signature": []
        }
    }

    array of strings

    setupProfile

    This method is to manage the training profiles of the user.

    You create, rename or delete a profile. You can load and unload a profile for a headset if the EEG channels of this headset is supported by this training profile. And you can save a profile after the user completed a training, or after you changed the attributes of the profile.

    Before you load or unload a profile, you can call getCurrentProfile to know if a profile is currently loaded, and if it was loaded by your application.

    hashtag
    Parameters

    Depending on the status, this method has different effects, and uses different parameters.

    hashtag
    Status create

    Create a new profile. It can be an empty profile, or a copy of a loaded profile.

    hashtag
    Status load

    Load an existing profile for a specific headset. If a profile is already loaded, then you must unload it first.

    hashtag
    Status unload

    Unload the profile of a specific headset. After the unload, this headset will use a default empty profile. You should set the parameter profile to an empty string. You cannot unload a profile that was loaded by another application.

    hashtag
    Status save

    Save the profile used by a headset. You can save it with a new name, so it creates a new profile. Or you can save it with the same name, ie the name you used to load it. You cannot save a profile that was loaded by another application.

    hashtag
    Status rename

    Rename an existing profile.

    hashtag
    Status delete

    Delete an existing profile. If this profile is loaded for a headset, then it is automatically unloaded. You cannot delete a profile that is currently loaded by another application.

    hashtag
    Result

    The result is an object containing these fields:

    hashtag
    Examples

    hashtag
    Create a new empty profile

    hashtag
    Load a profile for a headset

    hashtag
    Save a profile

    training

    This method is to control the training of the mental command and facial expression detections. Before you start a training, you should subscribe to the "sys" data stream.

    See BCI for details.

    hashtag
    Parameters

    Name

    hashtag
    status

    To get the available status for a detection, call , and check the field controls of the result object. Or you can check this list:

    hashtag
    action

    To get the available actions for a detection, call , and check the field actions of the result object.

    However, note that for the facial expression detection, only these actions can be trained: "neutral", "surprise", "frown", "smile", "clench".

    hashtag
    Result

    The result is an object containing these fields:

    hashtag
    Examples

    hashtag
    Start a training

    Start a mental command training for the action "push".

    hashtag
    Accept a training

    Accept a successful training for the action "push".

    {
        "id": 1,
        "jsonrpc": "2.0",
        "method": "getDetectionInfo",
        "params": {
            "detection": "facialExpression"
        }
    }
    {
        "id": 1,
        "jsonrpc": "2.0",
        "result": {
            "actions": [
                "neutral",
                "blink",
                "winkL",
                "winkR",
                "horiEye",
                "surprise",
                "frown",
                "smile",
                "clench",
                "laugh",
                "smirkLeft",
                "smirkRight"
            ],
            "controls": [
                "start",
                "accept",
                "reject",
                "erase",
                "reset"
            ],
            "events": [
                "FE_Started",
                "FE_Succeeded",
                "FE_Failed",
                "FE_Completed",
                "FE_DataErased",
                "FE_Rejected",
                "FE_Reset"
            ],
            "signature": [
                "universal",
                "trained"
            ]
        }
    }
    facialExpressionSignatureType

    Type

    Required

    Description

    cortexToken

    string

    yes

    A token returned by authorize.

    session

    string

    yes

    A session id returned by createSession. The training will be for the headset linked to this session.

    detection

    string

    yes

    Must be "mentalCommand" or "facialExpression".

    status

    string

    yes

    Control what this method does, like start the training, or cancel it... Available status depends on which detection you selected.

    action

    string

    yes

    The action you want to train. Available actions depends on which detection you selected.

    Status

    Description

    start

    Start a new training for the specified action.

    accept

    Accept a successful training and add it to the profile.

    reject

    Reject a successful training. It is not added to the profile.

    reset

    Cancel the current training.

    erase

    Erase all the training data for the specified action.

    Name

    Type

    Description

    action

    string

    The action you set in the request.

    status

    string

    The status you set in the request.

    message

    string

    A success message.

    getDetectionInfo
    getDetectionInfo
    {
        "id": 14,
        "jsonrpc": "2.0",
        "method": "training",
        "params": {
            "action": "push",
            "cortexToken": "xxx",
            "detection": "mentalCommand",
            "session": "f3a35fd0-9163-4cc4-ab30-4ed224369f91",
            "status": "start"
        }
    }
    {
        "id": 14,
        "jsonrpc": "2.0",
        "result": {
            "action": "push",
            "message": "Set up training successfully",
            "status": "start"
        }
    }
    {
        "id": 15,
        "jsonrpc": "2.0",
        "method": "training",
        "params": {
            "action": "push",
            "cortexToken": "xxx",
            "detection": "mentalCommand",
            "session": "f3a35fd0-9163-4cc4-ab30-4ed224369f91",
            "status": "accept"
        }
    }
    {
        "id": 15,
        "jsonrpc": "2.0",
        "result": {
            "action": "push",
            "message": "Set up training successfully",
            "status": "accept"
        }
    }

    yes

    The name of the profile.

    headset

    string

    yes or no, depending on "status"

    A headset id returned by .

    newProfileName

    string

    no

    If the status is "rename", then you must set this parameter, and it is the new name of the profile.

    Name

    Type

    Required

    Description

    cortexToken

    string

    yes

    A token returned by authorize.

    status

    string

    yes

    Must be "create", "load", "unload", "save", "rename" or "delete".

    profile

    Name

    Type

    Required

    Description

    profile

    string

    yes

    The name of the new profile. It must be unique for the user. Use queryProfile to check if a name is already in use.

    headset

    string

    yes

    create a copy of the profile currently loaded for this headset.

    Name

    Type

    Required

    Description

    profile

    string

    yes

    The name of the profile to load.

    headset

    string

    yes

    The id of the headset to load the profile to.

    Name

    Type

    Required

    Description

    headset

    string

    yes

    The id of the headset to unload the profile.

    profile

    string

    yes

    Cortex will ignore this parameter. Should be an empty string.

    Name

    Type

    Required

    Description

    headset

    string

    yes

    The profile used by this headset will be saved.

    profile

    string

    yes

    The name of the profile.

    If no profile with that name exists, then the method creates a new profile.

    If it is the name of the profile that was previously loaded to this headset, then the method saves to this profile.

    Name

    Type

    Required

    Description

    profile

    string

    yes

    The name of the profile you want to rename.

    newProfileName

    string

    yes

    The new name of the profile.

    Name

    Type

    Required

    Description

    profile

    string

    yes

    The name of the profile you want to delete.

    Name

    Type

    Description

    action

    string

    The status you used in the request.

    name

    string

    The profile you used in the request.

    message

    string

    A success message.

    string

    {
        "id": 1,
        "jsonrpc": "2.0",
        "method": "setupProfile",
        "params": {
            "cortexToken": "xxx",
            "profile": "cortex-v2-example",
            "status": "create"
        }
    }
    {
        "id": 1,
        "jsonrpc": "2.0",
        "result": {
            "action": "create",
            "message": "...",
            "name": "cortex-v2-example"
        }
    }
    {
        "id": 1,
        "jsonrpc": "2.0",
        "method": "setupProfile",
        "params": {
            "cortexToken": "xxx",
            "headset": "EPOCPLUS-12341234",
            "profile": "cortex-v2-example",
            "status": "load"
        }
    }
    {
        "id": 1,
        "jsonrpc": "2.0",
        "result": {
            "action": "load",
            "message": "The profile is loaded successfully",
            "name": "cortex-v2-example"
        }
    }
    {
        "id": 1,
        "jsonrpc": "2.0",
        "method": "setupProfile",
        "params": {
            "cortexToken": "xxx",
            "headset": "EPOCPLUS-12341234",
            "profile": "cortex-v2-example",
            "status": "save"
        }
    }
    {
        "id": 1,
        "jsonrpc": "2.0",
        "result": {
            "action": "save",
            "message": "The profile is saved successfully",
            "name": "cortex-v2-example"
        }
    }
    queryHeadsets