private void moreIterationsBtn_Click(object sender, RoutedEventArgs e)
        {
            this.IsEnabled = false;
            ProgressCounterGUI progressCounter = new ProgressCounterGUI(moreIterationsCount.Value.GetValueOrDefault(), progressBar);

            result           = reconstructor.PerformAdditionalIterations(moreIterationsCount.Value.GetValueOrDefault(), progressCounter);
            resultImg.Source = PrepareBitmap(result.Bmp);
            progressCounter.Reset();
            this.IsEnabled = true;
        }
示例#2
0
        private void runBtn_Click(object sender, RoutedEventArgs e)
        {
            this.IsEnabled = false;
            int steps = 0;

            if ((String)reconstructionAlgorithm.SelectedItem == "Back projection")
            {
                steps = (int)numberOfProjections.Value;
            }
            else
            {
                steps = (int)numberOfIterations.Value;
            }
            ProgressCounter progressCounter = new ProgressCounterGUI((int)numberOfProjections.Value + steps, progressBar);

            setState("Loading input image");
            GrayscaleBitmap bmp = new GrayscaleBitmap(inputPicture.Text);

            bmp = bmp.CreateSquareBitmap();
            setState("Generating projections");
            List <double[]> projections = ((ProjectionHandler)projectionAlgorithm.SelectedItem).GenerateProjections(bmp, (int)numberOfProjections.Value, progressCounter);



            setState("Filtering projections");
            foreach (Filter1D filter in projectionFilterList.Items)
            {
                filter.Apply(projections);
            }

            GrayscaleBitmap sinogram = SinogramHandler.ProjectionsToSinogram(projections);

            setState("Filtering sinogram");

            foreach (Filter2D filter in sinogramFilterList.Items)
            {
                filter.Apply(sinogram);
            }

            projections = SinogramHandler.SinogramToProjections(sinogram);

            GrayscaleBitmap             result;
            IterativeSliceReconstructor passedReconstructor = null;

            setState("Reconstructing");
            if ((String)reconstructionAlgorithm.SelectedItem == "Back projection")
            {
                BackProjectionSliceReconstructor reconstructor = new BackProjectionSliceReconstructor(projections, 180.0 / (double)numberOfProjections.Value, (ProjectionHandler)projectionAlgorithm.SelectedItem);
                result = reconstructor.Reconstruct(progressCounter);
            }
            else
            {
                IterativeSliceReconstructor reconstructor = new IterativeSliceReconstructor(projections, 180.0 / (double)numberOfProjections.Value, (ProjectionHandler)projectionAlgorithm.SelectedItem, (bool)allowNegativeValuesCheckBox.IsChecked);
                result = reconstructor.Reconstruct((int)numberOfIterations.Value, progressCounter);
                passedReconstructor = reconstructor;
            }

            setState("Nothing to do");

            progressCounter.Reset();

            ResultWindow resultWnd = new ResultWindow(sinogram, result, passedReconstructor);

            resultWnd.Show();
            this.IsEnabled = true;
        }