public double GetNextExposureTime(double exposureTime, FlatWizardFilterSettingsWrapper wrapper)
        {
            if (dataPoints.Count >= 2)
            {
                return(GetExpectedExposureTime(wrapper));
            }

            return(exposureTime + wrapper.Settings.StepSize);
        }
Esempio n. 2
0
 public FlatWizardUserPromptVM(string text, double currentMean, double cameraBitDepth, FlatWizardFilterSettingsWrapper settings, double expectedExposureTime)
 {
     this.text                 = text;
     this.currentMean          = currentMean;
     this.cameraBitDepth       = cameraBitDepth;
     this.expectedExposureTime = expectedExposureTime;
     this.settings             = settings;
     ResetAndContinueCommand   = new RelayCommand(ResetAndContinueContinueFlatWizard);
     ContinueCommand           = new RelayCommand(ContinueFlatWizard);
     CancelCommand             = new RelayCommand(CancelFlatWizard);
 }
        public FlatWizardExposureTimeState GetNextFlatExposureState(double exposureTime, FlatWizardFilterSettingsWrapper wrapper)
        {
            if (exposureTime > wrapper.Settings.MaxFlatExposureTime)
            {
                return(FlatWizardExposureTimeState.ExposureTimeAboveMaxTime);
            }

            if (exposureTime < wrapper.Settings.MinFlatExposureTime)
            {
                return(FlatWizardExposureTimeState.ExposureTimeBelowMinTime);
            }

            return(FlatWizardExposureTimeState.ExposureTimeWithinBounds);
        }
        public async Task <FlatWizardExposureAduState> GetFlatExposureState(IImageData imageData, double exposureTime, FlatWizardFilterSettingsWrapper wrapper)
        {
            var histogramMeanAdu             = HistogramMeanAndCameraBitDepthToAdu(wrapper.Settings.HistogramMeanTarget, wrapper.BitDepth);
            var histogramToleranceUpperBound = GetUpperToleranceAduFromAdu(histogramMeanAdu, wrapper.Settings.HistogramTolerance);
            var histogramToleranceLowerBound = GetLowerToleranceAduFromAdu(histogramMeanAdu, wrapper.Settings.HistogramTolerance);
            var imageStatistics = await imageData.Statistics.Task;
            var currentMean     = imageStatistics.Mean;

            if (histogramToleranceLowerBound <= currentMean && histogramToleranceUpperBound >= currentMean)
            {
                return(FlatWizardExposureAduState.ExposureFinished);
            }

            if (currentMean > histogramToleranceUpperBound)
            {
                return(FlatWizardExposureAduState.ExposureAduAboveMean);
            }

            return(FlatWizardExposureAduState.ExposureAduBelowMean);
        }
        public double GetExpectedExposureTime(FlatWizardFilterSettingsWrapper wrapper)
        {
            var trendLine = new TrendLine(dataPoints);

            return((wrapper.Settings.HistogramMeanTarget * CameraBitDepthToAdu(wrapper.BitDepth) - trendLine.Offset) / trendLine.Slope);
        }
        public async Task <FlatWizardUserPromptVMResponse> EvaluateUserPromptResultAsync(IImageData imageData, double exposureTime, string message, FlatWizardFilterSettingsWrapper wrapper)
        {
            var imageStatistics       = await imageData.Statistics.Task;
            var flatsWizardUserPrompt = new FlatWizardUserPromptVM(
                message,
                imageStatistics.Mean,
                CameraBitDepthToAdu(wrapper.BitDepth),
                wrapper,
                exposureTime);
            await WindowService.ShowDialog(flatsWizardUserPrompt, Locale["LblFlatUserPromptFailure"], System.Windows.ResizeMode.NoResize, System.Windows.WindowStyle.ToolWindow);

            if (flatsWizardUserPrompt.Reset)
            {
                ClearDataPoints();
            }

            return(new FlatWizardUserPromptVMResponse()
            {
                Continue = flatsWizardUserPrompt.Continue,
                NextExposureTime = flatsWizardUserPrompt.Reset ? wrapper.Settings.MinFlatExposureTime : exposureTime
            });
        }