CursorTask & MATLAB & DummySignalProcessing

Forum for discussion on different user applications
Post Reply
rabiri
Posts: 13
Joined: 19 Sep 2014, 12:38

CursorTask & MATLAB & DummySignalProcessing

Post by rabiri » 12 Feb 2015, 12:33

Dear All,
Concerning real time cursor control task, I have some questions:

1- First of all, I want to be sure that the input control signals to the CursorTask application are the cursor velocities. I am using MatlabSignalProcessing to control the cursor. I want to be sure that the generated output signals in MATLAB are the input velocities to the cursor application and it means that we are controlling the velocities of the cursor (and not positions). Also, do I need to consider a limitation in MATLAB code on the range of output signals (velocities)(This question is a little bit similar to my third question below)?

2- For training sessions, I have a recorded data file of computer mouse cursor positions/velocities in (x,y) plane. How can I reload this file by BCI2000 to be able to control the cursor positions/velocities in CursorTask application during training subjects? How I will be able to synchronize this application with recording EEG signals during a training session?

3- I am using DummySignalProcessing module which includes Filter Expression. To control the cursor velocities (by considering fixed value of Feedback Duration and window sizes!!), I manually enter fixed values in Filter Expression for x and y direction. According to assumptions for control signals in CursorTask (Normalizer section: zero mean, unit variance), I can enter just the values between -1 and 1 in Filter expression. But, I would like to have a high velocity, So, I enter the values more than 1 and less than -1 in Filter expression, and I can see a high velocity condition of cursor on monitor. Can I use these values (more than 1 and less than -1) in my experiments to control the cursor velocity?
*If yes, how does the velocity of the cursor change by these values? Is there just a linear transformation for the velocity? I mean, if I enter 2 in Filter Expression, then the velocity for the specific direction will be twice the time when I enter the value 1?
*If No, so, the following statement must be true. When we control the y direction of cursor in FeedbackDemo application by brain signals, the maximum accessible speed in y direction for the cursor will be equal to the fixed (and chosen) horizontal speed.

4- How can I have a continuous output record of cursor positions in CursorTask Application? Do I need to modify the CursorTask source code by using C++?

5- I can put zero as the number of targets in FeedbackDemo application without getting any error. But, In CursorTask application, it does not allowed me to put zero as the number of targets. Why is it happening? How can I change the settings to zero targets in my special experiments?

6- There is an indicator for every parameters for determining the subject’s level as beginner, medium or advance. How these levels work in helping the experimenter to get better results?

I really appreciate your support in advance,
Reza

boulay
Posts: 382
Joined: 25 Dec 2011, 21:14

Re: CursorTask & MATLAB & DummySignalProcessing

Post by boulay » 12 Feb 2015, 20:31

Hi Reza,
There are quite a few questions there. I'll just pick at them a bit.

The answers to 1, 3, and 4 can be learned by reading the source code. I think you are very interested in the details of the CursorTask so it is probably a good idea for you to look at the source code carefully to learn exactly what is happening. [1]

The short answers are:

1a - Yes, velocity.
1b - That's up to you.
3. Yes it's linear. CursorTask is dumb. It assumes any clever non-linear transformations will be done in signal processing.
4. In your states CursorPosX, CursorPosY, and CursorPosZ
rabiri wrote: 2- For training sessions, I have a recorded data file of computer mouse cursor positions/velocities in (x,y) plane. How can I reload this file by BCI2000 to be able to control the cursor positions/velocities in CursorTask application during training subjects? How I will be able to synchronize this application with recording EEG signals during a training session?
There's no easy way to do that. You can create a dummy BCI2000.dat file using the Matlab tools, making sure to specify the states correctly. Then you can use the FilePlayback module and set PlaybackStates to true. [2]
rabiri wrote: 5- I can put zero as the number of targets in FeedbackDemo application without getting any error. But, In CursorTask application, it does not allowed me to put zero as the number of targets. Why is it happening? How can I change the settings to zero targets in my special experiments?
Can you put the targets off-screen? I've never tried that. You can change the targets colours to match your background colour, and also set the parameter so hitting the target doesn't end the trial.
rabiri wrote: 6- There is an indicator for every parameters for determining the subject’s level as beginner, medium or advance. How these levels work in helping the experimenter to get better results?
Sorry can you be more specific? I don't really understand what you're asking.

[1] http://www.bci2000.org/tracproj/browser ... ckTask.cpp
[2] http://www.bci2000.org/wiki/index.php/C ... backStates

rabiri
Posts: 13
Joined: 19 Sep 2014, 12:38

Re: CursorTask & MATLAB & DummySignalProcessing

Post by rabiri » 15 Feb 2015, 16:42

Sorry for this delay.
If I am right, your name is Chad. Thanks a lot for your help.

About your help for question 5: I checked the software again. I am not sure where can I change the parameter so that hitting the target does not finish the trial. Can you explain a little more, please.

About question 6: After launching the three required modules, in BCI2000/Operator main window, if you check with menu bar and go to File/Preferences; there is an indicator shows “User Level” as beginner, intermediate, advanced. There is the same indicator for each parameters in “Parameter Configuration” window. My question is that how these levels work? How they can help the experimenter to improve his works from the first step of training the subject to the advanced level?

I have one more questions about cursor speed:
# According to the post (http://www.bci2000.org/phpbb/viewtopic.php?f=5&t=1258), Juergen explained the cursor speed can be calculated by the following formula:
v_0 = (screen width)/(2*FeedbackDuration)
v = v_0 * (control signal) = (control signal) * (screen width) / ( 2*FeedbackDuration)

First of all, for 2D application, I am not sure what is the screen width value. Is it WindowWidth parameter or WindowHeight parameter? It seems the real screen in which the cursor is moving is a square shape with just one value for the side (width).

Also, I am not sure how much this formulation is accurate. If I am right, the result from this formulation is that if the cursor starts to move from a point in the middle of a side (of screen), the trial should be finished when the cursor reaches to the center of screen after elapsing FeedbackDuration time (by considering control signal as one). I tested it by using DummySignalProcessing with input 1 (or -1) for one direction (x or y) and the input to the other direction considered as zero. The cursor is not exactly at the center of screen when the trial is finished! Why?

Again, thanks a lot for your support,
Reza

boulay
Posts: 382
Joined: 25 Dec 2011, 21:14

Re: CursorTask & MATLAB & DummySignalProcessing

Post by boulay » 15 Feb 2015, 19:15

Yes, it's Chad. Hi, Reza.

I'm going from memory because I'm only at my Windows box 2-3 times per week, otherwise I'm using OSX and I don't have a functioning BCI2000 in OSX at the moment. So I sometimes make recall errors.

For your question 5, I think I was misremembering another parameter that specifies whether or not the trial should end when a non-cued target is hit. That's not really what you want. Anyway, I thought a little more and I think you can use the 3-D setup but set your z-input to always be 0. (Set Normalizer gain to x x 0 and adaptation to 2 2 0). The cursor will never hit the target.

I'm sorry I can't remember anything about "User Level". I've definitely never touched that feature.

Your description of the cursor traveled distance suggests a problem. To help identify it, can you check your .dat files to see if the CursorXPos (for example) increased monotonically as soon as feedback was enabled? The delta between cursor positions across blocks should be identical.

rabiri
Posts: 13
Joined: 19 Sep 2014, 12:38

Re: CursorTask & MATLAB & DummySignalProcessing

Post by rabiri » 17 Feb 2015, 20:05

Hi Chad,
Thanks for your help.
About velocities of the cursor and distance traveled by the cursor, I did several tests and finally I think I figured out the issue. It seems to me there is no problem with the velocity formulation. My understanding is that this formulation is based on a screen width which ranges from 0 to 4095 units (as mentioned in this book: Practical guide to Brain Computer-interfacing with BCI2000). Therefore, for a control signal as 1 and in one “FeedbackDuration” time, the cursor should travel the half of screen width as about 2047 number of units.

But, the issue is that in my PC the cursor positions are recorded in ranges of 204 units to 3890 units for both x and y directions (Why?). (The left and bottom planes are recorded as 204; the right and top planes are recorded as 3890; the center is the same as (2047, 2047)).

By considering the same defined velocity and control signal as 1, in my PC the cursor wants to travel 2047 number of units from the start to the end in one “FeedbackDuration” time. But, since the size of window is less than definition, in one “FeedbackDuration” time, the cursor will go further than center location if it starts moving from the edges or it will be stuck in the edges (for some moments) if it starts to move from the center.

In the following, there are some of my observations for one “FeedbackDuration” time and control signal 1 in x, y directions. The first figure shows that the cursor go further than center (2047, 2047) in one “FeedbackDuration” time (because it wants to travel 2047 number of units in this time). The last figure shows that the cursor is stuck for some moments of “FeedbackDuration” time.

Looking forward to hearing from you,
Thanks a lot,
Reza

Image
Image
Image

boulay
Posts: 382
Joined: 25 Dec 2011, 21:14

Re: CursorTask & MATLAB & DummySignalProcessing

Post by boulay » 17 Feb 2015, 22:32

It seems it is either incorrectly documented or it is a bug.

Did you compile the binaries yourself? If so, what source revision did you use?

If you used a recent version of the source then I think it's worth filing a bug report in trac.
If you used precompiled binaries or binaries compiled from an older version of the source then it's possible it has already been fixed, in which case I'd ask you to compile from newer source and see if the behaviour is still there. Be sure to do this well outside of your production directory. There are likely to be in-progress bugs in the latest source code.

Follow the directions to get the source [1] but instead of getting the current release [2] get the trunk [3].

[1] http://www.bci2000.org/wiki/index.php/P ... ource_Code
[2] svn checkout http://www.bci2000.org/svn/tags/releases/current/ --username <your BCI2000 account name>
[3] svn checkout http://www.bci2000.org/svn/trunk/ --username <your BCI2000 account name>

-Chad

pbrunner
Posts: 344
Joined: 17 Sep 2010, 12:43

Re: CursorTask & MATLAB & DummySignalProcessing

Post by pbrunner » 23 Feb 2015, 11:06

Reza,

quite a few questions. To provide you with useful answers, I will need to conceptually understand what you would like to accomplish. For this, can you please provide a conceptual summary of your experiment?

Regards, Peter

rabiri
Posts: 13
Joined: 19 Sep 2014, 12:38

Re: CursorTask & MATLAB & DummySignalProcessing

Post by rabiri » 25 Feb 2015, 09:30

Hi Chad,

I am using the latest version of BCI2000 (3.0.5) and the latest stable source code, as well. Both core CursorTask module and the compiled one (by using the source code) have this problem. I double-checked and the problem is still there. I think it should be a bug. I did not try to employ the trunk version; maybe later, I will check with that. For right now, I can take care of this problem. Thank you for your help.
Reza

rabiri
Posts: 13
Joined: 19 Sep 2014, 12:38

Re: CursorTask & MATLAB & DummySignalProcessing

Post by rabiri » 25 Feb 2015, 09:34

Hi Peter,

In my experiment (training session), I want to control the cursor (velocity/position) by input control signals from mouse (position). I was validating the velocity calculated by:
v_0 = (screen width)/(2*FeedbackDuration)
v = v_0 * (control signal) = (control signal) * (screen width) / ( 2*FeedbackDuration)

and the velocity acquired by differentiating the position of the cursor.
I could not get the correct result! Then, I found the problem in CursorTask module (as you can see in the figures in previous posts). I am not sure, but it seems there is a bug with the CursorTask module. For right now, I take care of the problem.

It would be great if you could help me with my question 6.
About question 6: After launching the three required modules, in BCI2000/Operator main window, if you check with menu bar and go to File/Preferences; there is an indicator shows “User Level” as beginner, intermediate, advanced. There is the same indicator for each parameters in “Parameter Configuration” window. My question is that how these levels work? How they can help the experimenter to improve his works from the first step of training the subject to the advanced level?

Thank you for your support,
Reza

pbrunner
Posts: 344
Joined: 17 Sep 2010, 12:43

Re: CursorTask & MATLAB & DummySignalProcessing

Post by pbrunner » 25 Feb 2015, 11:28

Reza,

I am not sure which version of BCI2000 you are using, but in the current SVN version the MousePosX and MousePosY have an offset of 32768 that you need to subtract to get the screen coordinates [1].

As Chad already mentioned, you can use the ExpressionFilter [2] with two lines to "add" two control signals by translating the MousePosX and MousePosY from [0 to ScreenWidth-1] and [0 to ScreenHeight-] into variables that range from -1 to +1. In this case the position of the cursor on the screen determines the velocity of the cursor in the CursorTask. If you add the adaptation, then you essentially perform the normalization to the -1 to +1 range with zero mean automatically, however if you already know what your input variables are, this may not be necessary.

To get from a position to velocity translation to a velocity to velocity translation you just need to add the DiffFilter to your filter pipeline. Thus you probably do not need the MatlabFilter.

Please note that it is sometimes useful to give the user a safe zero-control area, i.e,. a radius around the center of the screen, that does not translate into any cursor movement. You can accomplish this by multiplying your ExpressionFilter expressions by a conditional expression, e.g,. the euclidian distance of the MousePosX and MousePoxY from the center of the screen being larger than 5% of the screen.

Regarding your question #6, the sliders next to the parameters are to lock down the BCI2000 configuration to only certain parameters [3]. This is for example useful if an operator with limited experience has to make changes to parameters and you want to avoid him/her to make any other unwanted changes.

Regards, Peter

[1] http://www.bci2000.org/wiki/index.php/U ... _MousePosY
[2] http://www.bci2000.org/wiki/index.php/U ... sionFilter
[3] http://www.bci2000.org/wiki/index.php/U ... ces_Dialog

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest