コード例 #1
0
ファイル: Recorder.cs プロジェクト: mgcarmueja/MPTCE
 /// <summary>
 /// 
 /// </summary>
 /// <param name="recordingObject"></param>
 public Recorder(Recording recordingObject)
     : base(0,true,false)
 {
     _recording = recordingObject;
     _recordingConfig = _recording.parameters;
     _recordingData = _recording.data;
 }
コード例 #2
0
        /// <summary>
        /// This constructor initializes a default configuration for the PlaybackDataProvider
        /// </summary>
        public PlaybackDataProvider()
            : base()
        {
            _framePeriod = 500000; //0.5 msec
            _framesPerTick = 200;
            _rnd = new Random();
            _timer = new FastTimer(3, (_framesPerTick * _framePeriod) / 1000000, GenerateFrame);

            //Iinitialization of anything related to loading playback data from file
            _loadedDataConfig = new RecordingConfig();
            _loadedData = new Recording(_loadedDataConfig);

            _fileReadWriters = new List<IFileReadWriter>();

            //Initialization of available IFileReadWriters
            _fileReadWriters.Add(new HDF5RecordingReadWriter());

            //Composing filter string
            _fileFilters = "";
            foreach (IFileReadWriter fileReadWriter in _fileReadWriters)
            {
                _fileFilters = _fileFilters + fileReadWriter.supportedFormats.ToString() + "|";
            }
            _fileFilters = _fileFilters + "All Files (*.*)|*.*";
        }
コード例 #3
0
ファイル: TrainingPackage.cs プロジェクト: mgcarmueja/MPTCE
 public TrainingPackage(RecordingConfig configuration)
 {
     _trainingSets = new List<DataSet>();
     _validationSets = new List<DataSet>();
     _movementCodes = new List<int>();
     recordingConfig = configuration;
 }
コード例 #4
0
ファイル: AcqModel.cs プロジェクト: mgcarmueja/MPTCE
        /// <summary>
        /// Basic attribute initialization. Full configuration must be performed by a client class using this model.
        /// </summary>
        public AcqModel()
        {
            this.PropertyChanged += AcqModel_PropertyChanged;
            recordingConfig = new RecordingConfig();
            recordedData = new Recording(recordingConfig);
            _acqPipeline = new Pipeline();
            dataProvider = "none";
            _selectedMovements = new ObservableCollection<Movement>();
            _selectedMovements.CollectionChanged += SelectedMovements_CollectionChanged;
            recordingValid = false;

            _fileReadWriters = new List<IFileReadWriter>();

            //Initialization of available IFileReadWriters
            _fileReadWriters.Add(new HDF5RecordingReadWriter());

            //Composing filter string
            fileFilters = "";

            foreach (IFileReadWriter fileReadWriter in _fileReadWriters)
            {
                fileFilters = fileFilters + fileReadWriter.supportedFormats.ToString() + "|";
            }

            fileFilters = fileFilters + "All Files (*.*)|*.*";
        }
コード例 #5
0
 /// <summary>
 /// Initializes a RecordingPlanModel form a RecordingConfig object and a list of strings with the basic movements
 /// Moreover, the RecordingPLanModel will subscribe to the events generated by the RecordingConfig object
 /// To update the view when required
 /// </summary>
 /// <param name="recordingConfig"></param>
 /// <param name="basicMovements"></param>
 public RecordingPlanViewModel(RecordingConfig recordingConfig, StringCollection basicMovements)
 {
     _recordingConfig = recordingConfig;
     recordingConfig.PropertyChanged += recordingConfig_PropertyChanged;
     _basicMovements = new string[basicMovements.Count];
     basicMovements.CopyTo(_basicMovements, 0);
     placeholderBitmap = Convert((Bitmap)Properties.Resources.ResourceManager.GetObject("nofoto"));
     completedBitmap = Convert((Bitmap)Properties.Resources.ResourceManager.GetObject("ok"));
     SetSelectedItem(-1);
 }
コード例 #6
0
        public override void Run()
        {
            recordingReadWriter = new HDF5RecordingReadWriter(new ConsoleMovementSelector(), Properties.Settings.Default.movementsList, Properties.Settings.Default.allowedMovements);
            RecordingConfig recordingConfig = new RecordingConfig();
            Recording recording = new Recording(recordingConfig);

            openFileDialog.Filter = recordingReadWriter.supportedFormats.ToString();

            if (openFileDialog.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                recordingReadWriter.ReadFile(openFileDialog.FileName,recording);
            }

            //And here we print out the contents of the recording.
        }
コード例 #7
0
ファイル: Recording.cs プロジェクト: mgcarmueja/MPTCE
 public Recording()
 {
     _data = new ObservableCollection<Frame>();
     _parameters = new RecordingConfig();
 }
コード例 #8
0
ファイル: Recording.cs プロジェクト: mgcarmueja/MPTCE
 public Recording(ObservableCollection<Frame> data, RecordingConfig parameters)
 {
     _data =  data;
     _parameters = parameters;
 }
コード例 #9
0
ファイル: AcqViewModel.cs プロジェクト: mgcarmueja/MPTCE
 /// <summary>
 /// Loads configuration form a Settings object into a recordingConfig object;
 /// </summary>
 /// <param name="recordingConfig"></param>
 /// <param name="settings"></param>
 private void LoadRecordingConfig(Settings settings, RecordingConfig recordingConfig)
 {
     recordingConfig.gain = settings.AcqDeviceGain;
     recordingConfig.maxVoltage = settings.AcqDeviceMaxV;
     recordingConfig.minVoltage = settings.AcqDeviceMinV;
     recordingConfig.nChannels = settings.AcqDeviceNChannels;
     recordingConfig.sampleFreq = settings.AcqDeviceSampleFreq;
     recordingConfig.scheduleActive = settings.AcqScheduleActive;
     recordingConfig.scheduleItemTime = settings.AcqScheduleItemTime;
     recordingConfig.repetitions = settings.AcqRepetitionsPerMovement;
     recordingConfig.scheduleWarmupItems = settings.AcqScheduleWarmupItems;
 }
コード例 #10
0
        public override void Run()
        {
            ThreadStart runMethod;
            Thread myThread;

            runMethod = new ThreadStart(GetRecordingStatusChange);
            myThread = new Thread(runMethod);

            _recordingConfig = new RecordingConfig();
            _recordingConfig.schedule.Add(new ScheduleItem(7,new ushort[] { 1, 3 }));
            _recordingConfig.schedule.Add(new ScheduleItem (0, new ushort[] { 0 }));
            _recordingConfig.schedule.Add(new ScheduleItem (9,new ushort[] { 1, 4 }));
            _recordingConfig.schedule.Add(new ScheduleItem (0,new ushort[] { 0 }));
            _recordingConfig.schedule.Add(new ScheduleItem (8,new ushort[] { 2, 3 }));
            _recordingConfig.schedule.Add(new ScheduleItem (0, new ushort[] { 0 }));
            _recordingConfig.schedule.Add(new ScheduleItem (10, new ushort[] { 2, 4 }));

            _recordingController = new AcquisitionController(_pipeline);
            _recordingController.dataProvider = _myDataProvider;
            _myDataProvider.recordingConfig = _recordingConfig;
            _recordingController.recordingConfig = _recordingConfig;

            _recordingController.StatusChanged += new EventHandler(RecordingStatusChange);
            _pipeline.StopPendingChanged += new EventHandler(StopPendingChange);
            _myDataProvider.StatusChanged += new EventHandler(DataProviderStatusChange);

            _pipeline.AddStage(_recordingController);
            _pipeline.AddStage(_outputDisplayer);

            _pipeline.Init();

            //Ather the pipeline (and consequently the stages) are initialised, we can already create the
            //thread that will read the status change queue of the RecordingController object HERE
            myThread.Start();

            _pipeline.Start();

            while (_recordingController.currentScheduleItem != -1)
            {
                //Wait for the RecordingController to finish the job
            }

            //The thread running GetRecordingStatusChange() is ready to finish or has already finished. We do things right
            //by waiting for it here.
            myThread.Join();

            if (_pipeline.stopPending)
            {
                Console.Out.WriteLine("Stopping pipeline on Run method...");
                _pipeline.Stop();
                Console.Out.WriteLine("Pipeline stopped!");
            }

            Console.WriteLine("\n\nRecordingController execution finished. Press <ENTER> to view the captured data.");
            Console.ReadLine();

            //printing results

            for (Int32 i = 0; i < _outputDisplayer.output.Count; i++)
            {
                Console.Out.WriteLine(_outputDisplayer.output.ElementAt(i));
            }

            _recordingController.StatusChanged -= new EventHandler(RecordingStatusChange);
            _pipeline.StopPendingChanged -= new EventHandler(StopPendingChange);
            _myDataProvider.StatusChanged -= new EventHandler(DataProviderStatusChange);
        }
コード例 #11
0
ファイル: RecordingConfig.cs プロジェクト: mgcarmueja/MPTCE
        /// <summary>
        /// Copies the configuration parameters from another RecordingConfig instance into this one
        /// </summary>
        /// <param name="copiedConfig"></param>
        public void Copy(RecordingConfig sourceConfig)
        {
            gain = sourceConfig.gain;
            maxVoltage = sourceConfig.maxVoltage;
            minVoltage = sourceConfig.minVoltage;
            nChannels = sourceConfig.nChannels;

            for (uint i = 0; i < channelMask.Length; i++)
                SetChannelEnable(i, sourceConfig.channelMask[i]);

            repetitions = sourceConfig.repetitions;
            sampleFreq = sourceConfig.sampleFreq;
            scheduleActive = sourceConfig.scheduleActive;
            scheduleItemnSamples = sourceConfig.scheduleItemnSamples;
            scheduleWarmupItems = sourceConfig.scheduleWarmupItems;
            thresholdSet.Copy(sourceConfig.thresholdSet);
        }
コード例 #12
0
ファイル: EMGDataProvider.cs プロジェクト: mgcarmueja/MPTCE
 public EMGDataProvider()
 {
     _isPaused = false;
     _loop = false;
     _recordingConfig = new RecordingConfig(2000, 8, 6, -1500, 1500);
 }
コード例 #13
0
ファイル: AcqModel.cs プロジェクト: mgcarmueja/MPTCE
        public void StopRecording()
        {
            _acqPipeline.Stop();

            if (detectThresholds)
            {
                RecordingConfig temp = new RecordingConfig();
                temp.Copy(recordingConfig);
                thresholdRecordingConfig = temp;
            }

            recordingValid = true;
        }