P3Speller - 2nd Matrix Text
-
bcip3
- Posts: 14
- Joined: 05 Oct 2011, 11:03
P3Speller - 2nd Matrix Text
Hi,
I have created a second matrix in the P3Speller application. I want to change the letters (in my case, words) from the 2nd matrix each time this matrix is selected. I have procedured following these steps:
1) Reading PARAMETERS --> ParamsToMatlabWS()
2) Modifing the value of bci_Paremeters.TargetDefinition{2}
3) Reading PARAMETERS from MATLAB --> MatlabWSToParams()
and I receive this error: Process: Number of TargetDefinition columns in menu #2 must be 2 or greater.
Nevertheless, when I modify the parameter in MATLAB and re-write the same words (the original ones), this error doesn't appear.
Could someone help me with this problem?
Thanks in advance.
I have created a second matrix in the P3Speller application. I want to change the letters (in my case, words) from the 2nd matrix each time this matrix is selected. I have procedured following these steps:
1) Reading PARAMETERS --> ParamsToMatlabWS()
2) Modifing the value of bci_Paremeters.TargetDefinition{2}
3) Reading PARAMETERS from MATLAB --> MatlabWSToParams()
and I receive this error: Process: Number of TargetDefinition columns in menu #2 must be 2 or greater.
Nevertheless, when I modify the parameter in MATLAB and re-write the same words (the original ones), this error doesn't appear.
Could someone help me with this problem?
Thanks in advance.
-
mellinger
- Posts: 1341
- Joined: 12 Feb 2003, 11:06
Re: P3Speller - 2nd Matrix Text
Hi,
I'm not sure I understand what exactly you are doing.
In any case, you need to have a prescribed number of columns in the TargetDefinition parameter.
When you have multiple TargetDefinition parameters, these columns must be present in each of them.
For a description of required columns, see
http://www.bci2000.org/wiki/index.php/U ... efinitions
Regards,
Juergen
I'm not sure I understand what exactly you are doing.
In any case, you need to have a prescribed number of columns in the TargetDefinition parameter.
When you have multiple TargetDefinition parameters, these columns must be present in each of them.
For a description of required columns, see
http://www.bci2000.org/wiki/index.php/U ... efinitions
Regards,
Juergen
-
bcip3
- Posts: 14
- Joined: 05 Oct 2011, 11:03
Re: P3Speller - 2nd Matrix Text
Hello Juergen,
Thanks for your response, I didn't express myself very well.
I have the original 6x6 matrix. When an element is selected, a new 4x4 matrix is opened (like the example P3Speller_Menus.prm) but instead of using icons, I want to modify the new elements of this new matrix each time this matrix is called. The original 4x4 matrix had different words, so I want to modify these words when the 4x4 matrix is called.
I get the words from MATLAB like I have explained before:
1) Reading PARAMETERS --> ParamsToMatlabWS()
2) Modifing the value of bci_Paremeters.TargetDefinition{2} <-- Changing the original words by the new ones.
3) Reading PARAMETERS from MATLAB --> MatlabWSToParams()
and I receive this error when any of the original words is different: Process: Number of TargetDefinition columns in menu #2 must be 2 or greater.
I have tested this example modifing these words but writting the original ones and there is no problem, everything works.
I was wondering if there is another variable where these values are stored (in C++) because I don't understand why there is a problem changing these words (also with the same size) and there is no problem changing these words by the same words.
I hope it is more clear now.
Thanks for your response, I didn't express myself very well.
I have the original 6x6 matrix. When an element is selected, a new 4x4 matrix is opened (like the example P3Speller_Menus.prm) but instead of using icons, I want to modify the new elements of this new matrix each time this matrix is called. The original 4x4 matrix had different words, so I want to modify these words when the 4x4 matrix is called.
I get the words from MATLAB like I have explained before:
1) Reading PARAMETERS --> ParamsToMatlabWS()
2) Modifing the value of bci_Paremeters.TargetDefinition{2} <-- Changing the original words by the new ones.
3) Reading PARAMETERS from MATLAB --> MatlabWSToParams()
and I receive this error when any of the original words is different: Process: Number of TargetDefinition columns in menu #2 must be 2 or greater.
I have tested this example modifing these words but writting the original ones and there is no problem, everything works.
I was wondering if there is another variable where these values are stored (in C++) because I don't understand why there is a problem changing these words (also with the same size) and there is no problem changing these words by the same words.
I hope it is more clear now.
-
mellinger
- Posts: 1341
- Joined: 12 Feb 2003, 11:06
Re: P3Speller - 2nd Matrix Text
Hi,
BCI2000 does not allow you to modify parameters during a run. So, your modified parameter will never arrive at the Application module when you are using the MatlabSignalProcessing module.
But it appears that you moved the MatlabFilter into the P3Speller Application module, and that you added calls to ParamsToMatlabWS() and MatlabWSToParams() before and after the call to bci_Process.m. Is that right?
Try to change the words from inside bci_StopRun.m (which is actually allowed to change parameters). Then, see whether the error message appears in a new run.
You might also test the code that modifies the words by using the convert_bciprm mex file on the TargetDefinition parameter as it exists in your parameter file. This will result in a parameter struct in the same format as bci_Parameters. To this, you can apply your code. Then, apply convert_bciprm to the modified parameter struct to get a parameter string. Applying convert_bciprm a third time, you can compare the content of the TargetDefinition parameter with what you thought it should be, to see whether your parameter changing code actually works.
Regards,
Juergen
BCI2000 does not allow you to modify parameters during a run. So, your modified parameter will never arrive at the Application module when you are using the MatlabSignalProcessing module.
But it appears that you moved the MatlabFilter into the P3Speller Application module, and that you added calls to ParamsToMatlabWS() and MatlabWSToParams() before and after the call to bci_Process.m. Is that right?
Try to change the words from inside bci_StopRun.m (which is actually allowed to change parameters). Then, see whether the error message appears in a new run.
You might also test the code that modifies the words by using the convert_bciprm mex file on the TargetDefinition parameter as it exists in your parameter file. This will result in a parameter struct in the same format as bci_Parameters. To this, you can apply your code. Then, apply convert_bciprm to the modified parameter struct to get a parameter string. Applying convert_bciprm a third time, you can compare the content of the TargetDefinition parameter with what you thought it should be, to see whether your parameter changing code actually works.
Regards,
Juergen
-
bcip3
- Posts: 14
- Joined: 05 Oct 2011, 11:03
Re: P3Speller - 2nd Matrix Text
Hi Juergen,
Thanks for your answer. You are right, I change the Parameters in Matlab and I am interesting in charge these new parameters in the application again. I did everything in the correct order but it didn't work.
I have been investigating how to update the Parameters in the correct way and finally I had to change the MatlabWSToParams() function because the new string is not stored in the correct place. It was saved in mpString instead of mpParam.
Original
Let me know if I am right.
Kind regards.
Thanks for your answer. You are right, I change the Parameters in Matlab and I am interesting in charge these new parameters in the application again. I did everything in the correct order but it didn't work.
I have been investigating how to update the Parameters in the correct way and finally I had to change the MatlabWSToParams() function because the new string is not stored in the correct place. It was saved in mpString instead of mpParam.
Original
Modificationp.Value( row, col ) = values.at( row ).at( col );
I don't know if there another way to improve this code, but it works.Param* p2 = new Param(values.at( row ).at( col ));
Param& p3 = *p2;
p.Value( row, col ) = p3;
Let me know if I am right.
Kind regards.
-
mellinger
- Posts: 1341
- Joined: 12 Feb 2003, 11:06
Re: P3Speller - 2nd Matrix Text
Hi,
thank you for reporting this problem. I created a ticket for a fix:
http://www.bci2000.org/tracproj/ticket/110
Best regards,
Juergen
thank you for reporting this problem. I created a ticket for a fix:
http://www.bci2000.org/tracproj/ticket/110
Best regards,
Juergen
-
bcip3
- Posts: 14
- Joined: 05 Oct 2011, 11:03
Re: P3Speller - 2nd Matrix Text
Hi Juergen,
I had a look at the code and found the methods Present() and Conceal() to start and finish the stimuli, but it is for the whole row or column. I was wondering about flashing only one cell of the matrix, could it be done in an easy way?
I was thinking about adding this new code at the P3Speller inside method OnClassResult() to highlight the selected cell (letter) in the ISI time.
Thanks for your help.
Kind regards.
I had a look at the code and found the methods Present() and Conceal() to start and finish the stimuli, but it is for the whole row or column. I was wondering about flashing only one cell of the matrix, could it be done in an easy way?
I was thinking about adding this new code at the P3Speller inside method OnClassResult() to highlight the selected cell (letter) in the ISI time.
Thanks for your help.
Kind regards.
-
mellinger
- Posts: 1341
- Joined: 12 Feb 2003, 11:06
Re: P3Speller - 2nd Matrix Text
Hi,
individual stimuli also have Present() and Conceal() methods, which you might use to to the desired flashing.
The general ERP classification code underlying P3Speller does not assume a one-to-one relation between individual stimuli, and individual targets, so there is no direct way to obtain the matrix cell stimulus corresponding to the classified target. You would need to iterate over stimuli, and identify the desired stimulus by its caption.
In order to get a pointer to an individual stimulus, iterate over associations as is done in OnClassResult() to create the fake result for clicked stimuli. The returned pointer is a generic Stimulus pointer, so you need to use dynamic_cast<TextStimulus*>() before querying its text property (don't forget to test the result of dynamic_cast<>() for NULL -- depending on configuration, there are other types of stimuli present in associations as well).
Regards,
Juergen
individual stimuli also have Present() and Conceal() methods, which you might use to to the desired flashing.
The general ERP classification code underlying P3Speller does not assume a one-to-one relation between individual stimuli, and individual targets, so there is no direct way to obtain the matrix cell stimulus corresponding to the classified target. You would need to iterate over stimuli, and identify the desired stimulus by its caption.
In order to get a pointer to an individual stimulus, iterate over associations as is done in OnClassResult() to create the fake result for clicked stimuli. The returned pointer is a generic Stimulus pointer, so you need to use dynamic_cast<TextStimulus*>() before querying its text property (don't forget to test the result of dynamic_cast<>() for NULL -- depending on configuration, there are other types of stimuli present in associations as well).
Regards,
Juergen
-
bcip3
- Posts: 14
- Joined: 05 Oct 2011, 11:03
Re: P3Speller - 2nd Matrix Text
Hello Juergen,
Thanks for your prompt response. I don't understand very well how to proceed.
I had tried the following code in method P3Speller::OnClassResult( const ClassResult& inResult ):
But it doesn´t work properly. Each row/column doesn't flicker after calling the methods Present() or Conceal(). It does few ms later.
I am sorry but I am not very familiar with C++. I need to improve my C++ skills.
Best regards.
Thanks for your prompt response. I don't understand very well how to proceed.
I had tried the following code in method P3Speller::OnClassResult( const ClassResult& inResult ):
Code: Select all
int singleRow = targetID ? ( targetID - 1 ) / mNumMatrixCols + 1 : 0;
Associations()[singleRow].Present();
int singleColumn = targetID ? ( targetID - 1 ) % mNumMatrixCols + 1 : 0;
for( int j = 1; j <= mNumMatrixCols; j++ )
{
if( singleColumn != j)
Associations()[j].Conceal();
}I am sorry but I am not very familiar with C++. I need to improve my C++ skills.
Best regards.
-
mellinger
- Posts: 1341
- Joined: 12 Feb 2003, 11:06
Re: P3Speller - 2nd Matrix Text
Hi,
I guess you intend to highlight a single matrix element by highlighting its row, and then concealing all columns except the one containing the matrix element. This should work in principle, but you are using the wrong indices to address associations.
Association indices are:
1, 2, 3, .., N_rows, N_rows+1, .. , N_rows+N_columns.
I.e., rows are enumbered first, then columns follow.
Thus, you need to add mNumMatrixRows to j in your second last line.
Regards,
Juergen
I guess you intend to highlight a single matrix element by highlighting its row, and then concealing all columns except the one containing the matrix element. This should work in principle, but you are using the wrong indices to address associations.
Association indices are:
1, 2, 3, .., N_rows, N_rows+1, .. , N_rows+N_columns.
I.e., rows are enumbered first, then columns follow.
Thus, you need to add mNumMatrixRows to j in your second last line.
Regards,
Juergen
Who is online
Users browsing this forum: No registered users and 0 guests
