예제 #1
0
        /// <summary>
        /// Click handler for the Smooth button.
        /// </summary>
        private void Smooth_Btn_Click(object sender, EventArgs e)
        {
            // Check whether we actually have any files to process
            string inputDir = InputDir_TextBox.Text;

            if (!Directory.Exists(inputDir))
            {
                MessageBox.Show("The chosen input directory does not exist.");
                return;
            }

            string[] vtkFiles = Directory.GetFiles(inputDir, "*.vtk");
            if ((vtkFiles == null) || (vtkFiles.Length == 0))
            {
                MessageBox.Show("No vtk files found in the chosen input directory.");
                return;
            }

            // Save the settings
            Properties.Settings.Default.SmoothingFactor = (float)SmoothingFactor_NUD.Value;
            Properties.Settings.Default.Save();

            // Update the UI
            Stop_Btn.Enabled        = true;
            PauseResume_Btn.Enabled = true;
            Main_ProgressBar.Value  = 0;
            EnableInputs(false);

            // Run the Upsampler in the background
            m_currentProc = new Smoother(inputDir, (float)SmoothingFactor_NUD.Value);
            m_currentProc.ProgressEvent   += CurrentProc_ProgressEvent;
            m_currentProc.CompletionEvent += CurrentProc_CompletionEvent;
            m_currentProc.RunInBackground();
        }
예제 #2
0
        /// <summary>
        /// Click handler for the Crop button.
        /// </summary>
        private void Crop_Btn_Click(object sender, EventArgs e)
        {
            // Check whether we actually have any files to process
            string inputDir = InputDir_TextBox.Text;

            if (!Directory.Exists(inputDir))
            {
                MessageBox.Show("The chosen input directory does not exist.");
                return;
            }

            string[] vtkFiles = Directory.GetFiles(inputDir, "*.vtk");
            if ((vtkFiles == null) || (vtkFiles.Length == 0))
            {
                MessageBox.Show("No vtk files found in the chosen input directory.");
                return;
            }

            // Save the settings
            int X1 = (int)XCrop1_NUD.Value;
            int X2 = (int)XCrop2_NUD.Value;
            int Y1 = (int)YCrop1_NUD.Value;
            int Y2 = (int)YCrop2_NUD.Value;
            int Z1 = (int)ZCrop1_NUD.Value;
            int Z2 = (int)ZCrop2_NUD.Value;

            Properties.Settings.Default.CropSettings = X1.ToString() + "," + X2.ToString() + "," +
                                                       Y1.ToString() + "," + Y2.ToString() + "," + Z1.ToString() + "," + Z2.ToString();
            Properties.Settings.Default.Save();

            // Update the UI
            Stop_Btn.Enabled        = true;
            PauseResume_Btn.Enabled = true;
            Main_ProgressBar.Value  = 0;
            EnableInputs(false);

            // Run the Upsampler in the background
            m_currentProc = new Cropper(inputDir, X1, X2, Y1, Y2, Z1, Z2);
            m_currentProc.ProgressEvent   += CurrentProc_ProgressEvent;
            m_currentProc.CompletionEvent += CurrentProc_CompletionEvent;
            m_currentProc.RunInBackground();
        }
예제 #3
0
        /// <summary>
        /// Click handler for the ReColor button.
        /// </summary>
        private void ReColor_Btn_Click(object sender, EventArgs e)
        {
            // Check whether we actually have any files to process
            string inputDir = InputDir_TextBox.Text;

            if (!Directory.Exists(inputDir))
            {
                MessageBox.Show("The chosen input directory does not exist.");
                return;
            }

            string[] vtkFiles = Directory.GetFiles(inputDir, "*.vtk");
            if ((vtkFiles == null) || (vtkFiles.Length == 0))
            {
                MessageBox.Show("No vtk files found in the chosen input directory.");
                return;
            }


            // Run the Colorer in the background
            DialogResult dlgResult = m_colorBuilder.ShowDialog();

            if (dlgResult == DialogResult.OK || dlgResult == DialogResult.Yes)
            {
                // Update the UI
                Stop_Btn.Enabled        = true;
                PauseResume_Btn.Enabled = true;
                Main_ProgressBar.Value  = 0;
                EnableInputs(false);

                m_currentProc = new Colorer(inputDir, m_colorBuilder);
                m_currentProc.ProgressEvent   += CurrentProc_ProgressEvent;
                m_currentProc.CompletionEvent += CurrentProc_CompletionEvent;
                m_currentProc.RunInBackground();
            }
        }