Ejemplo n.º 1
0
        private void BinningCB_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            if (m_imager == null)
            {
                return;
            }

            m_camera.m_acqParams.HBin = vm.Binning;
            m_camera.m_acqParams.VBin = vm.Binning;

            m_imager.ConfigImageDisplaySurface(m_ID, m_camera.m_acqParams.BinnedFullImageWidth, m_camera.m_acqParams.BinnedFullImageHeight, false);

            UpdateImagingDictionary();

            m_imager.SetupFlatFieldCorrection(FLATFIELD_SELECT.USE_FLUOR, vm.Binning);
            m_imager.SetupFlatFieldCorrection(FLATFIELD_SELECT.USE_LUMI, vm.Binning);
        }
Ejemplo n.º 2
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);
        }