Ejemplo n.º 1
0
        private void menuItemRun_Click(object sender, System.EventArgs e)
        {
            menuItemStop.Enabled = true;
            menuItemRun.Enabled = false;
            toolBarButtonRun.ToolTipText = "Stop Emulator";
            toolBarButtonRun.ImageIndex = 1;

            //toolBarButtonTS.Enabled = false;
            buttonSpecifyTS.Enabled = false;
            buttonCommitTS.Enabled = false;
            toolBarButtonAbort.Enabled = true;
            //isResultGatheringStarted = false;
            isStopped = false;

            //If result tab is present, remove it
            if(tabControlStorageSCP.Controls.Contains(tabPageResults))
            {
                tabControlStorageSCP.Controls.Remove(tabPageResults);
            }

            try
            {
                UpdateConfig();

                // Display activity logging tab
                //
                // Make the Activity Logging Tab the only Tab visible and clean it.
                //
                this.tabControlStorageSCP.Controls.Clear();
                this.tabControlStorageSCP.Controls.Add(this.tabPageLogging);
                this.userControlActivityLogging.Clear();

                // Update loaded definitions files
                this.selectedSops.Clear();
                foreach (DefinitionFile theDefinitionFile in sopClassesUserControlStoreSCP.SelectedDefinitionFilesList)
                {
                    if (theDefinitionFile.Loaded)
                    {
                        this.selectedSops.Add(theDefinitionFile.SOPClassUID);
                    }
                }

                //
                // Set the correct settings for the overview DicomThread and some settings for its child threads.
                //
                String startDateTime = DateTime.Now.ToString("yyyyMMdd_HHmmss", System.Globalization.CultureInfo.InvariantCulture);

                this.storageOptions.ResultsDirectory = this.validationResultsFileGroup.Directory;
                this.storageCommitOptions.ResultsDirectory = this.validationResultsFileGroup.Directory;

                this.threadManager.ThreadsStateChangeEvent += this.threadsStateChangeEventHandler;

                this.overviewThread = new OverviewThread(this.storageOptions, this.storageCommitOptions, this.selectedSops, this.selectedTS, this.selectedTSCommit, (int)eventDelay, startDateTime);
                this.overviewThread.Initialize(threadManager);
                this.overviewThread.Options.ResultsDirectory = this.validationResultsFileGroup.Directory;
                this.overviewThread.Options.Identifier = "Storage_SCP_Emulator";
                this.overviewThread.Options.ResultsFileNameOnlyWithoutExtension = startDateTime + "_Storage_SCP_Emulator";
                this.overviewThread.Options.AttachChildsToUserInterfaces = true;
                this.overviewThread.Options.LogThreadStartingAndStoppingInParent = false;
                this.overviewThread.Options.LogWaitingForCompletionChildThreads = false;

                this.userControlActivityLogging.Attach(overviewThread);

                //
                // Start the DicomThread.
                //
                this.overviewThread.Start();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                toolBarButtonRun.ToolTipText = "Run Emulator";
                toolBarButtonRun.ImageIndex = 0;
            }
        }
Ejemplo n.º 2
0
        private void dICOMEchoToolStripMenuItem_Click(object sender, EventArgs e)
        {
            string detailedEchoFileName = "";
            if (registeredPeersGrid.SelectedIndices.Count > 0)
            {
                int selectedIndex = registeredPeersGrid.SelectedIndices[0];

                //isStorageEcho = true;
                allThreadsFinished = false;
                if ((peers[selectedIndex].IP == null) || (peers[selectedIndex].IP.Length == 0))
                {
                    MessageBox.Show("Pl Specify SCP IP Address.", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    return;
                }

                //Update DVT & SUT settings
                OverviewThread overviewThread = new OverviewThread();
                overviewThread.Initialize(threadManager);
                overviewThread.Options.DeepCopyFrom(options);
                overviewThread.Options.Identifier = "Move_Destinations";
                overviewThread.Options.AttachChildsToUserInterfaces = true;
                overviewThread.Options.LogThreadStartingAndStoppingInParent = false;
                overviewThread.Options.LogWaitingForCompletionChildThreads = false;
                String resultsFileName = "MoveDestinations_" + System.DateTime.Now.ToString("yyyyMMddHHmmss", System.Globalization.CultureInfo.InvariantCulture);
                overviewThread.Options.ResultsFileNameOnlyWithoutExtension = resultsFileName;

                SCU echoScu = new SCU();
                echoScu.Initialize(overviewThread);
                echoScu.Options.DeepCopyFrom(options);

                String resultsFileBaseName = "MoveDestinationsEcho_" + System.DateTime.Now.ToString("yyyyMMddHHmmss", System.Globalization.CultureInfo.InvariantCulture);
                echoScu.Options.ResultsFileNameOnlyWithoutExtension = resultsFileBaseName;
                echoScu.Options.Identifier = resultsFileBaseName;

                echoScu.Options.LogThreadStartingAndStoppingInParent = false;
                echoScu.Options.LogWaitingForCompletionChildThreads = false;
                echoScu.Options.AutoValidate = false;
                echoScu.Options.ResultsDirectory = options.ResultsDirectory;

                //echoScu.Options.LocalAeTitle ="SCU";
                echoScu.Options.RemoteAeTitle = peers[selectedIndex].AE;
                echoScu.Options.RemotePort = peers[selectedIndex].Port;
                echoScu.Options.RemoteHostName = peers[selectedIndex].IP;
                //this.userControlActivityLogging.Attach(echoScu);

                detailedEchoFileName = echoScu.Options.DetailResultsFullFileName;
                PresentationContext presentationContext = new PresentationContext("1.2.840.10008.1.1", // Abstract Syntax Name
                                                                                "1.2.840.10008.1.2"); // Transfer Syntax Name(s)
                PresentationContext[] presentationContexts = new PresentationContext[1];
                presentationContexts[0] = presentationContext;

                DvtkHighLevelInterface.Dicom.Messages.DicomMessage echoMessage = new DvtkHighLevelInterface.Dicom.Messages.DicomMessage(DvtkData.Dimse.DimseCommand.CECHORQ);

                echoScu.Start();

                bool sendResult = echoScu.TriggerSendAssociationAndWait(echoMessage, presentationContexts);

                if (!sendResult)
                {
                    MessageBox.Show("DICOM Echo failed ","Failed",MessageBoxButtons.OK,MessageBoxIcon.Error);
                }
                else
                    MessageBox.Show("DICOM Echo successful", "Success", MessageBoxButtons.OK, MessageBoxIcon.Information);

                echoScu.Stop();
                if (OnShowEchoResults != null)
                {
                    OnShowEchoResults.Invoke(detailedEchoFileName,sendResult);
                }
                allThreadsFinished=false;

            }
        }
Ejemplo n.º 3
0
        private void buttonEcho_Click(object sender, System.EventArgs e)
        {
            //isStorageEcho = true;
            labelStorageEcho.Text = "";
            toolBarButtonResult.Enabled = false;

            if ((textBoxStorageSCPIPAdd.Text == null) || (textBoxStorageSCPIPAdd.Text.Length == 0))
            {
                MessageBox.Show("Pl Specify SCP IP Address.", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }

            //Update DVT & SUT settings
            this.storageOptions.RemoteAeTitle = textBoxStorageSCPAETitle.Text;
            this.storageOptions.RemoteHostName = textBoxStorageSCPIPAdd.Text;
            this.storageOptions.RemotePort = UInt16.Parse(textBoxStorageSCPPort.Text);
            this.storageOptions.LocalAeTitle = textBoxSCUAETitle.Text;
            this.storageOptions.ResultsDirectory = validationResultsFileGroup.Directory;

            SCU echoScu = new SCU();

            if (isStopped)
            {
                this.overviewThread = new OverviewThread();
                this.overviewThread.Initialize(threadManager);
                this.overviewThread.Options.ResultsDirectory = validationResultsFileGroup.Directory;
                this.overviewThread.Options.Identifier = "Storage_SCU_Emulator";
                this.overviewThread.Options.AttachChildsToUserInterfaces = true;
                this.overviewThread.Options.LogThreadStartingAndStoppingInParent = false;
                this.overviewThread.Options.LogWaitingForCompletionChildThreads = false;

                this.userControlActivityLogging.Attach(overviewThread);

                String resultsFileName = "StoreSCUEmulator_" + System.DateTime.Now.ToString("yyyyMMddHHmmss", System.Globalization.CultureInfo.InvariantCulture);
                this.overviewThread.Options.ResultsFileNameOnlyWithoutExtension = resultsFileName;

                //
                // Start the Dicom Overview Thread
                //
                this.overviewThread.Start();
                isStopped = false;
            }

            echoScu.Initialize(this.overviewThread);
            echoScu.Options.DeepCopyFrom(this.storageOptions);

            String resultsFileBaseName = "StoreSCUEcho_" + System.DateTime.Now.ToString("yyyyMMddHHmmss", System.Globalization.CultureInfo.InvariantCulture);
            echoScu.Options.ResultsFileNameOnlyWithoutExtension = resultsFileBaseName;
            echoScu.Options.Identifier = resultsFileBaseName;

            echoScu.Options.LogThreadStartingAndStoppingInParent = false;
            echoScu.Options.LogWaitingForCompletionChildThreads = false;
            echoScu.Options.AutoValidate = false;

            echoScu.Options.ResultsDirectory = this.storageOptions.ResultsDirectory;

            echoScu.Options.LocalAeTitle = textBoxSCUAETitle.Text;

            echoScu.Options.RemoteAeTitle = textBoxStorageSCPAETitle.Text;
            echoScu.Options.RemotePort = UInt16.Parse(textBoxStorageSCPPort.Text);
            echoScu.Options.RemoteHostName = textBoxStorageSCPIPAdd.Text;

            //this.userControlActivityLogging.Attach(echoScu);

            PresentationContext presentationContext = new PresentationContext("1.2.840.10008.1.1", // Abstract Syntax Name
                                                                            "1.2.840.10008.1.2"); // Transfer Syntax Name(s)
            PresentationContext[] presentationContexts = new PresentationContext[1];
            presentationContexts[0] = presentationContext;

            DicomMessage echoMessage = new DicomMessage(DvtkData.Dimse.DimseCommand.CECHORQ);

            echoScu.Start();

            bool sendResult = echoScu.TriggerSendAssociationAndWait(echoMessage, presentationContexts);

            if (!sendResult)
            {
                labelStorageEcho.Text = "DICOM Echo failed (See logging for details)";
            }
            else
                labelStorageEcho.Text = "DICOM Echo successful";

            echoScu.Stop();

            toolBarButtonResult.Enabled = true;
        }
Ejemplo n.º 4
0
        private void menuItemStorageCommit_Click(object sender, System.EventArgs e)
        {
            toolBarButtonStoreCommit.Enabled = false;
            menuItemStorageCommit.Enabled = false;
            toolBarButtonResult.Enabled = false;

            //If result tab is present, remove it
            if(tabControlStorageSCU.Controls.Contains(tabPageResults))
            {
                tabControlStorageSCU.Controls.Remove(tabPageResults);
            }

            tabControlStorageSCU.SelectedTab = tabPageLogging;

            //Update DVT & SUT settings
            UpdateConfig();

            this.storageCommitSCUOptions.ResultsDirectory = validationResultsFileGroup.Directory;
            this.storageCommitSCUOptions.DataDirectory = this.storageOptions.DataDirectory;
            toolBarButtonAbort.Enabled = false;

            CommitScu commitScuThread = new CommitScu(this);

            if (isStopped)
            {
                this.overviewThread = new OverviewThread();
                this.overviewThread.Initialize(threadManager);
                this.overviewThread.Options.ResultsDirectory = validationResultsFileGroup.Directory;
                this.overviewThread.Options.Identifier = "Storage_SCU_Emulator";
                this.overviewThread.Options.AttachChildsToUserInterfaces = true;
                this.overviewThread.Options.LogThreadStartingAndStoppingInParent = false;
                this.overviewThread.Options.LogWaitingForCompletionChildThreads = false;

                this.userControlActivityLogging.Attach(overviewThread);

                String resultsFileName = "StoreSCUEmulator_" + System.DateTime.Now.ToString("yyyyMMddHHmmss", System.Globalization.CultureInfo.InvariantCulture);
                this.overviewThread.Options.ResultsFileNameOnlyWithoutExtension = resultsFileName;

                //
                // Start the Dicom Overview Thread
                //
                this.overviewThread.Start();
                isStopped = false;
            }

            commitScuThread.Initialize(this.overviewThread);
            commitScuThread.Options.CopyFrom(this.storageCommitSCUOptions);

            String resultsFileBaseName = "StorageCommitOperationAsSCU_" + System.DateTime.Now.ToString("yyyyMMddHHmmss", System.Globalization.CultureInfo.InvariantCulture);
            commitScuThread.Options.ResultsFileNameOnlyWithoutExtension = resultsFileBaseName;
            commitScuThread.Options.Identifier = resultsFileBaseName;

            commitScuThread.Options.LogThreadStartingAndStoppingInParent = false;
            commitScuThread.Options.LogWaitingForCompletionChildThreads = false;
            commitScuThread.Options.AutoValidate = false;

            DicomMessage nActionStorageCommitment = new DicomMessage(DvtkData.Dimse.DimseCommand.NACTIONRQ);

            nActionStorageCommitment.Set("0x00000003", DvtkData.Dimse.VR.UI, "1.2.840.10008.1.20.1");
            nActionStorageCommitment.Set("0x00001001", DvtkData.Dimse.VR.UI, "1.2.840.10008.1.20.1.1"); // Well known Instance UID
            nActionStorageCommitment.Set("0x00001008", DvtkData.Dimse.VR.US, 1);

            DvtkData.Dimse.SequenceItem referencedStudyComponentSequenceItem = new DvtkData.Dimse.SequenceItem();
            referencedStudyComponentSequenceItem.AddAttribute(DvtkData.Dimse.Tag.REFERENCED_SOP_CLASS_UID.GroupNumber,
                DvtkData.Dimse.Tag.REFERENCED_SOP_CLASS_UID.ElementNumber,
                DvtkData.Dimse.VR.UI, "1.2.840.10008.3.1.2.3.3");
            string refSopInstanceUID = UID.Create();
            referencedStudyComponentSequenceItem.AddAttribute(DvtkData.Dimse.Tag.REFERENCED_SOP_INSTANCE_UID.GroupNumber,
                DvtkData.Dimse.Tag.REFERENCED_SOP_INSTANCE_UID.ElementNumber,
                DvtkData.Dimse.VR.UI, refSopInstanceUID);
            nActionStorageCommitment.DataSet.DvtkDataDataSet.AddAttribute(DvtkData.Dimse.Tag.REFERENCED_STUDY_COMPONENT_SEQUENCE.GroupNumber,
                DvtkData.Dimse.Tag.REFERENCED_STUDY_COMPONENT_SEQUENCE.ElementNumber,
                DvtkData.Dimse.VR.SQ, referencedStudyComponentSequenceItem);

            AddReferencedSopSequence(storageCommitItems, 0x00081199, nActionStorageCommitment.DataSet.DvtkDataDataSet, InstanceStateEnum.InstanceStorageCommitRequested);

            string transUID = UID.Create();
            nActionStorageCommitment.DataSet.DvtkDataDataSet.AddAttribute(DvtkData.Dimse.Tag.TRANSACTION_UID.GroupNumber,
                DvtkData.Dimse.Tag.TRANSACTION_UID.ElementNumber,
                DvtkData.Dimse.VR.UI, transUID);

            if (delay < 0)
            {
                //toolBarButtonStop.Enabled = true;
                commitScuThread.setSupportedTS(selectedTS);
            }

            commitScuThread.ThreadSettings = this.storageCommitSCUOptions;
            commitScuThread.Timeout = delay;
            commitScuThread.NActionMessage = nActionStorageCommitment;
            commitScuThread.Start();
        }
Ejemplo n.º 5
0
        private void ExportDICOMData(string[] mediaFiles)
        {
            String[] convertedDicomFiles= new string[mediaFiles.Length];
            if(mediaFiles.Length == 0)
            {
                MessageBox.Show("There is no DICOM Data to export." ,"Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }

            //Storage commit should be available only after successful storage
            toolBarButtonStoreCommit.Enabled = false;
            menuItemStorageCommit.Enabled = false;
            toolBarButtonResult.Enabled = false;
            isSingleAssoc = RadioButtonSingleAssoc.Checked;
            isImageExported = false;

            //
            // Make the Activity Logging Tab the only Tab visible and clean it.
            //
            //this.userControlActivityLogging.Clear();

            if(backgroundWorkerSCU.IsBusy)
                backgroundWorkerSCU.CancelAsync();

            try
            {
                UpdateConfig();

                // Clear the commit items
                storageCommitItems.Clear();

                this.tabControlStorageSCU.Controls.Clear();
                this.tabControlStorageSCU.Controls.Add(this.tabPageStorageConfig);
                this.tabControlStorageSCU.Controls.Add(this.tabPageCommitConfig);
                this.tabControlStorageSCU.Controls.Add(this.tabPageLogging);
                tabControlStorageSCU.SelectedTab = tabPageLogging;

                if (isStopped)
                {
                    this.overviewThread = new OverviewThread();
                    this.overviewThread.Initialize(threadManager);
                    this.overviewThread.Options.ResultsDirectory = validationResultsFileGroup.Directory;
                    //this.overviewThread.Options.DataDirectory = validationResultsFileGroup.Directory;
                    this.overviewThread.Options.Identifier = "Storage_SCU_Emulator";
                    this.overviewThread.Options.AttachChildsToUserInterfaces = true;
                    this.overviewThread.Options.LogThreadStartingAndStoppingInParent = false;
                    this.overviewThread.Options.LogWaitingForCompletionChildThreads = false;

                    this.userControlActivityLogging.Attach(overviewThread);

                    String resultsFileBaseName = "StoreSCUEmulator_" + System.DateTime.Now.ToString("yyyyMMddHHmmss", System.Globalization.CultureInfo.InvariantCulture);
                    this.overviewThread.Options.ResultsFileNameOnlyWithoutExtension = resultsFileBaseName;

                    //
                    // Start the Dicom Overview Thread
                    //
                    this.overviewThread.Start();
                    isStopped = false;
                }
                if (checkBoxTS.Checked)
                {
                    //Convert the DICOM files to the preferred TS
                    convertedDicomFiles = convertDicomFiles(mediaFiles);
                    backgroundWorkerSCU.RunWorkerAsync(convertedDicomFiles);

                }
                else
                {
                    backgroundWorkerSCU.RunWorkerAsync(mediaFiles);
                }

                //isStopped = false;
                isImageExported = true;
            }
            catch (Exception theException)
            {
                MessageBox.Show(theException.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Ejemplo n.º 6
0
        private void dICOMEchoToolStripMenuItem_Click(object sender, EventArgs e)
        {
            string detailedEchoFileName = "";

            if (registeredPeersGrid.SelectedIndices.Count > 0)
            {
                int selectedIndex = registeredPeersGrid.SelectedIndices[0];

                //isStorageEcho = true;
                allThreadsFinished = false;
                if ((peers[selectedIndex].IP == null) || (peers[selectedIndex].IP.Length == 0))
                {
                    MessageBox.Show("Pl Specify SCP IP Address.", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    return;
                }

                //Update DVT & SUT settings
                OverviewThread overviewThread = new OverviewThread();
                overviewThread.Initialize(threadManager);
                overviewThread.Options.DeepCopyFrom(options);
                overviewThread.Options.Identifier = "Move_Destinations";
                overviewThread.Options.AttachChildsToUserInterfaces         = true;
                overviewThread.Options.LogThreadStartingAndStoppingInParent = false;
                overviewThread.Options.LogWaitingForCompletionChildThreads  = false;
                String resultsFileName = "MoveDestinations_" + System.DateTime.Now.ToString("yyyyMMddHHmmss", System.Globalization.CultureInfo.InvariantCulture);
                overviewThread.Options.ResultsFileNameOnlyWithoutExtension = resultsFileName;


                SCU echoScu = new SCU();
                echoScu.Initialize(overviewThread);
                echoScu.Options.DeepCopyFrom(options);

                String resultsFileBaseName = "MoveDestinationsEcho_" + System.DateTime.Now.ToString("yyyyMMddHHmmss", System.Globalization.CultureInfo.InvariantCulture);
                echoScu.Options.ResultsFileNameOnlyWithoutExtension = resultsFileBaseName;
                echoScu.Options.Identifier = resultsFileBaseName;

                echoScu.Options.LogThreadStartingAndStoppingInParent = false;
                echoScu.Options.LogWaitingForCompletionChildThreads  = false;
                echoScu.Options.AutoValidate     = false;
                echoScu.Options.ResultsDirectory = options.ResultsDirectory;

                //echoScu.Options.LocalAeTitle ="SCU";
                echoScu.Options.RemoteAeTitle  = peers[selectedIndex].AE;
                echoScu.Options.RemotePort     = peers[selectedIndex].Port;
                echoScu.Options.RemoteHostName = peers[selectedIndex].IP;
                //this.userControlActivityLogging.Attach(echoScu);

                detailedEchoFileName = echoScu.Options.DetailResultsFullFileName;
                PresentationContext presentationContext = new PresentationContext("1.2.840.10008.1.1",  // Abstract Syntax Name
                                                                                  "1.2.840.10008.1.2"); // Transfer Syntax Name(s)
                PresentationContext[] presentationContexts = new PresentationContext[1];
                presentationContexts[0] = presentationContext;

                DvtkHighLevelInterface.Dicom.Messages.DicomMessage echoMessage = new DvtkHighLevelInterface.Dicom.Messages.DicomMessage(DvtkData.Dimse.DimseCommand.CECHORQ);

                echoScu.Start();

                bool sendResult = echoScu.TriggerSendAssociationAndWait(echoMessage, presentationContexts);

                if (!sendResult)
                {
                    MessageBox.Show("DICOM Echo failed ", "Failed", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
                else
                {
                    MessageBox.Show("DICOM Echo successful", "Success", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }

                echoScu.Stop();
                if (OnShowEchoResults != null)
                {
                    OnShowEchoResults.Invoke(detailedEchoFileName, sendResult);
                }
                allThreadsFinished = false;
            }
        }