//private void signalBin() //{ // // WRITE // string[] Channelnames = { "CH1", "CH2" }; // UnisensFactory uf = UnisensFactoryBuilder.createFactory(); // Unisens u = uf.createUnisens(path); // SignalEntry se = u.createSignalEntry("signal.bin", new String[]{"A", "B"}, DataType.INT8, 250); // //short[][] A = new short[][] { { 1, 2, 3 }, { 4, 5, 6 } }; // BinFileFormat bff = se.createBinFileFormat(); // var A = new sbyte[][] { new sbyte[] { 1, 4 }, new sbyte[] { 2, 5 }, new sbyte[] { 3, 6 } }; // se.append(A); // //se.setAdcProperties(2048, 12, 0, 0.03); // //se.setComment("This is the first test..."); // //se.setContentClass("TEST"); // //se.setSource("TestSource"); // //se.setSourceId("23:34:12:34:23:12"); // //se.setUnit("mV"); // se.setAdcResolution(16); // se.setBaseline(0); // se.setAdcZero(0); // se.setComment("FhG - Elektroden "); // se.setContentClass("ECG"); // se.setDataType(DataType.INT16); // se.setSourceId("ecg_m500_250 .bin "); // se.setSource("FhG-Elektroden , ADS8345 "); // se.setUnit("uV"); // se.setLsbValue(1); // se.setSampleRate(250); // se.setChannelNames(Channelnames); // bff.setEndianess(Endianess.LITTLE); // u.save(); // u.closeAll(); // // READ // u = uf.createUnisens(path); // se = (SignalEntry)u.getEntry("signal.bin"); // if (se.getUnit() != "mV") // { // // ERROR // } // u.closeAll(); //} //private void signalXml() //{ // string[] Channelnames = { "CH1", "CH2" }; // UnisensFactory uf = UnisensFactoryBuilder.createFactory(); // Unisens u = uf.createUnisens(path); // SignalEntry se = u.createSignalEntry("signal.xml", new String[] { "A", "B" }, DataType.INT16, 250); // u.setMeasurementId("sampleData"); // u.setTimestampStart(DateTime.Now); // u.setComment("Example data set , derived from Holtervergleich_0001 ."); // var A = new short[][] { new short[] { 1, 4 }, new short[] { 2, 5 }, new short[] { 3, 6 } }; // se.setFileFormat(se.createXmlFileFormat()); // se.append(A); // se.setAdcResolution(16); // se.setBaseline(0); // se.setAdcZero(0); // se.setComment("FhG - Elektroden "); // se.setContentClass("ECG"); // se.setDataType(DataType.INT16); // se.setSourceId("ecg_m500_250 .xml "); // se.setSource("FhG-Elektroden , ADS8345 "); // se.setUnit("uV"); // se.setLsbValue(1); // se.setSampleRate(250); // se.setChannelNames(Channelnames); // u.save(); // u.closeAll(); // //se = (SignalEntry)u.getEntry("test_signal_1x12_UINT8.xml"); // //se.read(12); //} //private void signalCsv() //{ // string[] Channelnames = { "CH1", "CH2" }; // UnisensFactory uf = UnisensFactoryBuilder.createFactory(); // Unisens u = uf.createUnisens(path); // SignalEntry se = u.createSignalEntry("signal.csv", new String[] { "A", "B" }, DataType.INT16, 250); // u.setMeasurementId("sampleData"); // u.setTimestampStart(DateTime.Now); // u.setComment("Example data set , derived from Holtervergleich_0001 ."); // var A = new short[][] { new short[] { 1, 4 }, new short[] { 2, 5 }, new short[] { 3, 6 } }; // CsvFileFormat cff = se.createCsvFileFormat(); // cff.setSeparator(";"); // cff.setDecimalSeparator("."); // se.setFileFormat(cff); // se.append(A); // se.setAdcResolution(16); // se.setBaseline(0); // se.setAdcZero(0); // se.setComment("FhG - Elektroden "); // se.setContentClass("ECG"); // se.setDataType(DataType.INT16); // se.setSourceId("ecg_m500_250 .csv "); // se.setSource("FhG-Elektroden , ADS8345 "); // se.setUnit("uV"); // se.setLsbValue(1); // se.setSampleRate(250); // se.createBinFileFormat(); // se.setChannelNames(Channelnames); // u.save(); // u.closeAll(); //} //private void valuesCsv() //{ // UnisensFactory uf = UnisensFactoryBuilder.createFactory(); // Unisens u = uf.createUnisens(path); // ValuesEntry ve = u.createValuesEntry("values.csv", new String[] { "A", "B" }, DataType.INT16, 250); // u.setMeasurementId("sampleData"); // u.setTimestampStart(DateTime.Now); // u.setComment("Example data set , derived from Holtervergleich_0001 ."); // CsvFileFormat cff = ve.createCsvFileFormat(); // cff.setComment("csv , 2 channel "); // cff.setSeparator(";"); // cff.setDecimalSeparator("."); // ve.setFileFormat(cff); // var A = new short[][] { new short[] { 1, 4 }, new short[] { 2, 5 }, new short[] { 3, 32767 } }; // ValueList valueList = new ValueList(new long[3] { 1320, 22968, 30232 }, A); // ve.appendValuesList(valueList); // //ve.append(new Value(1320, new short[2] { 1, 4 })); // //ve.append(new Value(22968, new short[2] { 2, 5 })); // //ve.append(new Value(30232, new short[2] { 3, 32767 })); // ve.setContentClass("BLOODPRESSURE"); // ve.setSourceId("bloodpressure .csv"); // ve.setComment("Blutdruck "); // ve.setSampleRate(1); // ve.setLsbValue(1); // ve.setUnit("mmHg"); // ve.setDataType(DataType.INT16); // u.save(); // u.closeAll(); //} //private void valuesBin() //{ // string[] Channelnames = { "systolisch", "diastolisch" }; // UnisensFactory uf = UnisensFactoryBuilder.createFactory(); // Unisens u = uf.createUnisens(path); // ValuesEntry ve = u.createValuesEntry("values.bin", new String[] { "A", "B" }, DataType.INT8, 250); // u.setMeasurementId("sampleData"); // u.setTimestampStart(DateTime.Now); // u.setComment("Example data set , derived from Holtervergleich_0001 ."); // ve.setFileFormat(ve.createBinFileFormat()); // var A = new sbyte[][] { new sbyte[] { 1, 4 }, new sbyte[] { 2, 5 }, new sbyte[] { 3, 6 } }; // ValueList valueList = new ValueList(new long[3] {1320,22968,30232}, A); // ve.appendValuesList(valueList); // //ve.append(new Value(1320, new sbyte[2] { 1, 4 })); // //ve.append(new Value(22968, new sbyte[2] { 2, 5 })); // //ve.append(new Value(30232, new sbyte[2] { 3, 6 })); // ve.setContentClass("BLOODPRESSURE"); // ve.setSourceId("bloodpressure .csv"); // ve.setComment("Blutdruck "); // ve.setSampleRate(1); // ve.setLsbValue(1); // ve.setUnit("mmHg"); // ve.setDataType(DataType.INT16); // u.save(); // u.closeAll(); //} //private void valuesXml() //{ // UnisensFactory uf = UnisensFactoryBuilder.createFactory(); // Unisens u = uf.createUnisens(path); // ValuesEntry ve = u.createValuesEntry("values.xml", new String[] { "A", "B" }, DataType.INT16, 250); // u.setMeasurementId("sampleData"); // u.setTimestampStart(DateTime.Now); // u.setComment("Example data set , derived from Holtervergleich_0001 ."); // ve.setFileFormat(ve.createXmlFileFormat()); // ve.append(new Value(1320, new short[2] { 1, 4 })); // ve.append(new Value(22968, new short[2] { 2, 5 })); // ve.append(new Value(30232, new short[2] { 3, 6 })); // ve.setContentClass("BLOODPRESSURE"); // ve.setSourceId("bloodpressure .csv"); // ve.setComment("Blutdruck "); // ve.setSampleRate(1); // ve.setLsbValue(1); // ve.setUnit("mmHg"); // ve.setDataType(DataType.INT16); // u.save(); // u.closeAll(); //} private void eventCsv() { UnisensFactory uf = UnisensFactoryBuilder.createFactory(); Unisens u = uf.createUnisens(path); EventEntry ee = u.createEventEntry("event.csv", 1000); u.setMeasurementId("sampleData"); u.setTimestampStart(DateTime.Now); u.setComment("Example data set , derived from Holtervergleich_0001 ."); CsvFileFormat cff = ee.createCsvFileFormat(); cff.setSeparator(";"); cff.setDecimalSeparator("."); ee.setFileFormat(cff); List <Event> eventList = new List <Event>(); eventList.Add(new Event(124, "N", "NORMAL")); eventList.Add(new Event(346, "N", "NORMAL")); eventList.Add(new Event(523, "N", "NORMAL")); ee.append(eventList); ee.setComment("Reference trigger list "); ee.setContentClass("TRIGGER"); ee.setSourceId("trigger_reference .csv"); ee.setSampleRate(1000); ee.setSource("PADSY /M. Kirst "); ee.setTypeLength(1); u.save(); u.closeAll(); }
private void signalCsvDouble() { UnisensFactory uf = UnisensFactoryBuilder.createFactory(); Unisens u = uf.createUnisens("C:\\TestData"); SignalEntry se = u.createSignalEntry("signalD.csv", new String[] { "A", "B" }, DataType.DOUBLE, 250); double[][] A = new double[][] { new double[] { 1.3, 2.5, 3.2 }, new double[] { 4.3, 5.0, 6.123456 } }; CsvFileFormat cff = se.createCsvFileFormat(); cff.setSeparator(";"); cff.setDecimalSeparator(","); se.setFileFormat(cff); se.append(A); u.save(); u.closeAll(); }
private void signalCsv() { UnisensFactory uf = UnisensFactoryBuilder.createFactory(); Unisens u = uf.createUnisens("C:\\TestData"); SignalEntry se = u.createSignalEntry("signal.csv", new String[] { "A", "B" }, DataType.INT16, 250); short[][] A = new short[][] { new short[] { 1, 2, 3 }, new short[] { 4, 5, 6 } }; CsvFileFormat cff = se.createCsvFileFormat(); cff.setSeparator(";"); cff.setDecimalSeparator(","); se.setFileFormat(cff); se.append(A); u.save(); u.closeAll(); }
private void eventCsv() { UnisensFactory uf = UnisensFactoryBuilder.createFactory(); Unisens u = uf.createUnisens("C:\\TestData"); EventEntry ee = u.createEventEntry("event.csv", 1000); CsvFileFormat cff = ee.createCsvFileFormat(); cff.setSeparator(";"); cff.setDecimalSeparator("."); ee.setFileFormat(cff); ee.append(new Event(124, "N", "NORMAL")); ee.append(new Event(346, "N", "NORMAL")); ee.append(new Event(523, "V", "PVC")); u.save(); u.closeAll(); }
private void valuesCsv() { UnisensFactory uf = UnisensFactoryBuilder.createFactory(); Unisens u = uf.createUnisens("C:\\TestData"); ValuesEntry ve = u.createValuesEntry("values.csv", new String[] { "A", "B" }, DataType.INT16, 250); CsvFileFormat cff = ve.createCsvFileFormat(); cff.setSeparator(";"); cff.setDecimalSeparator("."); ve.setFileFormat(cff); ve.append(new Value(1320, new short[] { 1, 4 })); ve.append(new Value(22968, new short[] { 2, 5 })); ve.append(new Value(30232, new short[] { 3, 6 })); u.save(); u.closeAll(); }
private void valueTest(string fileFormat, DataType dataType) { UnisensFactory uf = UnisensFactoryBuilder.createFactory(); Unisens u = uf.createUnisens(path); string fileName = "value_" + dataType.ToString() + "." + fileFormat; ValuesEntry ve = u.createValuesEntry(fileName, new String[] { "A", "B" }, dataType, 250); switch (fileFormat) { case "bin": // BIN BinFileFormat bff = ve.createBinFileFormat(); bff.setEndianess(Endianess.LITTLE); ve.setFileFormat(bff); break; case "xml": // XML XmlFileFormat xff = ve.createXmlFileFormat(); ve.setFileFormat(xff); break; case "csv": // CSV CsvFileFormat cff = ve.createCsvFileFormat(); cff.setComment("csv , 2 channel "); cff.setSeparator(";"); cff.setDecimalSeparator("."); ve.setFileFormat(cff); break; } var samplestamp = new long[3] { 1320, 22968, 30232 }; switch (dataType) { case DataType.INT8: var A = new sbyte[][] { new sbyte[] { 127, 4 }, new sbyte[] { 2, 5 }, new sbyte[] { 3, 6 } }; ValueList valueList = new ValueList(samplestamp, A); ve.appendValuesList(valueList); break; case DataType.UINT8: var B = new short[][] { new short[] { 255, 4 }, new short[] { 2, 5 }, new short[] { 3, 6 } }; ValueList valueList1 = new ValueList(samplestamp, B); ve.appendValuesList(valueList1); break; case DataType.INT16: var C = new short[][] { new short[] { 32767, 4 }, new short[] { 2, 5 }, new short[] { 3, 6 } }; ValueList valueList2 = new ValueList(samplestamp, C); ve.appendValuesList(valueList2); break; case DataType.UINT16: var D = new int[][] { new int[] { 65535, 4 }, new int[] { 2, 5 }, new int[] { 3, 6 } }; ValueList valueList3 = new ValueList(samplestamp, D); ve.appendValuesList(valueList3); break; case DataType.INT32: var E = new int[][] { new int[] { 2147483647, 4 }, new int[] { 2, 5 }, new int[] { 3, 6 } }; ValueList valueList4 = new ValueList(samplestamp, E); ve.appendValuesList(valueList4); break; //case DataType.UINT32: // var F = new long[][] { new long[] { 4294967295, 4 }, new long[] { 2, 5 }, new long[] { 3, 6 } }; // ValueList valueList5 = new ValueList(samplestamp, F); // ve.appendValuesList(valueList5); // break; case DataType.FLOAT: var G = new float[][] { new float[] { 123.4567F, 4 }, new float[] { 2, 5 }, new float[] { 3, 6 } }; ValueList valueList6 = new ValueList(samplestamp, G); ve.appendValuesList(valueList6); break; case DataType.DOUBLE: var H = new double[][] { new double[] { 123.4567D, 4 }, new double[] { 2, 5 }, new double[] { 3, 6 } }; ValueList valueList7 = new ValueList(samplestamp, H); ve.appendValuesList(valueList7); break; } }