Beispiel #1
0
        private void LoadDefault()
        {
            try
            {
                DicomDataSet dsAnonymized;

                _ActiveDataSet.Load(DemosGlobal.ImagesFolder + @"\Image2.dcm", DicomDataSetLoadFlags.None);
                dsAnonymized = Anonymize();

                AnonymizedInfo info = new AnonymizedInfo()
                {
                    AnonymizedDataset = dsAnonymized
                };

                //
                // Store the image count as a tag of the first node.  This is so we don't have to query the dataset during the Idle event.
                //
                if (treeGridViewTags.Nodes.Count > 0)
                {
                    DicomElement element = dsAnonymized.FindFirstElement(null, DicomTag.PixelData, true);

                    if (element != null)
                    {
                        info.ImageCount = dsAnonymized.GetImageCount(element);
                    }
                }
                treeGridViewDifference.Tag = info;
            }
            catch (Exception e)
            {
                Messager.Show(this, e, MessageBoxIcon.Error);
            }
        }
Beispiel #2
0
        private void toolStripButtonSaveDataset_Click(object sender, EventArgs e)
        {
            AnonymizedInfo info = treeGridViewDifference.Tag as AnonymizedInfo;

            if (info != null)
            {
                try
                {
                    using (SaveFileDialog dlgSave = new SaveFileDialog())
                    {
                        dlgSave.Title        = "Save Anonymized Dataset";
                        dlgSave.Filter       = "Dicom Files (*.dic) | *.dic | All Files (*.*) | *.*";
                        dlgSave.AddExtension = true;
                        if (dlgSave.ShowDialog(this) == DialogResult.OK)
                        {
                            info.AnonymizedDataset.Save(dlgSave.FileName, DicomDataSetSaveFlags.None);
                        }
                    }
                }
                catch (Exception exception)
                {
                    Messager.ShowError(this, exception);
                }
            }
        }
Beispiel #3
0
        void Application_Idle(object sender, EventArgs e)
        {
            toolStripButtonSave.Enabled        = _Modified;
            toolStripButtonAnonymize.Enabled   = treeGridViewTags.Nodes.Count > 0;
            toolStripButtonSaveDataset.Enabled = treeGridViewDifference.Nodes.Count > 0;
            if (toolStripButtonSaveDataset.Enabled)
            {
                AnonymizedInfo info = treeGridViewDifference.Tag as AnonymizedInfo;

                toolStripButtonView.Enabled = info != null && info.ImageCount > 0;
            }
            else
            {
                toolStripButtonView.Enabled = false;
            }
            toolStripButtonDeleteTag.Enabled = treeGridViewTags.SelectedCells.Count > 0;
            toolStripButtonRefresh.Enabled   = treeGridViewDifference.Tag != null;
        }
Beispiel #4
0
        private void anonymizefileToolStripMenuItem_Click(object sender, EventArgs e)
        {
            anonymizeopenFileDialog.Multiselect = false;
            anonymizeopenFileDialog.Filter      = "DICOM Files (*.dcm;*.dic)|*.dcm;*.dic|All files (*.*)|*.*";
            if (anonymizeopenFileDialog.ShowDialog(this) == DialogResult.OK)
            {
                DicomDataSet dsAnonymized = new DicomDataSet();

                _ActiveDataSet.Reset();
                try
                {
                    _ActiveDataSet.Load(anonymizeopenFileDialog.FileName, DicomDataSetLoadFlags.None);
                    dsAnonymized = Anonymize();

                    AnonymizedInfo info = new AnonymizedInfo()
                    {
                        AnonymizedDataset = dsAnonymized
                    };

                    //
                    // Store the image count as a tag of the first node.  This is so we don't have to query the dataset during the Idle event.
                    //
                    if (treeGridViewTags.Nodes.Count > 0)
                    {
                        DicomElement element = dsAnonymized.FindFirstElement(null, DicomTag.PixelData, true);

                        if (element != null)
                        {
                            info.ImageCount = dsAnonymized.GetImageCount(element);
                        }
                    }
                    treeGridViewDifference.Tag = info;
                }
                catch (Exception exception)
                {
                    Messager.ShowError(this, exception);
                }
                finally
                {
                    ToggleProgress(false);
                }
            }
        }
Beispiel #5
0
        private void toolStripButtonView_Click(object sender, EventArgs e)
        {
            AnonymizedInfo info = treeGridViewDifference.Tag as AnonymizedInfo;

            if (info != null)
            {
                try
                {
                    using (ViewImageDialog dlgView = new ViewImageDialog(info.AnonymizedDataset))
                    {
                        dlgView.Text = "View Image";
                        dlgView.ShowDialog(this);
                    }
                }
                catch (Exception exception)
                {
                    Messager.ShowError(this, exception);
                }
            }
        }
Beispiel #6
0
        private void toolStripButtonRefresh_Click(object sender, EventArgs e)
        {
            DicomDataSet   dsAnonymized = Anonymize();
            AnonymizedInfo info         = new AnonymizedInfo()
            {
                AnonymizedDataset = dsAnonymized
            };

            //
            // Store the image count as a tag of the first node.  This is so we don't have to query the dataset during the Idle event.
            //
            if (treeGridViewTags.Nodes.Count > 0)
            {
                DicomElement element = dsAnonymized.FindFirstElement(null, DicomTag.PixelData, true);

                if (element != null)
                {
                    info.ImageCount = dsAnonymized.GetImageCount(element);
                }
            }
            treeGridViewDifference.Tag = info;
        }