Beispiel #1
0
        private void ShowResults()
        {
            string detailhtmlFullFileName  = detailXmlFullFileName.ToLower().Replace(".xml", ".html");
            string summaryhtmlFullFileName = summaryXmlFullFileName.ToLower().Replace(".xml", ".html");

            // Do the actual conversion from XML to HTML.
            dvtkWebBrowser.ConvertXmlToHtml(detailXmlFullFileName, detailhtmlFullFileName);

            //Also convert summary result xml to html for further use
            dvtkWebBrowser.ConvertXmlToHtml(summaryXmlFullFileName, summaryhtmlFullFileName);

            dvtkWebBrowser.Navigate(detailhtmlFullFileName);
        }
Beispiel #2
0
        private void AnonymizeDCMFile()
        {
            try
            {
                utility.AnonymizationType = anonymizationMode;
                CreateDICOMDIR.Enabled    = true;

                OpenFileDialog fileDialog = new OpenFileDialog();
                fileDialog.Multiselect     = false;
                fileDialog.ReadOnlyChecked = true;
                fileDialog.Title           = "Select DCM File";
                fileDialog.Filter          = "DCM files (*.dcm) |*.dcm|All files (*.*)|*.*";

                // Show the file dialog.
                // If the user pressed the OK button...
                if (fileDialog.ShowDialog() == DialogResult.OK)
                {
                    DicomFile dcmFile = new DicomFile();
                    dcmFile.Read(fileDialog.FileName, mainThread);

                    // Get the Data set from the selected DCM file
                    HLI.DataSet srcDataset = dcmFile.DataSet;

                    SaveFileDialog saveDialog   = new SaveFileDialog();
                    FileInfo       saveFileInfo = null;
                    saveDialog.Filter = "DCM files (*.dcm) |*.dcm|All files (*.*)|*.*";
                    if (saveDialog.ShowDialog() == DialogResult.OK)
                    {
                        HLI.DataSet annonymizedDataset = srcDataset.Clone();

                        utility.PatientAttributes(annonymizedDataset);
                        for (int number = 0; number < annonymizedDataset.Count; number++)
                        {
                            HLI.Attribute attribute = annonymizedDataset[number];
                            if (attribute.VR == VR.SQ)
                            {
                                utility.SequenceAttribute_recursive(attribute);
                            }
                            else
                            {
                                utility.CacheAndRepairIdentifyingAttribute(attribute);
                                utility.UpdateAnonymizedAttributes(attribute);
                            }
                        }

                        datasets = new AttributeCollections();
                        datasets.Add(srcDataset);
                        datasets.Add(annonymizedDataset);

                        //Save annonymized data to selected file
                        saveFileInfo    = new FileInfo(saveDialog.FileName);
                        dcmFile.DataSet = annonymizedDataset;
                        dcmFile.Write(saveFileInfo.FullName);

                        //Cleanup temp file
                        utility.cleanup();
                    }
                    else
                    {
                        return;
                    }

                    string        htmlFileName = initialDirectory + "\\" + saveFileInfo.Name + ".html";
                    XmlTextWriter writer       = new XmlTextWriter(htmlFileName, System.Text.Encoding.UTF8);
                    writer.WriteStartElement("b");
                    writer.WriteRaw(@"<b><font size='3' color='#ff0000'>DCM File Anonymization Started...</font></b>");
                    writer.WriteEndElement();
                    writer.Close();
                    resultFileName = htmlFileName;
                    System.Threading.Thread t = new System.Threading.Thread(new ThreadStart(CreateTable));
                    dvtkWebBrowser.Navigate(htmlFileName);
                    t.Start();
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }