/// <summary>
        /// Main Window constructor. Here we initialize the state of some menu items
        /// as well as checking the visibility of the status bar.
        /// </summary>
        public MainWindow() {
            m_data = new ImageData();
            m_vm = new ViewModel();

            InitializeComponent();
            DataContext = m_vm;

            m_backgroundWorker = new BackgroundWorker();
            m_backgroundWorker.WorkerReportsProgress = false;
            m_backgroundWorker.WorkerSupportsCancellation = false;
            m_backgroundWorker.DoWork += backgroundWorker_DoWork;
            m_backgroundWorker.RunWorkerCompleted += backgroundWorker_RunWorkerCompleted;

            undo.IsEnabled = false;
            redo.IsEnabled = false;
            preferences.IsEnabled = false;

            if (statusBar.Visibility == Visibility.Visible) {
                statusBar.Visibility = Visibility.Visible;
                statusBarShowHide.IsChecked = true;
            } else {
                statusBar.Visibility = Visibility.Collapsed;
                statusBarShowHide.IsChecked = false;
            }
        }
        public CartoonEffect(ImageData data, ViewModel vm) {
            m_data = data;
            m_vm = vm;

            InitializeComponent();

            m_backgroundWorker = new BackgroundWorker();
            m_backgroundWorker.WorkerReportsProgress = false;
            m_backgroundWorker.WorkerSupportsCancellation = false;
            m_backgroundWorker.DoWork += backgroundWorker_DoWork;
            m_backgroundWorker.RunWorkerCompleted += backgroundWorker_RunWorkerCompleted;

            // Fill list of filters
            List<string> filters = new List<string>();
            filters.Add("None");
            filters.Add("Gaussian (3x3)");
            filters.Add("Gaussian (5x5)");
            filters.Add("Gaussian (7x7)");
            filters.Add("Mean (3x3)");
            filters.Add("Mean (5x5)");
            filters.Add("Mean (7x7)");
            filters.Add("Median (3x3)");
            filters.Add("Median (5x5)");
            filters.Add("Median (7x7)");
            filters.Add("Median (9x9)");
            filters.Add("Low pass (3x3)");
            filters.Add("Low pass (5x5)");
            filters.Add("Sharpen (3x3)");
            filters.Add("Sharpen (5x5)");
            filters.Add("Sharpen (7x7)");
            cmbFilters.ItemsSource = filters;
            cmbFilters.SelectedIndex = 0;
        }
        /// <summary>
        /// Contrast <c>constructor</c>
        /// Here we initialiaze the images and also we set the focus at the textBox being used.
        /// </summary>
        public Contrast(ImageData data, ViewModel vm) {
            m_data = data;
            m_vm = vm;

            InitializeComponent();
            sldContrast.Focus();

            m_backgroundWorker = new BackgroundWorker();
            m_backgroundWorker.WorkerReportsProgress = false;
            m_backgroundWorker.WorkerSupportsCancellation = false;
            m_backgroundWorker.DoWork += backgroundWorker_DoWork;
            m_backgroundWorker.RunWorkerCompleted += backgroundWorker_RunWorkerCompleted;
        }
        public OilPaintEffect(ImageData data, ViewModel vm) {
            m_data = data;
            m_vm = vm;

            InitializeComponent();

            m_backgroundWorker = new BackgroundWorker();
            m_backgroundWorker.WorkerReportsProgress = false;
            m_backgroundWorker.WorkerSupportsCancellation = false;
            m_backgroundWorker.DoWork += backgroundWorker_DoWork;
            m_backgroundWorker.RunWorkerCompleted += backgroundWorker_RunWorkerCompleted;
            cmbKernelSize.SelectedIndex = 0;
        }
        /// <summary>
        /// Noise Reduction (Mean filter) <c>constructor</c>.
        /// Here we initialiaze the images and also we set the default kernel.
        /// </summary>
        public NoiseReductionMean(ImageData data, ViewModel vm) {
            m_data = data;
            m_vm = vm;

            InitializeComponent();
            three.IsChecked = true;

            m_backgroundWorker = new BackgroundWorker();
            m_backgroundWorker.WorkerReportsProgress = false;
            m_backgroundWorker.WorkerSupportsCancellation = false;
            m_backgroundWorker.DoWork += backgroundWorker_DoWork;
            m_backgroundWorker.RunWorkerCompleted += backgroundWorker_RunWorkerCompleted;
        }
        /// <summary>
        /// Salt-and-Pepper Noise generator (Black/White) <c>constructor</c>.
        /// Here we initialiaze the images and also we set the focus at the textBox being used.
        /// </summary>
        public SaltPepperNoiseBW(ImageData data, ViewModel vm) {
            m_data = data;
            m_vm = vm;

            InitializeComponent();
            textboxNoiseBW.Focus();

            m_backgroundWorker = new BackgroundWorker();
            m_backgroundWorker.WorkerReportsProgress = false;
            m_backgroundWorker.WorkerSupportsCancellation = false;
            m_backgroundWorker.DoWork += backgroundWorker_DoWork;
            m_backgroundWorker.RunWorkerCompleted += backgroundWorker_RunWorkerCompleted;
        }
        public GradientBased(ImageData data, ViewModel vm) {
            m_data = data;
            m_vm = vm;

            InitializeComponent();

            m_backgroundWorker = new BackgroundWorker();
            m_backgroundWorker.WorkerReportsProgress = false;
            m_backgroundWorker.WorkerSupportsCancellation = false;
            m_backgroundWorker.DoWork += backgroundWorker_DoWork;
            m_backgroundWorker.RunWorkerCompleted += backgroundWorker_RunWorkerCompleted;

            // Fill list of filters
            List<string> filters = new List<string>();
            filters.Add("Edge Detect Mono");
            filters.Add("Edge Detect Gradient");
            filters.Add("Sharpen");
            filters.Add("Sharpen Gradient");
            cmbFilters.ItemsSource = filters;
            cmbFilters.SelectedIndex = 0;
            rdbFirstDerivative.IsChecked = true;
        }
        /// <summary>
        /// Histogram <c>constructor</c>.
        /// Here we initialiaze the image, the data binding of the histogram diagram and the default hitogram that will be loaded.
        /// </summary>
        /// <param name="data">Input image.</param>
        public Histogram(ImageData data, ViewModel vm) {
            m_data = data;
            m_vm = vm;

            InitializeComponent();
            DataContext = m_vm;
            gray.IsChecked = true;
        }