private void buttonConvert_Click(object sender, EventArgs e) { // make sure they selected a file for conversion if (selectListDicom.SelectedItem == null) { popup.msg("Select a file to be converted."); return; } if (selectListDicom.CheckedItems == null || selectListDicom.CheckedItems.Count <= 0) { popup.msg("No dicom files selected."); return; } string presetfile = sys.presetPath + dropdownProfiles.SelectedValue; IDictionary <string, string> presetsettings = sys.getPresets(presetfile + ".txt"); buttonConvert.Text = "Converting"; buttonConvert.Enabled = false; Console.WriteLine(presetsettings.ToString()); ProgressWindow form2 = new ProgressWindow(selectListDicom.CheckedItems); this.Enabled = false; foreach (object item in selectListDicom.CheckedItems) { string toPass = item.ToString(); form2.textbox(toPass.Substring(toPass.LastIndexOf('|') + 1)); //filename form2.progressbar(0); form2.Show(); Application.DoEvents(); dcm temp = new dcm(sys.dicomsPath + toPass.Substring(toPass.LastIndexOf('|') + 1)); gui.convert(toPass.Substring(toPass.LastIndexOf('|') + 1), form2, temp.frameRate); } form2.setProgress(100); form2.textbox("Done"); form2.progtext("Done"); form2.Update(); Application.DoEvents(); Thread.Sleep(2000); form2.Close(); this.Enabled = true; this.Focus(); buttonConvert.Text = "Convert"; buttonConvert.Enabled = true; initMovList(); //update mov list }
public static void convert(string dicomScan, ProgressWindow progform, string framerate = "4") { // check and create temp directory string tempScanDirectory = sys.stillsPath + dicomScan + @"\"; if (!Directory.Exists(tempScanDirectory)) { Directory.CreateDirectory(tempScanDirectory); } // uses all defined paths + name of the dicom directory progform.progtext("Getting DICOM stills."); Application.DoEvents(); dcm_to_png(sys.dicomsPath + dicomScan, tempScanDirectory, progform); progform.progtext("Converting stills to movie file."); Application.DoEvents(); png_to_mp4(tempScanDirectory, sys.outPath + dicomScan.Replace(@"\", ""), progform, framerate.ToString()); // cleanup temp files //Directory.Delete(tempScanDirectory, true); }