Graz visualization Box with 4 classes

Concerning processing components: filters, file load/save, visualizations, communication ...
Post Reply
hkn1304
Posts: 13
Joined: Tue Apr 18, 2017 5:44 am

Graz visualization Box with 4 classes

Post by hkn1304 »

Hello,

I am working on revising graz visualization box to show accuracy bar for 4 class(Left,Right,Down and Up)

Looking at the source code, i found following areas with notes:

// @fixme for >2 classes
void CGrazVisualization::updateConfusionMatrix(float64 f64VoteAggregate)
{
if(m_eCurrentDirection == EArrowDirection_Left || m_eCurrentDirection == EArrowDirection_Right)
{
const uint32 l_ui32TrueDirection = m_eCurrentDirection - 1;

const uint32 l_ui32ThisVote = (f64VoteAggregate < 0 ? 0 : 1);

(m_oConfusion.getBuffer())[l_ui32TrueDirection*2 + l_ui32ThisVote]++;


void CGrazVisualization::drawBar()
{
const gint l_iWindowWidth = m_pDrawingArea->allocation.width;
const gint l_iWindowHeight = m_pDrawingArea->allocation.height;

float64 l_f64UsedScale = m_f64BarScale;
if(m_bPositiveFeedbackOnly)
{
// @fixme for multiclass
const uint32 l_ui32TrueDirection = m_eCurrentDirection - 1;
const uint32 l_ui32ThisVote = (m_f64BarScale < 0 ? 0 : 1);
if(l_ui32TrueDirection != l_ui32ThisVote)
{
l_f64UsedScale = 0;
}
}

gint l_iRectangleWidth = static_cast<gint>(fabs(l_iWindowWidth * fabs(l_f64UsedScale) / 2));

l_iRectangleWidth = (l_iRectangleWidth>(l_iWindowWidth/2)) ? (l_iWindowWidth/2) : l_iRectangleWidth;

void CGrazVisualization::drawArrow(EArrowDirection eDirection)
{
gint l_iWindowWidth = m_pDrawingArea->allocation.width;
gint l_iWindowHeight = m_pDrawingArea->allocation.height;

gint l_iX = 0;
gint l_iY = 0;

switch(eDirection)
{
case EArrowDirection_None:
this->drawArrow(EArrowDirection_Left);
this->drawArrow(EArrowDirection_Right);
// this->drawArrow(EArrowDirection_Up);
// this->drawArrow(EArrowDirection_Down);
break;

I don't know c++. Can anybody help me with that?

Thanks.
Attachments
ovpCGrazVisualization.cpp
(25.59 KiB) Downloaded 208 times

Luciano
Posts: 2
Joined: Wed Aug 30, 2017 7:14 pm

Question Regarding the Graz visualization Box

Post by Luciano »

Hello,

I need to have a scenario on openvibe similar to "mi-csp-1-acquisition", but with 4 classes (both hands and both feet).

How can I'm modification the "Graz Motor Imagery BCI Stimulator" box or write the script .lua on "Lua Stimulator" box?

Thanks!!!

tgaugry
Posts: 68
Joined: Thu Feb 09, 2017 10:17 am

Re: Graz visualization Box with 4 classes

Post by tgaugry »

Hello,

I took the liberty of merging the 2 post, are they are asking for more or less the same thing.
Currently if you want to have more than 2 classes with a graz visualisation, you'll have to do some coding.
hkn1304 is correct; this is the file that should be modified for 4 classes Graz visualization.

This feature is not in the Inria's immediate timeline. However, if anybody wishes to contribute a 4-class graz components and/or scenarios, we are happy to consider including them.

Cheers,

hkn1304
Posts: 13
Joined: Tue Apr 18, 2017 5:44 am

Re: Graz visualization Box with 4 classes

Post by hkn1304 »

Hello Luciano,

For the acquisition of more than 2 class, i managed to change Lua script for 4 class. Here is how:

1.Copy script in docx file and paste into original lua script file(website doesn't allow me to upload :? ) and then change the filename in openvibe as described by pointing where you saved.
2. Do the necessary changes described in step 2. This will bring you the 3rd and 4th class items in stimulator.

That should suffice and work.

PS: I don't know Lua either, i just evaluated the logic and changed it but it worked in my project. :P

Happy hacking!
Attachments
lua4class_step2.png
lua4class_step2.png (34.25 KiB) Viewed 5319 times
lua4class_step1.png
lua4class_step1.png (48.19 KiB) Viewed 5319 times

hkn1304
Posts: 13
Joined: Tue Apr 18, 2017 5:44 am

Re: Graz visualization Box with 4 classes

Post by hkn1304 »

Hello tgaugry,

I evaluated the code with my friend who knows C++ but he said only changing Grazvisualization.cpp file couldn't solve the problem because it may be related with the other file. Is this correct?

If i fix only the Grazvisualization.cpp file, would that solve my problem?

Thanks.

tgaugry
Posts: 68
Joined: Thu Feb 09, 2017 10:17 am

Re: Graz visualization Box with 4 classes

Post by tgaugry »

Hi,
it may be related with the other file.
Can you tell me which other file you are talking about ?

Anyway, there isn't many directly related file. Boxes are supposedly contained within their cpp/h files, so you will likely need to change the header ovpCGrazVisualization.h.
Other than that, there is the interface file openvibe-simple-visualisation-GrazVisualization.ui or the arrows openvibe-simple-visualisation-GrazVisualization-*.png; i don't see why you would want to modify these.
Juging from the headers, i don't think there is any other file that needs to be changed.

Can you tell me what your friend though needed modification ?

Cheers,

amitpbarde
Posts: 7
Joined: Wed Sep 12, 2018 4:56 am

Re: Graz visualization Box with 4 classes

Post by amitpbarde »

Hello!

Has anyone got the 4 classes running? If anyone's managed to integrate two more classes in, it'll be great to get hold of the code. Alternatively, it would be nice to know how chnages can be affected to the code to get this running.

Thanks,

Amit.

Post Reply