public void LoadFilters() { bool success = wgDB.GetAllExcitationFilters(); if (success) { VM.ExFilterList.Clear(); for (int i = 0; i < wgDB.m_filterList.Count; i++) { VM.ExFilterList.Add(wgDB.m_filterList[i]); } if (VM.ExFilterList.Count > 0) { VM.ExFilter = VM.ExFilterList[0]; } } success = wgDB.GetAllEmissionFilters(); if (success) { VM.EmFilterList.Clear(); for (int i = 0; i < wgDB.m_filterList.Count; i++) { VM.EmFilterList.Add(wgDB.m_filterList[i]); } if (VM.EmFilterList.Count > 0) { VM.EmFilter = VM.EmFilterList[0]; } } }
public void Configure(Imager _imager, int indicatorID, bool AllowCameraConfiguration, bool IsManualMode) { m_imager = _imager; m_camera = m_imager.m_camera; vm = new CameraSetupModel(m_imager, m_wgDB, AllowCameraConfiguration, IsManualMode); m_ID = indicatorID; if (IsManualMode) // if this is manual operation (i.e. NOT a verify, prep-for-run, operation), then enable filter changes based on combo-box changes { EmissionFilterCB.SelectionChanged += EmissionFilterCB_SelectionChanged; ExcitationFilterCB.SelectionChanged += ExcitationFilterCB_SelectionChanged; } /////////////////////////////////////////////////////////////////////////////////// // Set ImagingParamsStruct ImagingParamsStruct ips; if (m_imager.m_ImagingDictionary.ContainsKey(m_ID)) { ips = m_imager.m_ImagingDictionary[m_ID]; vm.Exposure = (int)(ips.exposure * 1000); vm.EMGain = ips.gain; vm.Binning = ips.binning; vm.MinCycleTime = m_imager.m_camera.GetCycleTime(); if (ips.cycleTime < vm.MinCycleTime) { vm.CycleTime = vm.MinCycleTime; } else { vm.CycleTime = ips.cycleTime; } FilterContainer filter; if (m_wgDB.GetEmissionFilterAtPosition(ips.emissionFilterPos, out filter)) { vm.EmFilter = filter; } else { vm.EmFilter = null; } if (m_wgDB.GetExcitationFilterAtPosition(ips.excitationFilterPos, out filter)) { vm.ExFilter = filter; } else { vm.ExFilter = null; } ips.histBitmap = BitmapFactory.New(m_imager.m_histogramImageWidth, m_imager.m_histogramImageHeight); HistImage.Source = ips.histBitmap; ips.ImageControl = ImageDisplayControl; ips.indicatorName = "Setup"; m_imager.m_ImagingDictionary[m_ID] = ips; m_imager.ConfigImageDisplaySurface(m_ID, m_camera.m_acqParams.BinnedFullImageWidth, m_camera.m_acqParams.BinnedFullImageHeight, false); } else { ips = new ImagingParamsStruct(); float exposure = 0; float accum = 0; float kin = 0; m_imager.m_camera.MyCamera.GetAcquisitionTimings(ref exposure, ref accum, ref kin); if (exposure < 0.002) { exposure = 0.002f; } ips.exposure = exposure; ips.binning = 1; ips.cycleTime = (int)(exposure * 1000) + 50; ips.emissionFilterPos = 0; ips.excitationFilterPos = 0; ips.experimentIndicatorID = m_ID; ips.flatfieldType = FLATFIELD_SELECT.NONE; ips.gain = 5; ips.histBitmap = BitmapFactory.New(m_imager.m_histogramImageWidth, m_imager.m_histogramImageHeight); HistImage.Source = ips.histBitmap; ips.ImageControl = ImageDisplayControl; ips.indicatorName = "Setup"; vm.EMGain = 1; vm.Binning = 1; vm.Exposure = (int)(ips.exposure * 1000); vm.CycleTime = GlobalVars.Instance.CameraDefaultCycleTime; vm.MinCycleTime = 100; m_wgDB.GetAllEmissionFilters(); if (m_wgDB.m_filterList.Count > 0) { vm.EmFilter = m_wgDB.m_filterList[0]; } else { vm.EmFilter = null; } m_wgDB.GetAllExcitationFilters(); if (m_wgDB.m_filterList.Count > 0) { vm.ExFilter = m_wgDB.m_filterList[0]; } else { vm.ExFilter = null; } m_imager.m_ImagingDictionary.Add(m_ID, ips); m_imager.ConfigImageDisplaySurface(m_ID, m_camera.m_acqParams.BinnedFullImageWidth, m_camera.m_acqParams.BinnedFullImageHeight, false); m_imager.m_lambda.MoveFilterABandCloseShutterA((byte)vm.ExFilter.PositionNumber, (byte)vm.EmFilter.PositionNumber, GlobalVars.Instance.FilterChangeSpeed, GlobalVars.Instance.FilterChangeSpeed); } /////////////////////////////////////////////////////////////////////////////////// // Set CameraParams and AcquisitionParams CameraParams cParams; AcquisitionParams aParams; m_imager.m_camera.GetCurrentCameraSettings(out cParams, out aParams); vm.Binning = aParams.HBin; vm.ApplyMask = m_imager.m_UseMask; vm.EmFilterList = m_imager.m_emFilterList; vm.ExFilterList = m_imager.m_exFilterList; vm.PreAmpGainIndex = cParams.PreAmpGainIndex; vm.UseEMAmp = cParams.UseEMAmp; vm.UseFrameTransfer = cParams.UseFrameTransfer; vm.VertClockAmpIndex = cParams.VertClockAmpIndex; vm.VSSIndex = cParams.VSSIndex; vm.HSSIndex = cParams.HSSIndex; vm.SliderLowPosition = 0.0; vm.SliderHighPosition = 100.0; if (ips.optimizeWellList != null) { vm.WellSelectionPBLabel = ips.optimizeWellList.Count.ToString(); } else { vm.WellSelectionPBLabel = (m_imager.m_mask.Rows * m_imager.m_mask.Cols).ToString(); } if (m_imager.m_mask == null) { m_imager.SetMask(null); } this.DataContext = vm; m_imager.m_imagerEvent += m_imager_m_imagerEvent; m_camera.m_cameraParams.Updated += m_cameraParams_Updated; m_camera.m_acqParams.Updated += m_acqParams_Updated; RangeSlider.RangeChanged += RangeSlider_RangeChanged; m_imager.m_lambda.MoveFilterABandCloseShutterA((byte)vm.ExFilter.PositionNumber, (byte)vm.EmFilter.PositionNumber, GlobalVars.Instance.FilterChangeSpeed, GlobalVars.Instance.FilterChangeSpeed); }
// Constructor public CameraSetupModel(Imager imager, WaveguideDB wgDB, bool AllowCameraConfiguration, bool _isManualMode) { if (imager == null) { return; } if (imager.m_camera == null) { return; } myImager = imager; myCamera = MyImager.m_camera; myWgDB = wgDB; myCamera.GetCameraCapabilities(); // make sure camera properties are updated myWgDB.GetAllCameraSettings(); // make sure camera settings list in wgDB is populated cameraSettingsList = myWgDB.m_cameraSettingsList; if (CameraSettingsList.Count > 0) { CurrentCameraSettings = CameraSettingsList.ElementAt(0); } else { CurrentCameraSettings = new CameraSettingsContainer(); CurrentCameraSettings.CameraSettingID = 0; CurrentCameraSettings.VSSIndex = 0; CurrentCameraSettings.HSSIndex = 0; CurrentCameraSettings.VertClockAmpIndex = 0; CurrentCameraSettings.UseEMAmp = true; CurrentCameraSettings.UseFrameTransfer = true; CurrentCameraSettings.Description = ""; CurrentCameraSettings.IsDefault = true; CurrentCameraSettings.StartingExposure = 2; CurrentCameraSettings.ExposureLimit = 1000; CurrentCameraSettings.HighPixelThresholdPercent = 80; CurrentCameraSettings.LowPixelThresholdPercent = 10; // 60 if !IncreasingSignal (i.e. a decreasing signal) CurrentCameraSettings.MinPercentPixelsAboveLowThreshold = 50; CurrentCameraSettings.MaxPercentPixelsAboveHighThreshold = 10; CurrentCameraSettings.IncreasingSignal = true; CurrentCameraSettings.StartingBinning = 1; CurrentCameraSettings.EMGainLimit = 300; } cameraParams = MyCamera.m_cameraParams; acqParams = MyCamera.m_acqParams; exposure = 1; isOptimizing = false; // set camera capabilities vsspeeds = MyCamera.VSSpeeds; vertClockVoltageAmplitudes = MyCamera.VertClockVoltageAmplitudes; hsspeeds_EM = MyCamera.HSSpeeds_EM; hsspeeds_Conv = MyCamera.HSSpeeds_Conv; if (cameraParams.UseEMAmp) { hsspeeds = hsspeeds_EM; } else { hsspeeds = hsspeeds_Conv; } emGain_LowLimit = MyCamera.EMGain_LowLimit; emGain_HighLimit = MyCamera.EMGain_HighLimit; preAmpGains = MyCamera.PreAmpGains; binningOptions = MyCamera.BinningOptions; // get Camera Parameters cameraParams = MyCamera.m_cameraParams; // get Acquisition Parameters acqParams = MyCamera.m_acqParams; showConfigPanel = false; // start with configuration panel hidden enableConfig = AllowCameraConfiguration; // if false, hides the configuration tab so that configuration cannot be performed isManualMode = _isManualMode; applyMask = true; myWgDB.GetAllExcitationFilters(); exFilterList = new ObservableCollection <FilterContainer>(); foreach (FilterContainer fc in myWgDB.m_filterList) { if (fc.FilterChanger == 1) { exFilterList.Add(fc); } } exFilter = exFilterList[0]; myWgDB.GetAllEmissionFilters(); emFilterList = new ObservableCollection <FilterContainer>(); foreach (FilterContainer fc in myWgDB.m_filterList) { if (fc.FilterChanger == 0) { emFilterList.Add(fc); } } emFilter = emFilterList[0]; sliderLowPosition = 0.0; sliderHighPosition = 100.0; cycleTime = 1; minCycleTime = 1; maxCycleTime = 10000; WellSelectionPBLabel = ""; flatFieldCorrectionItems = new ObservableCollection <FlatFieldCorrectionItem>(); flatFieldCorrectionItems.Add(new FlatFieldCorrectionItem("None", FLATFIELD_SELECT.NONE)); flatFieldCorrectionItems.Add(new FlatFieldCorrectionItem("Fluorescent", FLATFIELD_SELECT.USE_FLUOR)); flatFieldCorrectionItems.Add(new FlatFieldCorrectionItem("Luminescent", FLATFIELD_SELECT.USE_LUMI)); flatFieldSelect = flatFieldCorrectionItems[0]; }