Пример #1
0
        public async Task TestFullFileWriteRead()
        {
            string filename = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "test2.h5");

            Console.WriteLine(filename);
            if (File.Exists(filename))
            {
                File.Delete(filename);
            }

            kama = new KamaAcquisitionFile(filename, AcquisitionInterface.Simulator, Logger);
            ProcedureInfo info = new ProcedureInfo
            {
                Age         = 18,
                FirstName   = "Lior",
                LastName    = "Banai",
                ExamDate    = DateTime.Now,
                Procedure   = "test",
                ProcedureID = "ID",
                Patient     = new PatientInfo()
            };

            kama.SavePatientInfo(info);
            kama.UpdateSystemInformation("32423423", new[] { "11", "12" });
            kama.SetProcedureInformation(info);
            string data = File.ReadAllText(AcquisitionScanProtocolPath);
            AcquisitionProtocolParameters parameters = AcquisitionProtocolParameters.FromJson(data);
            await kama.StartLogging(parameters);

            var ecgTask = WriteECGData(kama, 2, 1);
            var eitTask = WriteEITData(parameters, kama, 5, 1);
            var seTask  = WriteSystemEvents(kama);
            await Task.WhenAll(ecgTask, eitTask, seTask);

            var ecgTestData  = await ecgTask;
            var eitsTestData = await eitTask;

            kama.StopRecording();
            await kama.StopProcedure();


            using (KamaAcquisitionReadOnlyFile readFile = new KamaAcquisitionReadOnlyFile(filename))
            {
                readFile.ReadSystemInformation();
                readFile.ReadProcedureInformation();
                readFile.ReadPatientInformation();
                Assert.IsTrue(readFile.PatientInformation.Equals(kama.PatientInfo));
                Assert.IsTrue(readFile.ProcedureInformation.Equals(kama.ProcedureInformation));
                Assert.IsTrue(readFile.SystemInformation.Equals(kama.SystemInformation));

                readFile.ReadECGData();

                readFile.ReadEITData();
                Assert.IsTrue(readFile.EITs.SequenceEqual(eitsTestData));
                readFile.ReadSystemEvents();
                Assert.IsTrue(readFile.Events.Count == 100);
            }

            File.Delete(filename);
        }
Пример #2
0
        public async Task TestsSystemInformation()
        {
            string filename = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "TestsSystemInformation.h5");

            Console.WriteLine(filename);
            if (File.Exists(filename))
            {
                File.Delete(filename);
            }

            kama = new KamaAcquisitionFile(filename, AcquisitionInterface.Simulator, Logger);
            ProcedureInfo info = new ProcedureInfo
            {
                Age         = 18,
                FirstName   = "First",
                LastName    = "Last",
                ExamDate    = DateTime.Now,
                Procedure   = "test",
                ProcedureID = "ID",
                Patient     = new PatientInfo()
            };

            kama.SavePatientInfo(info);
            kama.UpdateSystemInformation("32423423", new[] { "11", "12" });
            await kama.StopProcedure();

            File.Delete(filename);
        }
Пример #3
0
        public async Task TestEventsWrite()
        {
            string filename = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "testEvents.h5");

            Console.WriteLine(filename);
            if (File.Exists(filename))
            {
                File.Delete(filename);
            }

            kama = new KamaAcquisitionFile(filename, AcquisitionInterface.Simulator, Logger);
            ProcedureInfo info = new ProcedureInfo
            {
                Age         = 18,
                FirstName   = "First",
                LastName    = "Last",
                ExamDate    = DateTime.Now,
                Procedure   = "test",
                ProcedureID = "ID",
                Patient     = new PatientInfo()
            };

            kama.SavePatientInfo(info);
            kama.UpdateSystemInformation("32423423", new[] { "11", "12" });
            string data = File.ReadAllText(AcquisitionScanProtocolPath);
            AcquisitionProtocolParameters parameters = AcquisitionProtocolParameters.FromJson(data);
            await kama.StartLogging(parameters);



            kama.StopRecording();
            await kama.StopProcedure();

            File.Delete(filename);
        }
Пример #4
0
        private void CreatePatientDetails(KamaAcquisitionFile file)
        {
            ProcedureInfo info = new ProcedureInfo
            {
                Age         = 18,
                FirstName   = "First",
                LastName    = "Last",
                ExamDate    = DateTime.Now,
                Procedure   = "test",
                ProcedureID = "ID",
                Patient     = new PatientInfo()
            };

            file.SavePatientInfo(info);
        }