public static void loadConfigFile() { Preferences.Instance.configFile = XMLSerializer.DeserializeFile <Dictionary <string, string> >(GuiPreferences.Instance.WorkDirectory + "config.xml"); //GuiPreferences.Instance.WorkDirectory = Preferences.Instance.configFile["WorkDirectory"]; //same protocol safety check ProtocolSafetyCheck(); try { Preferences.Instance.dirList = new List <string>(Preferences.Instance.configFile["dirList"].Split(new[] { ',' })); } catch (Exception e) { GuiPreferences.Instance.setLog("WARNING: dirList missing must be an old version of config.xml, rerun this model"); } try { GuiPreferences.Instance.NormalizedType = (NormalizationType)Enum.Parse(typeof(NormalizationType), Preferences.Instance.configFile["NormalizationType"]); GuiPreferences.Instance.NudMovingWindow = Convert.ToDecimal(Preferences.Instance.configFile["NudMovingWindow"]); } catch (Exception e) { GuiPreferences.Instance.NormalizedType = NormalizationType.MinMax; GuiPreferences.Instance.setLog("WARNING: NormalizationType missing must be an old version of config.xml, rerun this model, defaulting to minmax"); } try { GuiPreferences.Instance.IgSelectionType = (IGType)Enum.Parse(typeof(IGType), Preferences.Instance.configFile["IgSelectionType"]); GuiPreferences.Instance.NudIGVoxelAmount = Convert.ToInt32(Preferences.Instance.configFile["NudIGVoxelAmount"]); GuiPreferences.Instance.NudIGThreshold = Convert.ToDecimal(Preferences.Instance.configFile["NudIGThreshold"]); if (GuiPreferences.Instance.IgSelectionType == IGType.Threshold) { GuiPreferences.Instance.setLog("Filtering using IG threshold: " + GuiPreferences.Instance.NudIGThreshold.ToString()); } else if (GuiPreferences.Instance.IgSelectionType == IGType.Voxels) { GuiPreferences.Instance.setLog("Filtering using IG Voxel Amount of: " + GuiPreferences.Instance.NudIGVoxelAmount.ToString()); } } catch (Exception e) { GuiPreferences.Instance.IgSelectionType = IGType.Threshold; GuiPreferences.Instance.NudIGThreshold = Convert.ToDecimal(Preferences.Instance.configFile["NudIGThreshold"]); GuiPreferences.Instance.NudIGVoxelAmount = 100; // default value GuiPreferences.Instance.setLog("WARNING: IG SELECTION TYPE is missing must be an old version of config.xml, rerun this model, defaulting to Threshold selection + correct threshold figure"); } GuiPreferences.Instance.FileType = (DataType)Enum.Parse(typeof(DataType), Preferences.Instance.configFile["dataType.rawValue"]); GuiPreferences.Instance.NudThreshold = Convert.ToDecimal(Preferences.Instance.configFile["NudThreshold"]); GuiPreferences.Instance.NudExtractFromTR = Convert.ToDecimal(Preferences.Instance.configFile["NudExtractFromTR"]); GuiPreferences.Instance.NudExtractToTR = Convert.ToDecimal(Preferences.Instance.configFile["NudExtractToTR"]); GuiPreferences.Instance.NudClassifyUsingTR = Convert.ToDecimal(Preferences.Instance.configFile["NudClassifyUsingTR"]); GuiPreferences.Instance.NudFilterEyeSlices = Convert.ToDecimal(Preferences.Instance.configFile["NudFilterEyeSlices"]); GuiPreferences.Instance.NudEyeSliceFirstLines = Convert.ToDecimal(Preferences.Instance.configFile["NudEyeSliceFirstLines"]); GuiPreferences.Instance.CbPeekHigherTRsIGChecked = Convert.ToBoolean(Preferences.Instance.configFile["CbPeekHigherTRsIGChecked"]); }
/// <summary> /// quick tests udp classification via weka's SMO /// </summary> /// <returns></returns> public bool testUdpWekaSMO() { if (UDPListenActive) { TrainingTesting_SharedVariables.binary.shouldStop = true; GuiPreferences.Instance.setLog("Stopping UDP"); } else { GuiPreferences.Instance.setLog("Starting UDP"); TrainingTesting_SharedVariables.binary.shouldStop = false; //GuiPreferences.Instance.WorkDirectory = @"H:\My_Dropbox\VERE\MRI_data\Tirosh\20113110.short.5th.exp.hands.legs.zscore.thought\6\rtp\"; //GuiPreferences.Instance.FileName = "tirosh-"; //GuiPreferences.Instance.FileType = OriBrainLearnerCore.dataType.rawValue; //GuiPreferences.Instance.ProtocolFile = @"H:\My_Dropbox\VERE\MRI_data\Tirosh\20113110.short.5th.exp.hands.legs.zscore.thought_LRF.prt"; // tirosh null movement processed for 204800 features + 1 class = 204801. /*GuiPreferences.Instance.WorkDirectory = @"H:\My_Dropbox\VERE\MRI_data\Tirosh\20120508.Rapid+NullClass.day2\1\rtp\"; * GuiPreferences.Instance.FileName = "tirosh-"; * GuiPreferences.Instance.FileType = OriBrainLearnerCore.dataType.rawValue; * GuiPreferences.Instance.ProtocolFile = @"H:\My_Dropbox\VERE\MRI_data\Tirosh\20120705.NullClass1_zbaseline.prt"; */ // magali classification /*GuiPreferences.Instance.WorkDirectory = @"H:\My_Dropbox\VERE\Experiment1\Kozin_Magali\20121231.movement.3.imagery.1\18-classification.movement\rtp\"; * GuiPreferences.Instance.FileName = "tirosh-"; * GuiPreferences.Instance.FileType = OriBrainLearnerCore.dataType.rawValue; * GuiPreferences.Instance.ProtocolFile = @"H:\My_Dropbox\VERE\MRI_data\Tirosh\20113110.short.5th.exp.hands.legs.zscore.thought_LRF.prt";*/ /// moshe sherf classification, 4 aggregated to test on 1. GuiPreferences.Instance.WorkDirectory = @"H:\My_Dropbox\VERE\Experiment1\Sherf_Moshe\20121010.movement.1\15_classification\rtp\"; GuiPreferences.Instance.FileName = "tirosh-"; GuiPreferences.Instance.FileType = OriBrainLearnerCore.DataType.rawValue; GuiPreferences.Instance.ProtocolFile = @"H:\My_Dropbox\VERE\MRI_data\Tirosh\20113110.short.5th.exp.hands.legs.zscore.thought_LRF.prt"; //read prot file Preferences.Instance.prot = new ProtocolManager(); //get all files in the path with this extention GuiManager.getFilePaths("*.vdat"); //update certain info GuiManager.updateFilePaths(); //assigned after we know what to assign from the protocol //PublicMethods.setClassesLabels(); GuiPreferences.Instance.CmbClass1Selected = 1; //left GuiPreferences.Instance.CmbClass2Selected = 2; //right //NEED TO ADD A VARIABLE FOR EVERY OPTION IN THE GUI. RAW VALUES. UNPROCESSED. MULTI CLASS. CROSS VALD, GRID, FOLDS, ETC... //and for every button a function! /*PublicMethods.clearProblem() ; * PublicMethods.clearSVM(); * PublicMethods.clearJob(); * GC.Collect();*/ //load a model for testing GuiPreferences.Instance.TrainType = TrainingType.Weka; GuiPreferences.Instance.setLog("Deserializing Model"); WekaTrainingMethods.loadModel(); double[][] rankedArray = XMLSerializer.DeserializeFile <double[][]>(GuiPreferences.Instance.WorkDirectory + "TrainSet_" + GuiPreferences.Instance.NudClassifyUsingTR.ToString() + "th_vectors_scaledCS_filteredIG_indices.xml"); for (int a = 0; a < rankedArray.Length; a++) { TrainingTesting_SharedVariables._trainTopIGFeatures[a] = Convert.ToInt32(rankedArray[a][0]); } //this should be done ONCE - move elsewhere. Preferences.Instance.fastvector = RealTimeProcessing.CreateFastVector(TrainingTesting_SharedVariables._trainTopIGFeatures.Length); //GuiPreferences.Instance.FromTR = from;// 264; //GuiPreferences.Instance.ToTR = 100;// 264; Preferences.Instance.currentUDPVector = 0; Preferences.Instance.udp.RegisterCallBack(TrainingTesting_SharedVariables.binary.loadRawDataUsing_UDP); //finally load //PublicMethods.binary.loadRawData(); /* * //register this function that deals with loading of the filenames * //BUT ONLY ONCE! * Preferences.Instance.pipeServer.registerEvent(PublicMethods.binary.loadRawDataUsingPipes_ReceiveData); * * //PublicMethods.binary.loadRawDataUsingPipes_SendData(); * * //* to automatically send data ever 2s as a simulation and to test the classes. * PublicMethods.binary.loadRawDataUsingPipes_SendDataTimer(); */ } UDPListenActive = !UDPListenActive; return(true); }