예제 #1
0
        void PhosphorescenceMeasurementCompleteCallback(object sender, object result)
        {
            _measurementMode = MEASUREMENT_MODE.NONE;
            if (Object.ReferenceEquals(sender.GetType(), _cameraVM.GetType()))
            {
                _camPhosActive  = false;
                _camPhosResults = (CamPhosResults)result;
            }

            if (!_camPhosActive)
            {
                ShowPhosResults();
            }
        }
예제 #2
0
        void StartN3Fluorescence()
        {
            if (CheckSaveFileExists("_FL.bmp"))
            {
                var saveDlg = new View.SaveFolderWindow(_saveFolderName, "_FL.bmp");
                saveDlg.ShowDialog();
                if (!saveDlg.SaveFolderNameSet)
                {
                    return;
                }
                _saveFolderName = saveDlg.SaveFolderName;
                GlobalVariables.globalSettings.SaveFolderName = saveDlg.SaveFolderName;
            }

            var res = MessageBox.Show("Please confirm that the long wave UV is on and then press OK to continue.", "Long Wave UV On",
                                      MessageBoxButton.OKCancel);

            if (res == MessageBoxResult.Cancel)
            {
                return;
            }

            Callback WhenMeasurementEnds = N3FluorescenceCompleteCallback;

            _camPhosResults = new CamPhosResults(0, new List <PtGreyCameraImage>());
            string error = "";

            List <double> shutterTimes = Properties.Settings.Default.N3FlMeasurementShutterTimes.Split(',').
                                         Select(r => Convert.ToDouble(r)).ToList();

            _camPhosActive = _cameraVM.StartN3Fluorescence(shutterTimes, Properties.Settings.Default.N3FlMeasurementGain,
                                                           WhenMeasurementEnds, out error);

            if (!_camPhosActive)
            {
                MessageBox.Show(error, "Image Capture not started");
                return;
            }

            _measurementMode = MEASUREMENT_MODE.N3_FL;

            _statusVM.Busy++;
            DateTime timestamp = DateTime.Now;
            var      sts       = new StatusMessage {
                Timestamp = timestamp, Message = "Image capture is active."
            };

            _statusVM.Messages.Add(sts);
            _timestamps.Push(timestamp);
        }
예제 #3
0
        void StartPhosphorescence()
        {
            if (CheckSaveFileExists("_PHOS.bmp"))
            {
                var saveDlg = new View.SaveFolderWindow(_saveFolderName, "_PHOS.bmp");
                saveDlg.ShowDialog();
                if (!saveDlg.SaveFolderNameSet)
                {
                    return;
                }
                _saveFolderName = saveDlg.SaveFolderName;
                GlobalVariables.globalSettings.SaveFolderName = saveDlg.SaveFolderName;
            }

            string   error = "";
            Callback WhenMeasurementEnds = PhosphorescenceMeasurementCompleteCallback;

            _camPhosResults = new CamPhosResults(0, new List <PtGreyCameraImage>());

            _camPhosActive = _cameraVM.StartPhosphorescenceMeasurement(Properties.Settings.Default.PhosMeasurementStartDelayUs,
                                                                       Properties.Settings.Default.PhosMeasurementImageCount,
                                                                       Properties.Settings.Default.PhosMeasurementShutterTime, Properties.Settings.Default.PhosMeasurementGain,
                                                                       WhenMeasurementEnds, out error);

            if (!_camPhosActive)
            {
                MessageBox.Show(error, "Phosphorescence measurement not started");
                return;
            }

            if (!Arduino.PhosphorescenceOn())
            {
                _cameraVM.AbortPhosMeasurement();

                MessageBox.Show("Serial Port Error... You may have to reset the camera.", "Aborting...");
            }
            else
            {
                _measurementMode = MEASUREMENT_MODE.PHOS;
                _statusVM.Busy++;
                DateTime timestamp = DateTime.Now;
                var      sts       = new StatusMessage {
                    Timestamp = timestamp, Message = "Phosphorescence measurement is active."
                };
                _statusVM.Messages.Add(sts);
                _timestamps.Push(timestamp);
            }
        }
예제 #4
0
        void N3FluorescenceCompleteCallback(object sender, object result)
        {
            _measurementMode = MEASUREMENT_MODE.NONE;
            MessageBox.Show("Please turn off the long wave UV", "Long Wave UV Off");

            if (Object.ReferenceEquals(sender.GetType(), _cameraVM.GetType()))
            {
                _camPhosActive  = false;
                _camPhosResults = (CamPhosResults)result;
            }

            if (!_camPhosActive)
            {
                ShowN3FluorescenceResults();
            }
        }
예제 #5
0
        void WhiteLightCompleteCallback(object sender, object result)
        {
            _measurementMode = MEASUREMENT_MODE.NONE;
            MessageBox.Show("Please turn off the white light", "White Light Off");

            if (Object.ReferenceEquals(sender.GetType(), _cameraVM.GetType()))
            {
                _camPhosActive  = false;
                _camPhosResults = (CamPhosResults)result;
            }

            if (!_camPhosActive)
            {
                ShowWhiteLightResults();
            }
        }
예제 #6
0
        public void LoadCameraImages(CamPhosResults results)
        {
            _phosImageList     = new List <BitmapSource>();
            _imageFilePathList = new List <string>();
            for (int i = 0; i < results.Images.Count; i++)
            {
                //handle file drop in data context
                _phosImageList.Add(BitmapToBitmapSource(results.Images[i].Image));
                _imageFilePathList.Add("Frame Id:" + results.Images[i].FrameId +
                                       ", Timestamp delta [ms]:" + Math.Round((results.Images[i].TimeStamp - results.StartTimeStamp) / 1000000d, 0));
            }

            if (_phosImageList.Count > 0)
            {
                PhosImageListIndex = 1;
            }
            else
            {
                PhosImageListIndex = 0;
            }
        }
예제 #7
0
        void DeepUVFluorescenceCompleteCallback(object sender, object result)
        {
            _measurementMode = MEASUREMENT_MODE.NONE;
            //MessageBox.Show("Please turn off the Deep UV", "Deep Off");

            // TODO: arduino light off
            if (!Arduino.End())
            {
                MessageBox.Show("Serial Port Error... You may have to reset the camera for next measurement.", "...");
            }

            if (Object.ReferenceEquals(sender.GetType(), _cameraVM.GetType()))
            {
                _camPhosActive  = false;
                _camPhosResults = (CamPhosResults)result;
            }

            if (!_camPhosActive)
            {
                ShowDeepUVFluorescenceResults();
            }
        }
예제 #8
0
        void StartDeepUVFluorescence(int index)
        {
            indexUV = index;
            if (index == 0)
            {
                if (CheckSaveFileExists("_UV.bmp"))
                {
                    var saveDlg = new View.SaveFolderWindow(_saveFolderName, "_UV.bmp");
                    saveDlg.ShowDialog();
                    if (!saveDlg.SaveFolderNameSet)
                    {
                        return;
                    }
                    _saveFolderName = saveDlg.SaveFolderName;
                    GlobalVariables.globalSettings.SaveFolderName = saveDlg.SaveFolderName;
                }
            }
            else if (index == 1)
            {
                if (CheckSaveFileExists("_UV2.bmp"))
                {
                    var saveDlg = new View.SaveFolderWindow(_saveFolderName, "_UV2.bmp");
                    saveDlg.ShowDialog();
                    if (!saveDlg.SaveFolderNameSet)
                    {
                        return;
                    }
                    _saveFolderName = saveDlg.SaveFolderName;
                }
            }

            //var res = MessageBox.Show("Please confirm that the deep UV is on and then press OK to continue.", "Deep UV On",
            //    MessageBoxButton.OKCancel);

            //if (res == MessageBoxResult.Cancel)
            //    return;
            // TODO: arduino light on
            if (!Arduino.FluorescenceOn())
            {
                _cameraVM.AbortDeepUVFluorescence();

                MessageBox.Show("Serial Port Error... You may have to reset the camera.", "Aborting...");

                return;
            }

            Callback WhenMeasurementEnds = DeepUVFluorescenceCompleteCallback;

            _camPhosResults = new CamPhosResults(0, new List <PtGreyCameraImage>());
            string error = "";
            // TODO: settings for deep uv
            List <double> shutterTimes = Properties.Settings.Default.DeepUVFlMeasurementShutterTimes.Split(',').
                                         Select(r => Convert.ToDouble(r)).ToList();

            _camPhosActive = _cameraVM.StartDeepUVFluorescence(shutterTimes, Properties.Settings.Default.DeepUVFlMeasurementGain,
                                                               WhenMeasurementEnds, out error);

            if (!_camPhosActive)
            {
                MessageBox.Show(error, "Image Capture not started");
                return;
            }

            if (index == 0)
            {
                _measurementMode = MEASUREMENT_MODE.DP_FL;
            }
            else if (index == 1)
            {
                _measurementMode = MEASUREMENT_MODE.DP_FL2;
            }

            _statusVM.Busy++;
            DateTime timestamp = DateTime.Now;
            var      sts       = new StatusMessage {
                Timestamp = timestamp, Message = "Image capture is active."
            };

            _statusVM.Messages.Add(sts);
            _timestamps.Push(timestamp);
        }
예제 #9
0
        void StartDarkBG()
        {
            if (CheckSaveFileExists("_DB.bmp"))
            {
                var saveDlg = new View.SaveFolderWindow(_saveFolderName, "_DB.bmp");
                saveDlg.ShowDialog();
                if (!saveDlg.SaveFolderNameSet)
                {
                    return;
                }
                _saveFolderName = saveDlg.SaveFolderName;
                GlobalVariables.globalSettings.SaveFolderName = saveDlg.SaveFolderName;
            }

            var res = MessageBox.Show("Please confirm that the all light is off and then press OK to continue.", "Light Off",
                                      MessageBoxButton.OKCancel);

            if (res == MessageBoxResult.Cancel)
            {
                return;
            }

            Callback WhenMeasurementEnds = DarkBGCompleteCallback;

            _camPhosResults = new CamPhosResults(0, new List <PtGreyCameraImage>());
            string error = "";

            //TODO: property settings
            List <List <double> > shutterTimesDarkBG = new List <List <double> >();

            List <double> shutterTimesFL = Properties.Settings.Default.N3FlMeasurementShutterTimes.Split(',').
                                           Select(r => Convert.ToDouble(r)).ToList();
            List <double> shutterTimesDP = Properties.Settings.Default.DeepUVFlMeasurementShutterTimes.Split(',').
                                           Select(r => Convert.ToDouble(r)).ToList();

            shutterTimesDarkBG.Add(shutterTimesFL);
            shutterTimesDarkBG.Add(shutterTimesDP);

            List <double> gainsDarkBG = new List <double>();

            gainsDarkBG.Add(Properties.Settings.Default.N3FlMeasurementGain);
            gainsDarkBG.Add(Properties.Settings.Default.PhosMeasurementGain);

            _camPhosActive = _cameraVM.StartDarkBG(shutterTimesDarkBG, gainsDarkBG,
                                                   WhenMeasurementEnds, out error);

            if (!_camPhosActive)
            {
                MessageBox.Show(error, "Image Capture not started");
                return;
            }

            _measurementMode = MEASUREMENT_MODE.DARK_BG;

            _statusVM.Busy++;
            DateTime timestamp = DateTime.Now;
            var      sts       = new StatusMessage {
                Timestamp = timestamp, Message = "Image capture is active."
            };

            _statusVM.Messages.Add(sts);
            _timestamps.Push(timestamp);
        }