public ResultFilterWindow(ResultWindow resultWindow)
        {
            InitializeComponent();

            this.resultWindow = resultWindow;

            resultFilter.Items.Add(ConvolutionFilter2D.GetGauss55());
            resultFilter.Items.Add(ConvolutionFilter2D.GetLaplace());
            resultFilter.Items.Add(ConvolutionFilter2D.GetSharpen());
            resultFilter.Items.Add(ConvolutionFilter2D.GetLaplacianOfGaussian55());
            resultFilter.Items.Add(ConvolutionFilter2D.GetLaplacianOfGaussian77());
            //resultFilter.Items.Add(EdgeDetectorRoberts.Instance);
            resultFilter.Items.Add(CompositeConvolutionFilter2D.getRoberts());
            resultFilter.Items.Add(CompositeConvolutionFilter2D.getKirsch());
            resultFilter.Items.Add(new RemoveNegativeValuesFilter());
            resultFilter.Items.Add(new AbsoluteValueFilter());
            resultFilter.SelectedIndex = 0;
        }
Esempio n. 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;
        }