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



self.getSharedLibrary() self.getSharedLibrary()


self.view = viewTkinter.View(self, self.dll.getDefaultPath())
self.view = viewTkinter.View(self, self.dll.getDefaultPath_visuell())
self.modi = "visuellesBCI" 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.infotext = ""


self.commands = { self.commands = {
self.dll.getCommandCopyspellingVisuell.argtypes = [] self.dll.getCommandCopyspellingVisuell.argtypes = []
self.dll.getCommandCopyspellingVisuell.restype = ctypes.c_char_p 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.argtypes = []
self.dll.getCommandStartAquisitionServer.restype = ctypes.c_char_p self.dll.getCommandStartAquisitionServer.restype = ctypes.c_char_p
if(self.modi == "taktilesBCI"): if(self.modi == "taktilesBCI"):
self.view.setChangeBtnText("Wechsel zu taktilen BCI") self.view.setChangeBtnText("Wechsel zu taktilen BCI")
self.view.setTitleText("visuelles 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" self.modi = "visuellesBCI"
elif(self.modi == "visuellesBCI"): elif(self.modi == "visuellesBCI"):
self.setTitle("taktiles BCI") self.setTitle("taktiles BCI")
self.view.setChangeBtnText("Wechsel zu visuellen 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" self.modi = "taktilesBCI"


def speichern(self): def speichern(self):
Funktion CopySpelling aus. Funktion CopySpelling aus.
''' '''
self.file = path self.file = path
if self.file is "-1":
print(path)
if self.file == "-1":
print("kein gueltiger Pfad")
self.view.changeFrame("StartPage") self.view.changeFrame("StartPage")
else: else:
if(self.modi == "taktilesBCI"): if(self.modi == "taktilesBCI"):

BIN
UIController.pyc View File


+ 2
- 2
UIModellTaktil.py View File

''' '''
print("start training Xdawn") print("start training Xdawn")
self.controller.addInfoText('Starten des xDawn-Trainings -- ') 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) process = Popen(command, stdout=PIPE, universal_newlines=True)
self.openVibeAktiv = True self.openVibeAktiv = True
print("start training Classifier") print("start training Classifier")
self.controller.addInfoText("Starten des Classifier-Trainings -- ") 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) process = Popen(command, stdout=PIPE, universal_newlines=True)


self.openVibeAktiv = True self.openVibeAktiv = True

BIN
UIModellTaktil.pyc View File


+ 2
- 2
UIModellVisuell.py View File

''' '''
print("start training Xdawn") print("start training Xdawn")
self.controller.addInfoText('Starten des XDawn/Trainings -- ') 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) process = Popen(command, stdout=PIPE, universal_newlines=True)


self.openVibeAktiv = True self.openVibeAktiv = True
''' '''
print("start training Classifier") print("start training Classifier")
self.controller.addInfoText("Starten Classifier-Trainings -- ") 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) process = Popen(command, stdout=PIPE, universal_newlines=True)


self.openVibeAktiv = True self.openVibeAktiv = True

BIN
UIModellVisuell.pyc View File


+ 13
- 0
UIViewTKinter.py View File

self.controller.commandStop() self.controller.commandStop()
self.controller.stopAcquisitionServer() self.controller.stopAcquisitionServer()
print("destroy") print("destroy")
try:
self.dialog.destroy()
except:
pass
self.destroy() self.destroy()
def setChangeBtnText(self,text): def setChangeBtnText(self,text):
self.changeBtn["text"] = text self.changeBtn["text"] = text


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

def openfiledialog(self): def openfiledialog(self):
path = self.PATH_DEFAULT path = self.PATH_DEFAULT
#file = fd.askopenfilename(initialdir=path) #file = fd.askopenfilename(initialdir=path)


def savefiledialog(self): def savefiledialog(self):
self.dialog = Tk() 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:") l = Label(self.dialog, text="Bitte geben Sie einen Speichernamen ein:")
eingabefeld = Entry(self.dialog) eingabefeld = Entry(self.dialog)
okBtn = Button(self.dialog, text="OK", command=lambda:self.okBtn(eingabefeld.get())) okBtn = Button(self.dialog, text="OK", command=lambda:self.okBtn(eingabefeld.get()))

BIN
UIViewTKinter.pyc View File


+ 97
- 24
dll.cpp View File



extern "C"{ extern "C"{


//allgemein
//-------------------------------------------------------------------------------------------------------------------------------------
string PATH_OV = "meta/dist/Release/openvibe-designer.sh"; string PATH_OV = "meta/dist/Release/openvibe-designer.sh";
string PATH_AquisitionServer = "meta/dist/Release/openvibe-acquisition-server.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 fileXDawnTraining = "p300-visual-2-train-xDAWN.xml";
string fileClassifierTraining = "p300-visual-3-train-classifier.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"; 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 command = "bash";
string nogui = "--no-gui"; string nogui = "--no-gui";
string play = "--play"; string play = "--play";
char* getCommandFreespellingTaktil() char* getCommandFreespellingTaktil()
{ {
string s = ""; 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]; char char_array[s.length()+1];
strcpy(char_array, s.c_str()); strcpy(char_array, s.c_str());
char* s_convert = char_array; char* s_convert = char_array;
char* getCommandFreespellingVisuell() char* getCommandFreespellingVisuell()
{ {
string s = ""; 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]; char char_array[s.length()+1];
strcpy(char_array, s.c_str()); strcpy(char_array, s.c_str());
char* s_convert = char_array; char* s_convert = char_array;
char* getCommandCopyspellingTaktil() char* getCommandCopyspellingTaktil()
{ {
string s = ""; 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]; char char_array[s.length()+1];
strcpy(char_array, s.c_str()); strcpy(char_array, s.c_str());
char* s_convert = char_array; char* s_convert = char_array;
char* getCommandCopyspellingVisuell() char* getCommandCopyspellingVisuell()
{ {
string s = ""; 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]; char char_array[s.length()+1];
strcpy(char_array, s.c_str()); strcpy(char_array, s.c_str());
char* s_convert = char_array; char* s_convert = char_array;
return s_convert; return s_convert;
} }


char* getCommandXDawn()
char* getCommandXDawn_taktil()
{ {
string s = ""; 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]; char char_array[s.length()+1];
strcpy(char_array, s.c_str()); strcpy(char_array, s.c_str());
char* s_convert = char_array; char* s_convert = char_array;
return s_convert; return s_convert;
} }


char* getCommandClassifier()
char* getCommandXDawn_visuell()
{ {
string s = ""; 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]; char char_array[s.length()+1];
strcpy(char_array, s.c_str()); strcpy(char_array, s.c_str());
char* s_convert = char_array; char* s_convert = char_array;
return s_convert; 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]; char char_array[s.length()+1];
strcpy(char_array, s.c_str()); strcpy(char_array, s.c_str());
char* s_convert = char_array; char* s_convert = char_array;
return s_convert; return s_convert;
} }


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


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


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

BIN
dll.so View File


BIN
gui View File


Loading…
Cancel
Save