Dateien hochladen nach „src/TactileVisualization“

This commit is contained in:
Tobias Baumann 2022-05-24 09:15:52 +00:00
parent bb6c6013dd
commit 5a50c85c57
3 changed files with 34 additions and 29 deletions

View File

@ -23,7 +23,7 @@ TactileMenu::TactileMenu(int n_Tactilos)
for(int i = 1; i <= n_Tactilos; i++) for(int i = 1; i <= n_Tactilos; i++)
{ {
m_LabelText.push_back("Tactilo" + std::to_string(i)); m_LabelText.push_back("Tactilo" + std::to_string(i));
m_SubMenu.push_back(this); m_SubMenu.push_back(nullptr);
} }
} }

View File

@ -152,9 +152,6 @@ bool CBoxAlgorithmP300TactileVisualization::initialize()
m_Menu[0].set_LabelText(3, "Hilfe"); m_Menu[0].set_LabelText(3, "Hilfe");
m_Menu[0].set_LabelText(4, "Geräte"); m_Menu[0].set_LabelText(4, "Geräte");
m_Menu[0].set_LabelText(5, "Funktionen"); m_Menu[0].set_LabelText(5, "Funktionen");
m_Menu[0].set_SubMenu(2, &m_Menu[1]);
m_Menu[0].set_SubMenu(3, &m_Menu[2]);
m_Menu[0].set_SubMenu(4, &m_Menu[3]);
m_Menu.push_back(TactileMenu(6)); m_Menu.push_back(TactileMenu(6));
m_Menu[1].set_LabelText(0, "Ja"); m_Menu[1].set_LabelText(0, "Ja");
@ -163,7 +160,6 @@ bool CBoxAlgorithmP300TactileVisualization::initialize()
m_Menu[1].set_LabelText(3, "Lage"); m_Menu[1].set_LabelText(3, "Lage");
m_Menu[1].set_LabelText(4, "Müdigkeit"); m_Menu[1].set_LabelText(4, "Müdigkeit");
m_Menu[1].set_LabelText(5, "Hauptmenü"); m_Menu[1].set_LabelText(5, "Hauptmenü");
m_Menu[0].set_SubMenu(5, &m_Menu[0]);
m_Menu.push_back(TactileMenu(6)); m_Menu.push_back(TactileMenu(6));
m_Menu[2].set_LabelText(0, "Ja"); m_Menu[2].set_LabelText(0, "Ja");
@ -172,7 +168,6 @@ bool CBoxAlgorithmP300TactileVisualization::initialize()
m_Menu[2].set_LabelText(3, "Atemnot"); m_Menu[2].set_LabelText(3, "Atemnot");
m_Menu[2].set_LabelText(4, "Anderes"); m_Menu[2].set_LabelText(4, "Anderes");
m_Menu[2].set_LabelText(5, "Hauptmenü"); m_Menu[2].set_LabelText(5, "Hauptmenü");
m_Menu[0].set_SubMenu(5, &m_Menu[0]);
m_Menu.push_back(TactileMenu(6)); m_Menu.push_back(TactileMenu(6));
m_Menu[3].set_LabelText(0, "Ja"); m_Menu[3].set_LabelText(0, "Ja");
@ -181,9 +176,16 @@ bool CBoxAlgorithmP300TactileVisualization::initialize()
m_Menu[3].set_LabelText(3, "Rollstuhl"); m_Menu[3].set_LabelText(3, "Rollstuhl");
m_Menu[3].set_LabelText(4, "Computer"); m_Menu[3].set_LabelText(4, "Computer");
m_Menu[3].set_LabelText(5, "Hauptmenü"); m_Menu[3].set_LabelText(5, "Hauptmenü");
m_Menu[0].set_SubMenu(5, &m_Menu[0]);
//Set Pointer to Mainmenu //Set SubMenu ptr
m_Menu[0].set_SubMenu(2, &m_Menu[1]);
m_Menu[0].set_SubMenu(3, &m_Menu[2]);
m_Menu[0].set_SubMenu(4, &m_Menu[3]);
m_Menu[1].set_SubMenu(5, &m_Menu[0]);
m_Menu[2].set_SubMenu(5, &m_Menu[0]);
m_Menu[3].set_SubMenu(5, &m_Menu[0]);
//Set current menu ptr to Mainmenu
m_currMenu = &m_Menu[0]; m_currMenu = &m_Menu[0];
} }
else //Create default menu for m_nTactilos != 6 else //Create default menu for m_nTactilos != 6
@ -351,6 +353,7 @@ bool CBoxAlgorithmP300TactileVisualization::uninitialize()
m_targetFlaggingStimulationEncoder->uninitialize(); m_targetFlaggingStimulationEncoder->uninitialize();
this->getAlgorithmManager().releaseAlgorithm(*m_targetFlaggingStimulationEncoder); this->getAlgorithmManager().releaseAlgorithm(*m_targetFlaggingStimulationEncoder);
m_targetFlaggingStimulationEncoder = nullptr; m_targetFlaggingStimulationEncoder = nullptr;
} }
if (m_targetStimulationDecoder) if (m_targetStimulationDecoder)
@ -416,10 +419,10 @@ bool CBoxAlgorithmP300TactileVisualization::process()
if (m_sequenceStimulationDecoder->isOutputTriggerActive(OVP_GD_Algorithm_StimulationDecoder_OutputTriggerId_ReceivedBuffer)) if (m_sequenceStimulationDecoder->isOutputTriggerActive(OVP_GD_Algorithm_StimulationDecoder_OutputTriggerId_ReceivedBuffer))
{ {
IStimulationSet* stimulationSet = m_sequenceStimulationSet; CStimulationSet* stimulationSet = m_sequenceStimulationSet;
for (size_t j = 0; j < stimulationSet->getStimulationCount(); ++j) for (size_t j = 0; j < stimulationSet->size(); ++j)
{ {
uint64_t id = stimulationSet->getStimulationIdentifier(j); uint64_t id = stimulationSet->getId(j);
bool flash = false; bool flash = false;
int row = -1; int row = -1;
int col = -1; int col = -1;
@ -463,12 +466,12 @@ bool CBoxAlgorithmP300TactileVisualization::process()
if (isTarget) if (isTarget)
{ {
m_stimuliQueue.push_back(OVTK_StimulationId_Target); m_stimuliQueue.push_back(OVTK_StimulationId_Target);
flaggingStimulationSet.appendStimulation(OVTK_StimulationId_Target, stimulationSet->getStimulationDate(j), 0); flaggingStimulationSet.push_back(OVTK_StimulationId_Target, stimulationSet->getDate(j), 0);
} }
else else
{ {
m_stimuliQueue.push_back(OVTK_StimulationId_NonTarget); m_stimuliQueue.push_back(OVTK_StimulationId_NonTarget);
flaggingStimulationSet.appendStimulation(OVTK_StimulationId_NonTarget, stimulationSet->getStimulationDate(j), 0); flaggingStimulationSet.push_back(OVTK_StimulationId_NonTarget, stimulationSet->getDate(j), 0);
} }
} }
@ -501,10 +504,10 @@ bool CBoxAlgorithmP300TactileVisualization::process()
if (m_targetStimulationDecoder->isOutputTriggerActive(OVP_GD_Algorithm_StimulationDecoder_OutputTriggerId_ReceivedBuffer)) if (m_targetStimulationDecoder->isOutputTriggerActive(OVP_GD_Algorithm_StimulationDecoder_OutputTriggerId_ReceivedBuffer))
{ {
IStimulationSet* stimulationSet = m_targetStimulationSet; CStimulationSet* stimulationSet = m_targetStimulationSet;
for (size_t j = 0; j < stimulationSet->getStimulationCount(); ++j) for (size_t j = 0; j < stimulationSet->size(); ++j)
{ {
uint64_t id = stimulationSet->getStimulationIdentifier(j); uint64_t id = stimulationSet->getId(j);
bool target = false; bool target = false;
if (id >= m_rowStimulationBase && id < m_rowStimulationBase + m_nRow) if (id >= m_rowStimulationBase && id < m_rowStimulationBase + m_nRow)
{ {
@ -583,7 +586,7 @@ bool CBoxAlgorithmP300TactileVisualization::process()
Kernel::IAlgorithmProxy* decoder = (k == 2 ? m_rowSelectionStimulationDecoder : m_columnSelectionStimulationDecoder); Kernel::IAlgorithmProxy* decoder = (k == 2 ? m_rowSelectionStimulationDecoder : m_columnSelectionStimulationDecoder);
Kernel::TParameterHandler<const IMemoryBuffer*> selectionMemoryBuffer( Kernel::TParameterHandler<const IMemoryBuffer*> selectionMemoryBuffer(
decoder->getInputParameter(OVP_GD_Algorithm_StimulationDecoder_InputParameterId_MemoryBufferToDecode)); decoder->getInputParameter(OVP_GD_Algorithm_StimulationDecoder_InputParameterId_MemoryBufferToDecode));
Kernel::TParameterHandler<IStimulationSet*> selectionStimulationSet( Kernel::TParameterHandler<CStimulationSet*> selectionStimulationSet(
decoder->getOutputParameter(OVP_GD_Algorithm_StimulationDecoder_OutputParameterId_StimulationSet)); decoder->getOutputParameter(OVP_GD_Algorithm_StimulationDecoder_OutputParameterId_StimulationSet));
for (size_t i = 0; i < boxContext.getInputChunkCount(k); ++i) for (size_t i = 0; i < boxContext.getInputChunkCount(k); ++i)
@ -597,10 +600,10 @@ bool CBoxAlgorithmP300TactileVisualization::process()
if (decoder->isOutputTriggerActive(OVP_GD_Algorithm_StimulationDecoder_OutputTriggerId_ReceivedBuffer)) if (decoder->isOutputTriggerActive(OVP_GD_Algorithm_StimulationDecoder_OutputTriggerId_ReceivedBuffer))
{ {
IStimulationSet* stimulationSet = selectionStimulationSet; CStimulationSet* stimulationSet = selectionStimulationSet;
for (size_t j = 0; j < stimulationSet->getStimulationCount(); ++j) for (size_t j = 0; j < stimulationSet->size(); ++j)
{ {
uint64_t id = stimulationSet->getStimulationIdentifier(j); uint64_t id = stimulationSet->getId(j);
bool selected = false; bool selected = false;
if (id >= m_rowStimulationBase && id < m_rowStimulationBase + m_nRow) if (id >= m_rowStimulationBase && id < m_rowStimulationBase + m_nRow)
{ {
@ -669,12 +672,15 @@ bool CBoxAlgorithmP300TactileVisualization::process()
" column : " << size_t(m_selectedCol) << "\n"; " column : " << size_t(m_selectedCol) << "\n";
} }
//Switch Menu //Switch Menu
m_currMenu = m_currMenu->get_SubMenu(m_selectedRow); if(m_currMenu->get_SubMenu(m_selectedRow) != nullptr)
for(int i = 0; i < 6; i++)
{ {
std::string label_text = m_currMenu->get_LabelText(i); m_currMenu = m_currMenu->get_SubMenu(m_selectedRow);
for(uint64_t i = 0; i < m_nTactilos; i++)
gtk_label_set_text(m_Label[i], label_text.c_str()); {
std::string label_text = m_currMenu->get_LabelText(i);
gtk_label_set_text(m_Label[i], label_text.c_str());
}
} }
} }
else else
@ -703,7 +709,6 @@ bool CBoxAlgorithmP300TactileVisualization::process()
return true; return true;
} }
// _________________________________________________________________________________________________________________________________________________________ // _________________________________________________________________________________________________________________________________________________________
// //

View File

@ -56,9 +56,9 @@ private:
Kernel::IAlgorithmProxy* m_columnSelectionStimulationDecoder = nullptr; Kernel::IAlgorithmProxy* m_columnSelectionStimulationDecoder = nullptr;
Kernel::TParameterHandler<const IMemoryBuffer*> m_sequenceMemoryBuffer; Kernel::TParameterHandler<const IMemoryBuffer*> m_sequenceMemoryBuffer;
Kernel::TParameterHandler<const IMemoryBuffer*> m_targetMemoryBuffer; Kernel::TParameterHandler<const IMemoryBuffer*> m_targetMemoryBuffer;
Kernel::TParameterHandler<const IStimulationSet*> m_targetFlaggingStimulationSet; Kernel::TParameterHandler<const CStimulationSet*> m_targetFlaggingStimulationSet;
Kernel::TParameterHandler<IStimulationSet*> m_sequenceStimulationSet; Kernel::TParameterHandler<CStimulationSet*> m_sequenceStimulationSet;
Kernel::TParameterHandler<IStimulationSet*> m_targetStimulationSet; Kernel::TParameterHandler<CStimulationSet*> m_targetStimulationSet;
Kernel::TParameterHandler<IMemoryBuffer*> m_targetFlaggingMemoryBuffer; Kernel::TParameterHandler<IMemoryBuffer*> m_targetFlaggingMemoryBuffer;
uint64_t m_lastTime = 0; uint64_t m_lastTime = 0;