private void MeasureCurrentPSF() { if (m_PSFFit == null) { return; } float aperture = (float)nudMeasuringAperture.Value; using (Graphics g = Graphics.FromImage(picPixels.Image)) { m_PSFFit.DrawDataPixels(g, new Rectangle(0, 0, picPixels.Width, picPixels.Height), aperture, Pens.Lime, m_Bpp, m_NormVal); g.Save(); } picPixels.Invalidate(); int centerX = (int)Math.Round(m_PSFFit.XCenter); int centerY = (int)Math.Round(m_PSFFit.YCenter); uint[,] data = m_VideoController.GetCurrentAstroImage(false).GetMeasurableAreaPixels(centerX, centerY, 17); uint[,] bagPixels = m_VideoController.GetCurrentAstroImage(false).GetMeasurableAreaPixels(centerX, centerY, 35); NotMeasuredReasons rv = MeasureObject( new ImagePixel(m_PSFFit.XCenter, m_PSFFit.YCenter), data, bagPixels, m_VideoController.VideoBitPix, m_Measurer, TangraConfig.PreProcessingFilter.NoFilter, m_SignalMethod, TangraConfig.PsfQuadrature.NumericalInAperture, TangraConfig.Settings.Photometry.PsfFittingMethod, aperture, m_PSFFit.FWHM, (float)m_PSFFit.FWHM, new FakeIMeasuredObject(m_PSFFit), null, null, false); double reading = m_Measurer.TotalReading; double bgReading = m_Measurer.TotalBackground; if (rv == NotMeasuredReasons.MeasuredSuccessfully) { tbxSmBG.Text = (reading - bgReading).ToString("0.000"); tbxBg.Text = bgReading.ToString("0.000"); } else { Trace.WriteLine("TargetPSFViewer.NotMeasuredReasons: " + rv.ToString()); tbxBg.Text = "ERR"; tbxSmBG.Text = "ERR"; } // Show the apertures in the main view m_Aperture = aperture; m_InnerRadius = (float)(TangraConfig.Settings.Photometry.AnnulusInnerRadius * aperture); m_OuterRadius = (float)Math.Sqrt(TangraConfig.Settings.Photometry.AnnulusMinPixels / Math.PI + m_InnerRadius * m_InnerRadius); //m_VideoController.RefreshCurrentFrame(); }