P300 speller: Modify how the alphabets flash

About the GUI application to design signal processing pipelines
Post Reply
chantrip
Posts: 42
Joined: Fri Jul 08, 2011 9:32 am

P300 speller: Modify how the alphabets flash

Post by chantrip »

I would like to modify how the alphabets flash. In the P300-speller with xDawn, every alphabet in the same row or column flash simultaneously e.g. the alphabets A, B, C, D, E, F which lie in the first row flash simultaneouly and so on with other alphabets in other rows/columns. Let's call this Row/Column flashing pattern. If I want the alphabets A,F, J, 3, Z to flash simultaneoulsy, where should I modify the code. In other words, I want alphabets which lie in different row/column to flash simultaneously. I would like to test different flashing patterns and compare their performance with Row/Column flashing pattern. Moreover, I found this article viewtopic.php?f=3&t=329 and would like to know if what I want to do is related to the file ovpCBoxAlgorithmP300SpellerVisualisation.cpp. Finally, is there any manuals that explain the coding/programming structure in the file ovpCBoxAlgorithmP300SpellerVisualisation.cpp?

Thank you very much for your kind response

-Jim

jlegeny
Posts: 239
Joined: Tue Nov 02, 2010 8:51 am
Location: Mensia Technologies Paris FR
Contact:

Re: P300 speller: Modify how the alphabets flash

Post by jlegeny »

Hello Jim,

In order to flash patterns instead of lines and columns you will have to change two things. First of all you need to decide how the patterns are identified. In the current implementation, the P300 visualization receives one stimulation which identifies either a line or a column.

Second thing to change is the part of the code around lines 359-379, the functions responsible for switching the color of the background, foreground and font size are _cache_change_background_cb_ , _cache_change_foreground_cb_ , _cache_change_font_cb_.

They are called as callbacks from the function _cache_for_each_if_ . This functions gets either the number of a line OR a number a column (the other is set to -1) and calls one of the aforementioned functions on all elements of the line/column.

I'd suggest that you define a pattern for each stimulation, create a function based on _cache_for_each_if_ which would take a pattern ID instead of the line/column.

Hope this explanation helps a bit.

chantrip
Posts: 42
Joined: Fri Jul 08, 2011 9:32 am

Re: P300 speller: Modify how the alphabets flash

Post by chantrip »

Hi jlegeny

Thank you very much for your response. I plan to modify the function _cache_for_each_if_ so that it takes the flashing pattern as an input instead of iLine and iColumn. The setting should be (from Line 687 of ovpCBoxAlgorithmP300SpellerVisualisation.cpp)
void CBoxAlgorithmP300SpellerVisualisation::_cache_for_each_if_(int* FlashPattern, ...,) although I'm still not sure how to modify the code from line 687 to 730. Could you please clarify the code from line 687 to 730? Moreover, I believe the program determines the row/column that flashes through l_iRow/l_iColumn variable. Does the program randomize the flashing row/column through l_pStimulationSet->getStimulationIdentifier(j) (line 314)? Also, could you please elaborate the variable l_pStimulationSet?

Thank you very much

-Jim

chantrip
Posts: 42
Joined: Fri Jul 08, 2011 9:32 am

P300 speller: Modify how the alphabets flash

Post by chantrip »

Hi

I tried to modify the stimulation pattern according to the post viewtopic.php?f=6&t=566 and would like to ask for your help as follows.

1. I'd like to create a new flashing pattern using random variables. Does it have to do with 'op_pSequenceStimulationSet' in the line 311 ?
2. What is the member inside the struct variable 'SWidgetStyle'? is iIndex either row/column number?
3. I've modified some parts of the file ovpCBoxAlgorithmP300SpellerVisualisation.cpp and would like to test the results. Could you please tell me how to compile and link it with the main file? I use CodeBlocks http://www.codeblocks.org/ to compile.
4. Is there any manual that elaborate the overall program? especially the file ovpCBoxAlgorithmP300SpellerVisualisation.cpp as a plugin-developer?

Thank you very much for your help

-Jim

--

Edit by Jozef Legény : I have merged this post into the previous topic with the same theme.

jlegeny
Posts: 239
Joined: Tue Nov 02, 2010 8:51 am
Location: Mensia Technologies Paris FR
Contact:

Re: P300 speller: Modify how the alphabets flash

Post by jlegeny »

Hello Jim,
chantrip wrote:1. I'd like to create a new flashing pattern using random variables. Does it have to do with 'op_pSequenceStimulationSet' in the line 311 ?
The stimulation set is used to stock the stimulations received by the box. Right now the box receives a stimulation going from Label_01 to Label_0C which identifies either a row or a column. (Basically the first six are rows, the following six are columns.) I don't think you need to change this at all. Since the column/row distinction is done by the box you can just say "each stimulation identifies a pattern".
chantrip wrote:2. What is the member inside the struct variable 'SWidgetStyle'? is iIndex either row/column number?
SWidgetStyle contains a gtk widget, its background and foreground colors and the associated text style. Which iIndex do you have in mind?

chantrip wrote:3. I've modified some parts of the file ovpCBoxAlgorithmP300SpellerVisualisation.cpp and would like to test the results. Could you please tell me how to compile and link it with the main file? I use CodeBlocks http://www.codeblocks.org/ to compile.
Are you using Windows or Linux? OpenViBE must be compiled by the provided build scripts (win32-build, linux-build) (you can use whatever IDE you want, but the scripts will always use Visual C++ Compiler on Windows and GCC on Linux.
chantrip wrote:4. Is there any manual that elaborate the overall program? especially the file ovpCBoxAlgorithmP300SpellerVisualisation.cpp as a plugin-developer?
The documentation on plugin development can be found here : http://openvibe.inria.fr/documentation/ ... ation.html. There is no specific documentation on the p300 stimulator box though.

Cheers
Jozef

chantrip
Posts: 42
Joined: Fri Jul 08, 2011 9:32 am

Re: P300 speller: Modify how the alphabets flash

Post by chantrip »

Thank you very much Jozef for your help. It seems the only way for me now is to study the code line by line :s.

I'm checking the file ovpCBoxAlgorithmP300SpellerStimulator.h. Could you please elaborate the state 'State_RepetitionRest' and 'State_TrialRest'?

Thank you very much

-Jim

chantrip
Posts: 42
Joined: Fri Jul 08, 2011 9:32 am

Re: P300 speller: Modify how the alphabets flash

Post by chantrip »

Hi

Thank you very much for your information. I'm still studying how the stimulation program works. From my understanding, a file 'ovpCBoxAlgorithmP300SpellerStimulator.cpp' generates a random sequence through a function generate_sequence(void) (line#388) and store them in 2 arrays m_vRow and m_vCColumn. These 2 arrays are used to generate a flashing sequence through line #314 where the output sequence is stored in a class 'l_oStimulationSet'. Here's my questions:

1. Is what I describe above accurate?
2. How 'oStimulationSet' is sent out to the box 'Lua Stimulator' and 'P300 Speller Visualisation' ?
3. Since the arrays m_vRow and m_vCColumn have been defined upto the Speller length row/column lenght(6), how the flashing sequence vary among several repetitions and trials? Does it have to do with parameters OVTK_StimulationId_Label_00, OVTK_StimulationId_Label_01 and OVTK_StimulationId_Label_07? or the function generate_sequence(void) has been called for a number of #repetitions x #trials?

Thank you very much for your help

-Jim

chantrip
Posts: 42
Joined: Fri Jul 08, 2011 9:32 am

Re: P300 speller: Modify how the alphabets flash

Post by chantrip »

I'm sorry but I have another question again :(. From the quote
chantrip wrote:
3. I've modified some parts of the file ovpCBoxAlgorithmP300SpellerVisualisation.cpp and would like to test the results. Could you please tell me how to compile and link it with the main file? I use CodeBlocks http://www.codeblocks.org/ to compile.


Are you using Windows or Linux? OpenViBE must be compiled by the provided build scripts (win32-build, linux-build) (you can use whatever IDE you want, but the scripts will always use Visual C++ Compiler on Windows and GCC on Linux.
I use Windows XP. So, does it mean that if I modify some parts in the file ovpCBoxAlgorithmP300SpellerVisualisation.cpp, then the only way to compile it is by double clicking the file win32-build.cmd in the directory '...\openvibe-0.11.0-svn3052-src\scripts' only? It seems to compile every file and takes a while to finish.

karthiks
Posts: 78
Joined: Thu Sep 02, 2010 2:43 pm
Location: Université Libre de Bruxelles

Re: P300 speller: Modify how the alphabets flash

Post by karthiks »

chantrip wrote:I'm sorry but I have another question again :(. From the quote
chantrip wrote:
3. I've modified some parts of the file ovpCBoxAlgorithmP300SpellerVisualisation.cpp and would like to test the results. Could you please tell me how to compile and link it with the main file? I use CodeBlocks http://www.codeblocks.org/ to compile.


Are you using Windows or Linux? OpenViBE must be compiled by the provided build scripts (win32-build, linux-build) (you can use whatever IDE you want, but the scripts will always use Visual C++ Compiler on Windows and GCC on Linux.
I use Windows XP. So, does it mean that if I modify some parts in the file ovpCBoxAlgorithmP300SpellerVisualisation.cpp, then the only way to compile it is by double clicking the file win32-build.cmd in the directory '...\openvibe-0.11.0-svn3052-src\scripts' only? It seems to compile every file and takes a while to finish.
If you have a specific file that you keep editing and you just need to compile that part of openvibe, edit the win32-init_env_command.cmd file in any text editor you have. Just REM out the parts you don't want to compile from the list at the end. For ex. if you just want to compile for the P300, you will compile the simulation part only i suppose. So, other than this line - echo %OpenViBE_plugin_stimulation% >> %OpenViBE_build_order% - just add REM in front of all the other lines like this - REM echo %OpenViBE_toolkit% >> %OpenViBE_build_order%.

But, do this only after you have compiled the entire openvibe build at least once.
Regards,

Karthik

jlegeny
Posts: 239
Joined: Tue Nov 02, 2010 8:51 am
Location: Mensia Technologies Paris FR
Contact:

Re: P300 speller: Modify how the alphabets flash

Post by jlegeny »

chantrip wrote:1. Is what I describe above accurate?
Yes
chantrip wrote:2. How 'oStimulationSet' is sent out to the box 'Lua Stimulator' and 'P300 Speller Visualisation' ?
The functionning of the p300 speller stimulator is described in the documentation here (note that you can press F1 while having a box selected to access its documentation) : http://openvibe.inria.fr/documentation/ ... lator.html

The stimulator box will send stimulations corresponding to rows/columns which are supposed to flash. These stimulations are captured by both boxes.
chantrip wrote:3. Since the arrays m_vRow and m_vCColumn have been defined upto the Speller length row/column lenght(6), how the flashing sequence vary among several repetitions and trials? Does it have to do with parameters OVTK_StimulationId_Label_00, OVTK_StimulationId_Label_01 and OVTK_StimulationId_Label_07? or the function generate_sequence(void) has been called for a number of #repetitions x #trials?
The stimulations mark the columns/rows to flash they represent the sequence itself.

Generate_sequence is called on initialisation and after each repetition. (This is necessary because you want the stimulator to be potentially able to flash forever)

chantrip
Posts: 42
Joined: Fri Jul 08, 2011 9:32 am

Re: P300 speller: Modify how the alphabets flash

Post by chantrip »

Hi again

Thank you very much for your previous response. It was very helpful. From the quote
If you have a specific file that you keep editing and you just need to compile that part of openvibe, edit the win32-init_env_command.cmd file in any text editor you have. Just REM out the parts you don't want to compile from the list at the end. For ex. if you just want to compile for the P300, you will compile the simulation part only i suppose. So, other than this line - echo %OpenViBE_plugin_stimulation% >> %OpenViBE_build_order% - just add REM in front of all the other lines like this - REM echo %OpenViBE_toolkit% >> %OpenViBE_build_order%.

But, do this only after you have compiled the entire openvibe build at least once.
In the file 'win32-init_env_command.cmd', I added REM to every line starting with echo except the one with stimulation text and compiled by double-clicking. It worked on the first try but didn't have any impact on later tries. However, I compile by double-clicking the file 'win32-build.cmd' and it works fine. Here're my questions:
1) Is it ok to compile from the file 'win32-build.cmd' instead everytime?
2) Anything that I should do to speed up the compiling process? e.g. REM any lines in the file 'win32-build.cmd'?
3) What's wrong with compiling the file 'win32-init_env_command.cmd' after the first try?

jlegeny
Posts: 239
Joined: Tue Nov 02, 2010 8:51 am
Location: Mensia Technologies Paris FR
Contact:

Re: P300 speller: Modify how the alphabets flash

Post by jlegeny »

Hello,

The full documentation for build process is here : http://openvibe.inria.fr/documentation/ ... stall.html

As for the files :
the win32-init_env_command.cmd is a script which sets up the environment, you do not need to run this script, it will be called automatically by any program needing it, the win32-build.cmd script in particular.

You should never alter the win32-build.cmd script (unless you really know what you are doing).

What you should do to compile OpenViBE cleanly is:
  • remove the win32-init_env_command.cmd file
  • run win32-install_dependencies.cmd
  • run the win32-build.cmd script
(the win32-init_env_command will be generated automatically the first time you build)

Once you have fully compiled OpenViBE you can edit the win32-install_dependencies.cmd win32-init_env_command.cmd script and add REM in front of any module you do not wish to build. Then, every time you have some modifications just run win32-build.cmd to recompile the software.

karthiks
Posts: 78
Joined: Thu Sep 02, 2010 2:43 pm
Location: Université Libre de Bruxelles

Re: P300 speller: Modify how the alphabets flash

Post by karthiks »

chantrip wrote: In the file 'win32-init_env_command.cmd', I added REM to every line starting with echo except the one with stimulation text and compiled by double-clicking. It worked on the first try but didn't have any impact on later tries. However, I compile by double-clicking the file 'win32-build.cmd' and it works fine. Here're my questions:
1) Is it ok to compile from the file 'win32-build.cmd' instead everytime?
2) Anything that I should do to speed up the compiling process? e.g. REM any lines in the file 'win32-build.cmd'?
3) What's wrong with compiling the file 'win32-init_env_command.cmd' after the first try?
Hey,

what I do is use the win32-build everytime. I use Eclipse to code and use the win32-build.cmd to compile. What I meant was, modify the win32-init_env_command.cmd and save it. Then build using win32-build. You do not need to compile the win32-init_env_command.cmd file.

1. As jlegeny already said, do not edit the win32-build.
2. If you do the REM in the win32-init_env_command.cmd file, the compiling will be as fast as it can be :)
3. I have already explained it above, I think.
jlegeny wrote:Once you have fully compiled OpenViBE you can edit the win32-install_dependencies.cmd script and add REM in front of any module you do not wish to build. Then, every time you have some modifications just run win32-build.cmd to recompile the software.
I think you mean the win32-init_env_command.cmd here, jlegeny. Am I correct or I am missing something? :)
Regards,

Karthik

jlegeny
Posts: 239
Joined: Tue Nov 02, 2010 8:51 am
Location: Mensia Technologies Paris FR
Contact:

Re: P300 speller: Modify how the alphabets flash

Post by jlegeny »

Indeed! I have made a mistake on that one

of course it is the win32-init_env_command.cmd which you need to modify. Thank you karthiks!

chantrip
Posts: 42
Joined: Fri Jul 08, 2011 9:32 am

Re: P300 speller: Modify how the alphabets flash

Post by chantrip »

Hello

I'd like to thank you karthiks and jlegeny for their helpful comments. I'm now able to compile the script using win32-build.cmd :) .

I have a couple of questions to ask:

1) From a file 'ovpCBoxAlgorithmP300SpellerStimulator.cpp' at line#315, when we append the stimulation using l_oStimulationSet.appendStimulation(x1, time, 0), can x1 be an array of integer or string?

2) From a file 'ovpCBoxAlgorithmP300SpellerVisualisation.cpp'
2.1) From line#398-#502 beginning with '// --- Target stimulations', what're the purpose of these scripts? It jumps here every trial.
2.2) From line#503-#641 beginning with '//// --- Selection stimulations', what're the purpose of these scripts?


Thank you very much again

-Jim

Post Reply