Browse Source

adapt taktile pfade

master
Nicole Weber 3 years ago
parent
commit
7e3ca13b7f
11 changed files with 159 additions and 45 deletions
  1. 45
    17
      UIController.py
  2. BIN
      UIController.pyc
  3. 2
    2
      UIModellTaktil.py
  4. BIN
      UIModellTaktil.pyc
  5. 2
    2
      UIModellVisuell.py
  6. BIN
      UIModellVisuell.pyc
  7. 13
    0
      UIViewTKinter.py
  8. BIN
      UIViewTKinter.pyc
  9. 97
    24
      dll.cpp
  10. BIN
      dll.so
  11. BIN
      gui

+ 45
- 17
UIController.py View File

@@ -28,11 +28,11 @@ class Controller():

self.getSharedLibrary()

self.view = viewTkinter.View(self, self.dll.getDefaultPath())
self.view = viewTkinter.View(self, self.dll.getDefaultPath_visuell())
self.modi = "visuellesBCI"
self.pathOVFile = self.dll.getPathOVFile()
self.pathSpatialCfg = self.dll.getSpatialCFGFile()
self.pathClassifierCfg = self.dll.getClassifierCFGFile()
self.pathOVFile = self.dll.getPathOVFile_visuell()
self.pathSpatialCfg = self.dll.getSpatialCFGFile_visuell()
self.pathClassifierCfg = self.dll.getClassifierCFGFile_visuell()
self.infotext = ""

self.commands = {
@@ -90,23 +90,41 @@ class Controller():
self.dll.getCommandCopyspellingVisuell.argtypes = []
self.dll.getCommandCopyspellingVisuell.restype = ctypes.c_char_p

self.dll.getCommandXDawn.argtypes = []
self.dll.getCommandXDawn.restype = ctypes.c_char_p
self.dll.getCommandXDawn_taktil.argtypes = []
self.dll.getCommandXDawn_taktil.restype = ctypes.c_char_p

self.dll.getCommandClassifier.argtypes = []
self.dll.getCommandClassifier.restype = ctypes.c_char_p
self.dll.getCommandXDawn_visuell.argtypes = []
self.dll.getCommandXDawn_visuell.restype = ctypes.c_char_p

self.dll.getDefaultPath.argtypes = []
self.dll.getDefaultPath.restype = ctypes.c_char_p
self.dll.getCommandClassifier_visuell.argtypes = []
self.dll.getCommandClassifier_visuell.restype = ctypes.c_char_p

self.dll.getPathOVFile.argtypes = []
self.dll.getPathOVFile.restype = ctypes.c_char_p
self.dll.getCommandClassifier_taktil.argtypes = []
self.dll.getCommandClassifier_taktil.restype = ctypes.c_char_p

self.dll.getSpatialCFGFile.argtypes = []
self.dll.getSpatialCFGFile.restype = ctypes.c_char_p
self.dll.getDefaultPath_visuell.argtypes = []
self.dll.getDefaultPath_visuell.restype = ctypes.c_char_p

self.dll.getClassifierCFGFile.argtypes = []
self.dll.getClassifierCFGFile.restype = ctypes.c_char_p
self.dll.getDefaultPath_taktil.argtypes = []
self.dll.getDefaultPath_taktil.restype = ctypes.c_char_p

self.dll.getPathOVFile_visuell.argtypes = []
self.dll.getPathOVFile_visuell.restype = ctypes.c_char_p

self.dll.getSpatialCFGFile_visuell.argtypes = []
self.dll.getSpatialCFGFile_visuell.restype = ctypes.c_char_p

self.dll.getClassifierCFGFile_visuell.argtypes = []
self.dll.getClassifierCFGFile_visuell.restype = ctypes.c_char_p

self.dll.getPathOVFile_taktil.argtypes = []
self.dll.getPathOVFile_taktil.restype = ctypes.c_char_p

self.dll.getSpatialCFGFile_taktil.argtypes = []
self.dll.getSpatialCFGFile_taktil.restype = ctypes.c_char_p

self.dll.getClassifierCFGFile_taktil.argtypes = []
self.dll.getClassifierCFGFile_taktil.restype = ctypes.c_char_p

self.dll.getCommandStartAquisitionServer.argtypes = []
self.dll.getCommandStartAquisitionServer.restype = ctypes.c_char_p
@@ -149,10 +167,18 @@ class Controller():
if(self.modi == "taktilesBCI"):
self.view.setChangeBtnText("Wechsel zu taktilen BCI")
self.view.setTitleText("visuelles BCI")
self.view.setDefaultPath(self.dll.getDefaultPath_visuell())
self.pathOVFile = self.dll.getPathOVFile_visuell()
self.pathSpatialCfg = self.dll.getSpatialCFGFile_visuell()
self.pathClassifierCfg = self.dll.getClassifierCFGFile_visuell()
self.modi = "visuellesBCI"
elif(self.modi == "visuellesBCI"):
self.setTitle("taktiles BCI")
self.view.setChangeBtnText("Wechsel zu visuellen BCI")
self.view.setDefaultPath(self.dll.getDefaultPath_taktil())
self.pathOVFile = self.dll.getPathOVFile_taktil()
self.pathSpatialCfg = self.dll.getSpatialCFGFile_taktil()
self.pathClassifierCfg = self.dll.getClassifierCFGFile_taktil()
self.modi = "taktilesBCI"

def speichern(self):
@@ -214,7 +240,9 @@ class Controller():
Funktion CopySpelling aus.
'''
self.file = path
if self.file is "-1":
print(path)
if self.file == "-1":
print("kein gueltiger Pfad")
self.view.changeFrame("StartPage")
else:
if(self.modi == "taktilesBCI"):

BIN
UIController.pyc View File


+ 2
- 2
UIModellTaktil.py View File

@@ -91,7 +91,7 @@ class ModellTaktil(Modell):
'''
print("start training Xdawn")
self.controller.addInfoText('Starten des xDawn-Trainings -- ')
command = self.dll.getCommandXDawn().split(" ")
command = self.dll.getCommandXDawn_taktil().split(" ")
process = Popen(command, stdout=PIPE, universal_newlines=True)
self.openVibeAktiv = True
@@ -130,7 +130,7 @@ class ModellTaktil(Modell):
print("start training Classifier")
self.controller.addInfoText("Starten des Classifier-Trainings -- ")

command = self.dll.getCommandClassifier().split(" ")
command = self.dll.getCommandClassifier_taktil().split(" ")
process = Popen(command, stdout=PIPE, universal_newlines=True)

self.openVibeAktiv = True

BIN
UIModellTaktil.pyc View File


+ 2
- 2
UIModellVisuell.py View File

@@ -94,7 +94,7 @@ class ModellVisuell(Modell):
'''
print("start training Xdawn")
self.controller.addInfoText('Starten des XDawn/Trainings -- ')
command = self.dll.getCommandXDawn().split(" ")
command = self.dll.getCommandXDawn_visuell().split(" ")
process = Popen(command, stdout=PIPE, universal_newlines=True)

self.openVibeAktiv = True
@@ -129,7 +129,7 @@ class ModellVisuell(Modell):
'''
print("start training Classifier")
self.controller.addInfoText("Starten Classifier-Trainings -- ")
command = self.dll.getCommandClassifier().split(" ")
command = self.dll.getCommandClassifier_visuell().split(" ")
process = Popen(command, stdout=PIPE, universal_newlines=True)

self.openVibeAktiv = True

BIN
UIModellVisuell.pyc View File


+ 13
- 0
UIViewTKinter.py View File

@@ -82,6 +82,10 @@ class View(Tk):
self.controller.commandStop()
self.controller.stopAcquisitionServer()
print("destroy")
try:
self.dialog.destroy()
except:
pass
self.destroy()
@@ -150,6 +154,9 @@ class View(Tk):
def setChangeBtnText(self,text):
self.changeBtn["text"] = text

def setDefaultPath(self, path):
self.PATH_DEFAULT = path

def openfiledialog(self):
path = self.PATH_DEFAULT
#file = fd.askopenfilename(initialdir=path)
@@ -158,6 +165,12 @@ class View(Tk):

def savefiledialog(self):
self.dialog = Tk()

self.dialog.title("Visuelles Buchstabieren")
h = 100
w = 400
self.dialog.geometry('{}x{}'.format(w,h))
self.dialog.geometry("+{}+{}".format(100,200))
l = Label(self.dialog, text="Bitte geben Sie einen Speichernamen ein:")
eingabefeld = Entry(self.dialog)
okBtn = Button(self.dialog, text="OK", command=lambda:self.okBtn(eingabefeld.get()))

BIN
UIViewTKinter.pyc View File


+ 97
- 24
dll.cpp View File

@@ -4,21 +4,38 @@ using namespace std;

extern "C"{

//allgemein
//-------------------------------------------------------------------------------------------------------------------------------------
string PATH_OV = "meta/dist/Release/openvibe-designer.sh";
string PATH_AquisitionServer = "meta/dist/Release/openvibe-acquisition-server.sh";
string PATH_FILES = "Projekte/OpenViBE_visual_BCI-master/openvibe_visual_bci/";
string pathOVFile = "Projekte/OpenViBE_visual_BCI-master/openvibe_visual_bci/signals/p300-xdawn-train2.ov";
string pathClassifierCFG = "Projekte/OpenViBE_visual_BCI-master/openvibe_visual_bci/cfg/p300-classifier.cfg";
string pathSpatialCFG = "Projekte/OpenViBE_visual_BCI-master/openvibe_visual_bci/cfg/p300-spatial-filter.cfg";
string PATH_DEFAULT = "Projekte/OpenViBE_visual_BCI-master/openvibe_visual_bci/datasets";

string fileCopySpellingTaktil = "p300-visual-1-acquisition.xml";
string fileCopySpellingVisuell = "p300-visual-1-acquisition.xml";
string fileXDawnTraining = "p300-visual-2-train-xDAWN.xml";
string fileClassifierTraining = "p300-visual-3-train-classifier.xml";
string filefreeSpellingTaktil = "p300-visual-4-online.xml";

//visuell
//-------------------------------------------------------------------------------------------------------------------------------------
string PATH_FILES_Visual = "Projekte/OpenViBE_visual_BCI-master/openvibe_visual_bci/";
string pathOVFile_visuell = "Projekte/OpenViBE_visual_BCI-master/openvibe_visual_bci/signals/p300-xdawn-train2.ov";
string pathClassifierCFG_visuell = "Projekte/OpenViBE_visual_BCI-master/openvibe_visual_bci/cfg/p300-classifier.cfg";
string pathSpatialCFG_visuell = "Projekte/OpenViBE_visual_BCI-master/openvibe_visual_bci/cfg/p300-spatial-filter.cfg";
string PATH_DEFAULT_visuell = "Projekte/OpenViBE_visual_BCI-master/openvibe_visual_bci/datasets";

string fileCopySpellingVisuell = "p300-visual-1-acquisition.xml";
string filefreeSpellingVisuell = "p300-visual-4-online.xml";

//taktil
//------------------------------------------------------------------------------------------------------------------------------------
string fileCopySpellingTaktil = "p300-visual-1-acquisition.xml";
string filefreeSpellingTaktil = "p300-visual-4-online.xml";

string PATH_FILES_taktil = "Projekte/OpenViBE_visual_BCI-master/openvibe_visual_bci/";
string pathOVFile_taktil = "Projekte/OpenViBE_visual_BCI-master/openvibe_visual_bci/signals/p300-xdawn-train2.ov";
string pathClassifierCFG_taktil = "Projekte/OpenViBE_visual_BCI-master/openvibe_visual_bci/cfg/p300-classifier.cfg";
string pathSpatialCFG_taktil = "Projekte/OpenViBE_visual_BCI-master/openvibe_visual_bci/cfg/p300-spatial-filter.cfg";
string PATH_DEFAULT_taktil = "Projekte/OpenViBE_visual_BCI-master/openvibe_visual_bci/datasets";

//Befehle
//-------------------------------------------------------------------------------------------------------------------------------------
string command = "bash";
string nogui = "--no-gui";
string play = "--play";
@@ -36,7 +53,7 @@ extern "C"{
char* getCommandFreespellingTaktil()
{
string s = "";
s = s.append(command).append(" ").append(PATH_OV).append(" ").append( play).append(" ").append(PATH_FILES).append(filefreeSpellingTaktil).append(" ").append(nogui);
s = s.append(command).append(" ").append(PATH_OV).append(" ").append( play).append(" ").append(PATH_FILES_taktil).append(filefreeSpellingTaktil).append(" ").append(nogui);
char char_array[s.length()+1];
strcpy(char_array, s.c_str());
char* s_convert = char_array;
@@ -46,7 +63,7 @@ extern "C"{
char* getCommandFreespellingVisuell()
{
string s = "";
s = s.append(command).append(" ").append(PATH_OV).append(" ").append( play).append(" ").append(PATH_FILES).append(filefreeSpellingVisuell).append(" ").append(nogui);
s = s.append(command).append(" ").append(PATH_OV).append(" ").append( play).append(" ").append(PATH_FILES_Visual).append(filefreeSpellingVisuell).append(" ").append(nogui);
char char_array[s.length()+1];
strcpy(char_array, s.c_str());
char* s_convert = char_array;
@@ -56,7 +73,7 @@ extern "C"{
char* getCommandCopyspellingTaktil()
{
string s = "";
s = s.append(command).append(" ").append(PATH_OV).append(" ").append( play).append(" ").append(PATH_FILES).append(fileCopySpellingTaktil).append(" ").append(nogui);
s = s.append(command).append(" ").append(PATH_OV).append(" ").append( play).append(" ").append(PATH_FILES_taktil).append(fileCopySpellingTaktil).append(" ").append(nogui);
char char_array[s.length()+1];
strcpy(char_array, s.c_str());
char* s_convert = char_array;
@@ -66,27 +83,47 @@ extern "C"{
char* getCommandCopyspellingVisuell()
{
string s = "";
s = s.append(command).append(" ").append(PATH_OV).append(" ").append( play).append(" ").append(PATH_FILES).append(fileCopySpellingVisuell).append(" ").append(nogui);
s = s.append(command).append(" ").append(PATH_OV).append(" ").append( play).append(" ").append(PATH_FILES_Visual).append(fileCopySpellingVisuell).append(" ").append(nogui);
char char_array[s.length()+1];
strcpy(char_array, s.c_str());
char* s_convert = char_array;
return s_convert;
}

char* getCommandXDawn()
char* getCommandXDawn_taktil()
{
string s = "";
s = s.append(command).append(" ").append(PATH_OV).append(" ").append( play).append(" ").append(PATH_FILES).append(fileXDawnTraining).append(" ").append(nogui);
s = s.append(command).append(" ").append(PATH_OV).append(" ").append( play).append(" ").append(PATH_FILES_taktil).append(fileXDawnTraining).append(" ").append(nogui);
char char_array[s.length()+1];
strcpy(char_array, s.c_str());
char* s_convert = char_array;
return s_convert;
}

char* getCommandClassifier()
char* getCommandXDawn_visuell()
{
string s = "";
s = s.append(command).append(" ").append(PATH_OV).append(" ").append( play).append(" ").append(PATH_FILES).append(fileClassifierTraining).append(" ").append(nogui);
s = s.append(command).append(" ").append(PATH_OV).append(" ").append( play).append(" ").append(PATH_FILES_Visual).append(fileXDawnTraining).append(" ").append(nogui);
char char_array[s.length()+1];
strcpy(char_array, s.c_str());
char* s_convert = char_array;
return s_convert;
}

char* getCommandClassifier_visuell()
{
string s = "";
s = s.append(command).append(" ").append(PATH_OV).append(" ").append( play).append(" ").append(PATH_FILES_Visual).append(fileClassifierTraining).append(" ").append(nogui);
char char_array[s.length()+1];
strcpy(char_array, s.c_str());
char* s_convert = char_array;
return s_convert;
}

char* getCommandClassifier_taktil()
{
string s = "";
s = s.append(command).append(" ").append(PATH_OV).append(" ").append( play).append(" ").append(PATH_FILES_taktil).append(fileClassifierTraining).append(" ").append(nogui);
char char_array[s.length()+1];
strcpy(char_array, s.c_str());
char* s_convert = char_array;
@@ -103,36 +140,72 @@ extern "C"{
return s_convert;
}

char* getDefaultPath()
char* getDefaultPath_visuell()
{
string s = PATH_DEFAULT_visuell;
char char_array[s.length()+1];
strcpy(char_array, s.c_str());
char* s_convert = char_array;
return s_convert;
}

char* getDefaultPath_taktil()
{
string s = PATH_DEFAULT_taktil;
char char_array[s.length()+1];
strcpy(char_array, s.c_str());
char* s_convert = char_array;
return s_convert;
}

char* getPathOVFile_visuell()
{
string s = pathOVFile_visuell;
char char_array[s.length()+1];
strcpy(char_array, s.c_str());
char* s_convert = char_array;
return s_convert;
}

char* getSpatialCFGFile_visuell()
{
string s = pathSpatialCFG_visuell;
char char_array[s.length()+1];
strcpy(char_array, s.c_str());
char* s_convert = char_array;
return s_convert;
}

char* getClassifierCFGFile_visuell()
{
string s = PATH_DEFAULT;
string s = pathClassifierCFG_visuell;
char char_array[s.length()+1];
strcpy(char_array, s.c_str());
char* s_convert = char_array;
return s_convert;
}

char* getPathOVFile()
char* getPathOVFile_taktil()
{
string s = pathOVFile;
string s = pathOVFile_taktil;
char char_array[s.length()+1];
strcpy(char_array, s.c_str());
char* s_convert = char_array;
return s_convert;
}

char* getSpatialCFGFile()
char* getSpatialCFGFile_taktil()
{
string s = pathSpatialCFG;
string s = pathSpatialCFG_taktil;
char char_array[s.length()+1];
strcpy(char_array, s.c_str());
char* s_convert = char_array;
return s_convert;
}

char* getClassifierCFGFile()
char* getClassifierCFGFile_taktil()
{
string s = pathClassifierCFG;
string s = pathClassifierCFG_taktil;
char char_array[s.length()+1];
strcpy(char_array, s.c_str());
char* s_convert = char_array;

BIN
dll.so View File


BIN
gui View File


Loading…
Cancel
Save