Example #1
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);
        }
Example #2
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);
        }