Beispiel #1
0
        public EEGMetadata Parse(TCoh3 recordInformation)
        {
            this.eegInfos = new EEGInfos();
            this.eegInfos.duration = recordInformation.duration;
            this.eegInfos.frequency = recordInformation.frequency;
            this.eegInfos.numberOfSignals = recordInformation.electrodes;
            this.eegInfos.signals = new List<Signal>();

            for (int i = 0; i < recordInformation.electrodes; i++)
            {
                string name=string.Empty;
                for(int j=0;j<8;j++)
                {
                    name += recordInformation.name[i].name[j].ToString();
                }

                string unit = string.Empty;
                for (int j = 0; j < 4; j++)
                {
                    unit += recordInformation.unit[i].unit[j].ToString();
                }

                this.eegInfos.signals.Add(
                    new Signal {
                        label = string.Format("{0}_{1}", Convert.ToInt32(recordInformation.type[i]).ToString(), name.Replace("\0", "")),
                        theta= recordInformation.theta[i],
                        phi = recordInformation.phi[i],
                        r= recordInformation.r[i],
                        minanal = recordInformation.minanal[i],
                        maxanal = recordInformation.maxanal[i],
                        minconv = recordInformation.minconv[i],
                        maxconv = recordInformation.maxconv[i],
                        unit = unit.Replace("\0", "")
                });
            }

            string date = string.Empty;
            for (int j = 0; j < 20; j++)
            {
                date += recordInformation.date[j].ToString();
            }
            this.eegInfos.date = date.Replace("\0", "");

            return this;
        }
Beispiel #2
0
        public static TCoh3 ReadMetaInfo(string path)
        {
            // Create a new empty struct TCoh3
            // and set a ptr on it
            TCoh3  tcoh           = new TCoh3();
            IntPtr unmanagedAddr2 = Marshal.AllocHGlobal(Marshal.SizeOf(tcoh));

            Marshal.StructureToPtr(tcoh, unmanagedAddr2, false);

            int resp = _Eeg3_OpenFile(path, unmanagedAddr2);

            TCoh3 tcohres = (TCoh3)Marshal.PtrToStructure(unmanagedAddr2, typeof(TCoh3));

            // Unallocate memory
            Marshal.FreeHGlobal(unmanagedAddr2);
            unmanagedAddr2 = IntPtr.Zero;

            return(tcohres);
        }
Beispiel #3
0
        public static FileData Eeg3_OpenFile(String path)
        {
            TCoh3 metaInfo = ReadMetaInfo(path);
            int   nbValues = metaInfo.duration * metaInfo.frequency;

            short[,] eegMatrice = ReadEEG(nbValues, metaInfo.electrodes);


            //eegMatrice = null;

            FileNext();


            FileData fileData = new FileData {
                metaData = metaInfo, eegMatrice = eegMatrice, path = path
            };

            return(fileData);
        }
Beispiel #4
0
        public static string FileNext()
        {
            string path = "";

            // Create a new empty struct TCoh3
            // and set a ptr on it
            TCoh3 tcoh = new TCoh3();
            IntPtr unmanagedAddr2 = Marshal.AllocHGlobal(Marshal.SizeOf(tcoh));
            Marshal.StructureToPtr(tcoh, unmanagedAddr2, false);

            int resp = _Eeg3_NextFile(1, path, unmanagedAddr2);

            TCoh3 tcohres = (TCoh3)Marshal.PtrToStructure(unmanagedAddr2, typeof(TCoh3));

            // Unallocate memory
            Marshal.FreeHGlobal(unmanagedAddr2);
            unmanagedAddr2 = IntPtr.Zero;

            return path;
        }
Beispiel #5
0
        public static TCoh3 ReadMetaInfo(string path)
        {
            // Create a new empty struct TCoh3
            // and set a ptr on it
            TCoh3 tcoh = new TCoh3();
            IntPtr unmanagedAddr2 = Marshal.AllocHGlobal(Marshal.SizeOf(tcoh));
            Marshal.StructureToPtr(tcoh, unmanagedAddr2, false);

            int resp = _Eeg3_OpenFile(path, unmanagedAddr2);

            TCoh3 tcohres = (TCoh3)Marshal.PtrToStructure(unmanagedAddr2, typeof(TCoh3));

            // Unallocate memory
            Marshal.FreeHGlobal(unmanagedAddr2);
            unmanagedAddr2 = IntPtr.Zero;

            return tcohres;
        }