Example #1
0
        private void StorageSCPEmulator_Load(object sender, System.EventArgs e)
        {
            toolBarButtonError.Visible = false;
            toolBarButtonWarning.Visible = false;
            toolBarButtonLeft.Visible = false;
            toolBarButtonRight.Visible = false;
            toolBarButtonAbort.Enabled = false;

            //Hide the result tab page
            tabControlStorageSCP.Controls.Remove(tabPageResults);
            tabControlStorageSCP.SelectedTab = tabPageStorageSCPConfig;

            try
            {
                // Load the Emulator session
                LoadFromSessionFiles(this.storageOptions, this.storageCommitOptions);

                //
                // Stored files options.
                //
                this.fileGroups = new FileGroups("Storage SCP Emulator");

                this.validationResultsFileGroup = new ValidationResultsFileGroup();
                this.validationResultsFileGroup.DefaultFolder = "Results";
                this.fileGroups.Add(validationResultsFileGroup);

                this.receivedDicomMessagesFileGroup = new ReceivedDicomMessagesFileGroup();
                this.receivedDicomMessagesFileGroup.DefaultFolder = "Received DICOM Messages";
                this.fileGroups.Add(receivedDicomMessagesFileGroup);

                PixFileGroup pixFileGroup = new PixFileGroup(receivedDicomMessagesFileGroup);
                this.fileGroups.Add(pixFileGroup);

                this.fileGroups.CreateDirectories();

                this.fileGroups.CheckIsConfigured("\"Stored Files\\Options...\" menu item");

                this.storageOptions.ResultsDirectory = validationResultsFileGroup.Directory;
                this.storageOptions.DataDirectory = receivedDicomMessagesFileGroup.Directory;

                this.storageCommitOptions.ResultsDirectory = validationResultsFileGroup.Directory;
                this.storageCommitOptions.DataDirectory = receivedDicomMessagesFileGroup.Directory;

                // Make sure the session files contain the same information as the Stored Files user settings.
                SaveToSessionFiles(this.storageOptions, this.storageCommitOptions);

                sopClassesUserControlStoreSCP.UpdateDataGrid(this.storageOptions.DvtkScriptSession);

                this.storageOptions.StorageMode = Dvtk.Sessions.StorageMode.AsMedia;

                textBoxSCPAETitle.Text = this.storageOptions.LocalAeTitle;
                textBoxSCPPort.Text = this.storageOptions.LocalPort.ToString();
                textBoxImplClassUID.Text = this.storageOptions.DvtkScriptSession.DvtSystemSettings.ImplementationClassUid;
                textBoxImplVersion.Text = this.storageOptions.DvtkScriptSession.DvtSystemSettings.ImplementationVersionName;

                textBoxCommitSCPAETitle.Text = this.storageCommitOptions.LocalAeTitle;
                textBoxCommitSCPPort.Text = this.storageCommitOptions.LocalPort.ToString();

                textBoxStorageCommitPort.Text = this.storageCommitOptions.RemotePort.ToString();
                textBoxStorageCommitIPAdd.Text = this.storageCommitOptions.RemoteHostName;
                textBoxStorageCommitAETitle.Text = this.storageCommitOptions.RemoteAeTitle;

                numericCommitSCP.Value = this.storageCommitOptions.DvtkScriptSession.DvtSystemSettings.MaximumLengthReceived;
                numericStorageSCP.Value = this.storageOptions.DvtkScriptSession.DvtSystemSettings.MaximumLengthReceived;

                this.eventDelay = uint.Parse(textBoxDelay.Text);
            }
            catch (Exception except)
            {
                string msg = string.Format("Exception:{0}\n", except.Message);
                MessageBox.Show(this, "Application error:" +msg, "Error",MessageBoxButtons.OK, MessageBoxIcon.Error );
                this.Close();
                return;
            }
        }
Example #2
0
        public StorageSCUEmulator()
        {
            //
            // Required for Windows Form Designer support
            //
            InitializeComponent();

            InitializeBackgoundWorker();

            this.dvtkWebBrowserSCUEmulator.XmlStyleSheetFullFileName = applDirectory + "\\DVT_RESULTS.xslt";
            this.dvtkWebBrowserSCUEmulator.BackwardFormwardEnabledStateChangeEvent +=new DvtkApplicationLayer.UserInterfaces.DvtkWebBrowserNew.BackwardFormwardEnabledStateChangeEventHandler(dvtkWebBrowserSCUEmulator_BackwardFormwardEnabledStateChangeEvent);
            this.dvtkWebBrowserSCUEmulator.ErrorWarningEnabledStateChangeEvent += new DvtkWebBrowserNew.ErrorWarningEnabledStateChangeEventHandler(dvtkWebBrowserSCUEmulator_ErrorWarningEnabledStateChangeEvent);

            selectedTS.Add("1.2.840.10008.1.2");
            selectedTS.Add("1.2.840.10008.1.2.1");
            selectedTS.Add("1.2.840.10008.1.2.2");

            //
            // Set the .Net thread name for debugging purposes.
            //
            System.Threading.Thread.CurrentThread.Name = "Storage SCU Emulator";

            this.threadsStateChangeEventHandler = new ThreadManager.ThreadsStateChangeEventHandler(this.HandleThreadsStateChangeEvent);

            updateUIControlsHandler = new UpdateUIControlsDelegate(UpdateUIControls);

            updateUIControlsFromBGThreadHandler = new UpdateUIControlsFromBGThreadDelegate(UpdateUIControlsFromBGThread);

            this.threadManager = new ThreadManager();
            this.threadManager.ThreadsStateChangeEvent += this.threadsStateChangeEventHandler;

            //
            // Stored files options.
            //
            this.fileGroups = new FileGroups("Storage SCU Emulator");

            this.validationResultsFileGroup = new ValidationResultsFileGroup();
            this.validationResultsFileGroup.DefaultFolder = "Results";
            this.fileGroups.Add(validationResultsFileGroup);

            this.fileGroups.CreateDirectories();

            this.fileGroups.CheckIsConfigured("\"Stored Files\\Options...\" menu item");

            // Set Storage thread
            StoreScu storageScu = new StoreScu();

            storageScu.Initialize(this.threadManager);
            this.storageOptions = storageScu.Options;
            this.storageOptions.LoadFromFile(Path.Combine(applDirectory, "StorageSCUEmulator.ses"));
            this.storageOptions.StorageMode = Dvtk.Sessions.StorageMode.AsMediaOnly;
            this.storageOptions.ResultsDirectory = validationResultsFileGroup.Directory;
            this.storageOptions.DataDirectory = validationResultsFileGroup.Directory;
            //Environment.CurrentDirectory = this.storageOptions.ResultsDirectory;
            //Set the Commit thread
            CommitScu commitScu = new CommitScu(this);

            commitScu.Initialize(this.threadManager);
            this.storageCommitSCUOptions = commitScu.Options;
            this.storageCommitSCUOptions.LoadFromFile(Path.Combine(applDirectory, "CommitSCUEmulator.ses"));
            this.storageCommitSCUOptions.ResultsDirectory = validationResultsFileGroup.Directory;
            this.storageCommitSCUOptions.DataDirectory = validationResultsFileGroup.Directory;

            // Make sure the session files contain the same information as the Stored Files user settings.
            SaveToSessionFiles(this.storageOptions, this.storageCommitSCUOptions);

            this.storageCommitItems = new ReferencedSopItemCollection();
        }
Example #3
0
        //
        // - Constructors -
        //
        /// <summary>
        /// Default constructor.
        /// </summary>
        public QREmulator()
        {
            //
            // Required for Windows Form Designer support
            //
            InitializeComponent();

            this.dvtkWebBrowserResults.ErrorWarningEnabledStateChangeEvent+=new DvtkWebBrowserNew.ErrorWarningEnabledStateChangeEventHandler(dvtkWebBrowserResults_ErrorWarningEnabledStateChangeEvent);

            if (!Directory.Exists(ConfigurationsDirectory))
            {
                Directory.CreateDirectory(ConfigurationsDirectory);
            }

            this.config = Config.Deserialize(Path.Combine(ConfigurationsDirectory, "Config.xml"));
            Config.ConfigFullFileName = Path.Combine(ConfigurationsDirectory, "Config.xml");

            //
            // Initialize browser control.
            //
            rootPath = Application.StartupPath;

            this.dvtkWebBrowserResults.XmlStyleSheetFullFileName = Path.Combine(rootPath, "DVT_RESULTS.xslt");

            dataDirectory = Path.Combine(rootPath, @"Data\QueryRetrieve\");

            //Update settings from the config XML
            if(config.DataDirectoryForEmulation != "")
                dataDirectory = config.DataDirectoryForEmulation;
            else
                config.DataDirectoryForEmulation = dataDirectory;

            checkBoxPRInfoModel.Checked = config.PatientRootInfoModelSupport;
            checkBoxSRInfoModel.Checked = config.StudyRootInfoModelSupport;
            checkBoxPSRInfoModel.Checked = config.PatientStudyRootInfoModelSupport;
            this.AE.Checked = this.config.IsCaseSensitiveAE;
            this.CS.Checked = this.config.IsCaseSensitiveCS;
            this.LO.Checked = this.config.IsCaseSensitiveLO;
            this.PN.Checked = this.config.IsCaseSensitivePN;
            this.SH.Checked = this.config.IsCaseSensitiveSH;
            if(config.TSILESupport)
                selectedTS.Add("1.2.840.10008.1.2");
            if(config.TSELESupport)
                selectedTS.Add("1.2.840.10008.1.2.1");
            if(config.TSEBESupport)
                selectedTS.Add("1.2.840.10008.1.2.2");

            //
            // Set the .Net thread name for debugging purposes.
            //
            System.Threading.Thread.CurrentThread.Name = "QR SCP Emulator";

            //
            // Stored files options.
            //
            this.fileGroups = new FileGroups("QR SCP Emulator");

            this.validationResultsFileGroup = new ValidationResultsFileGroup();
            this.validationResultsFileGroup.DefaultFolder = "Results";
            this.fileGroups.Add(validationResultsFileGroup);

            this.fileGroups.CreateDirectories();

            this.fileGroups.CheckIsConfigured("\"Stored Files\\Options...\" menu item");

            //
            // The dvtkThreadManager.
            //
            ThreadManager threadManager = new ThreadManager();

            //
            // Construct the source QR SCP.
            //
            this.sourceQRScp = new SCP();
            this.sourceQRScp.Initialize(threadManager);
            this.sourceQRScp.Options.LoadFromFile(Path.Combine(rootPath, "QR_SCP.ses"));
            this.sourceQRScp.Options.Identifier = "QR_SCP_Emulator";
            this.sourceQRScp.Options.AttachChildsToUserInterfaces = true;
            this.sourceQRScp.Options.StorageMode = Dvtk.Sessions.StorageMode.NoStorage;
            this.sourceQRScp.Options.LogThreadStartingAndStoppingInParent = false;
            this.sourceQRScp.Options.LogWaitingForCompletionChildThreads = false;
            this.sourceQRScp.Options.ResultsDirectory = validationResultsFileGroup.Directory;
            this.sourceQRScp.Options.DataDirectory = validationResultsFileGroup.Directory;
            this.socketTimeout.Value = this.sourceQRScp.Options.SocketTimeout;
            //
            //Initialize move destinations
            //
            aeRegistrationControl1.Initialize(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments) + "\\DVtk\\QR SCP Emulator\\Configurations\\MoveDestinations.xml",
                sourceQRScp.Options);
            aeRegistrationControl1.OnShowEchoResults += new AERegistrationControl.ShowEchoResults(ShowMoveDestinationResults);

            //
            // Initialize the DicomThreadOptionsControls
            //
            this.dicomThreadOptionsUserControl.DicomThreadOptions = this.sourceQRScp.Options;
            this.dicomThreadOptionsUserControl.LocalAeTitleVisible = true;
            this.dicomThreadOptionsUserControl.LocalPortVisible = true;
            this.dicomThreadOptionsUserControl.LocalAETitleName = "Local AE title\n(QR SCP&& Store SCU)";
            this.dicomThreadOptionsUserControl.RemoteAeTitleLabel = "QR SCU AE Title:";
            this.dicomThreadOptionsUserControl.RemotePortLabel = "Move destination Port:";
            this.dicomThreadOptionsUserControl.RemoteIpAddressLabel = "Move destination IP Addr:";
            this.dicomThreadOptionsUserControl.RemoteAeTitleVisible = true;
            this.dicomThreadOptionsUserControl.RemoteIpAddressVisible = false;
            this.dicomThreadOptionsUserControl.RemotePortVisible = false;
            this.dicomThreadOptionsUserControl.OptionChangedEvent+= new DicomThreadOptionsUserControl.OptionChangedEventHandler(this.HandleOptionChanged);
            this.dicomThreadOptionsUserControl.UpdateUserControl();

            // Save the config so next time no attempt will be made to again try to load the same settings
            this.config.Serialize();

            //
            // Set the Backward/forward button handler.
            //
            this.dvtkWebBrowserResults.BackwardFormwardEnabledStateChangeEvent += new DvtkApplicationLayer.UserInterfaces.DvtkWebBrowserNew.BackwardFormwardEnabledStateChangeEventHandler(BackwardFormwardEnabledStateChangeEvent);
            UpdateButtons();

            this.threadsStateChangeEventHandler = new ThreadManager.ThreadsStateChangeEventHandler(this.HandleThreadsStateChangeEvent);

            // Load definition and DCM files
            dcmEditorQREmulator.DCMFileDataDirectory = validationResultsFileGroup.Directory;
            dcmEditorQREmulator.DefFile = sourceQRScp.Options.DvtkScriptSession.DefinitionManagement.DefinitionFileRootDirectory + "PatientRootQueryRetrieve-FIND.def";
            dcmEditorQREmulator.DCMFile = rootPath + @"\Data\QueryRetrieve\d1I00001.dcm";

            buttonBrowse.Visible = false;
            textBoxDataDir.Visible = false;

            dataDirectoryForTempFiles = validationResultsFileGroup.Directory;

            this.WindowState = FormWindowState.Maximized;
        }
Example #4
0
        /// <summary>
        /// Default constructor.
        /// </summary>
        public RisEmulator()
        {
            //
            // Required for Windows Form Designer support
            //
            InitializeComponent();

            if (!Directory.Exists(ConfigurationsDirectory))
            {
                Directory.CreateDirectory(ConfigurationsDirectory);
            }

            this.config = Config.Deserialize(Path.Combine(ConfigurationsDirectory, "Config.xml"));
            Config.ConfigFullFileName = Path.Combine(ConfigurationsDirectory, "Config.xml");

            //
            // Initialize the browser control.
            //
            rootPath = Application.StartupPath;

            this.dvtkWebBrowserResults.XmlStyleSheetFullFileName = Path.Combine(rootPath, "DVT_RESULTS.xslt");

            if(config.TSILESupport)
                selectedTS.Add("1.2.840.10008.1.2");
            if(config.TSELESupport)
                selectedTS.Add("1.2.840.10008.1.2.1");
            if(config.TSEBESupport)
                selectedTS.Add("1.2.840.10008.1.2.2");

            //if (config.SPSDChecked)
            //    checkBoxSPSD.Checked = true;
            //else
            //    checkBoxSPSD.Checked = false;

            //
            // Set the .Net thread name for debugging purposes.
            //
            System.Threading.Thread.CurrentThread.Name = "RIS Emulator";

            //
            // Stored files options.
            //
            this.fileGroups = new FileGroups("RIS Emulator");

            this.validationResultsFileGroup = new ValidationResultsFileGroup();
            this.validationResultsFileGroup.DefaultFolder = "Results";
            this.fileGroups.Add(validationResultsFileGroup);

            this.fileGroups.CreateDirectories();

            this.fileGroups.CheckIsConfigured("\"Stored Files\\Options...\" menu item");

            //
            // The ThreadManager.
            //
            ThreadManager threadManager = new ThreadManager();

            //
            // Construct the MPPS DicomOptions implicitly by constructing a DicomThread.
            //
            SCP mppsDicomThread = new SCP();
            mppsDicomThread.Initialize(threadManager);
            this.mppsOptions = mppsDicomThread.Options;
            this.mppsOptions.LoadFromFile(Path.Combine(rootPath, "MPPS_SCP.ses"));
            this.mppsOptions.Identifier = "MPPS";
            this.mppsOptions.AttachChildsToUserInterfaces = true;
            this.mppsOptions.StorageMode = Dvtk.Sessions.StorageMode.NoStorage;
            this.mppsOptions.LogThreadStartingAndStoppingInParent = false;
            this.mppsOptions.LogWaitingForCompletionChildThreads = false;
            this.mppsOptions.ResultsDirectory = validationResultsFileGroup.Directory;

            //
            // Construct the Worklist DicomOptions implicitly by constructing a DicomThread.
            //
            worklistDicomThread = new SCP();
            worklistDicomThread.Initialize(threadManager);
            this.worklistOptions = worklistDicomThread.Options;
            this.worklistOptions.LoadFromFile(Path.Combine(rootPath, "WLM_SCP.ses"));
            this.worklistOptions.Identifier = "Worklist";
            this.worklistOptions.AttachChildsToUserInterfaces = true;
            this.worklistOptions.StorageMode = Dvtk.Sessions.StorageMode.NoStorage;
            this.worklistOptions.LogThreadStartingAndStoppingInParent = false;
            this.worklistOptions.LogWaitingForCompletionChildThreads = false;
            this.worklistOptions.ResultsDirectory = validationResultsFileGroup.Directory;

            //
            // Initialize the DicomThreadOptionsControls
            //
            this.mppsOptionsControl.DicomThreadOptions = this.mppsOptions;
            this.mppsOptionsControl.LocalAeTitleVisible = true;
            this.mppsOptionsControl.LocalPortVisible = true;
            this.mppsOptionsControl.RemoteAeTitleVisible = true;
            this.mppsOptionsControl.OptionChangedEvent+= new DicomThreadOptionsUserControl.OptionChangedEventHandler(this.HandleOptionChanged);
            this.mppsOptionsControl.UpdateUserControl();

            this.worklistOptionsControl.DicomThreadOptions = this.worklistOptions;
            this.worklistOptionsControl.LocalAeTitleVisible = true;
            this.worklistOptionsControl.LocalPortVisible = true;
            this.worklistOptionsControl.RemoteAeTitleVisible = true;
            this.worklistOptionsControl.OptionChangedEvent+= new DicomThreadOptionsUserControl.OptionChangedEventHandler(this.HandleOptionChanged);
            this.worklistOptionsControl.UpdateUserControl();

            // Save the config so next time no attempt will be made to again try to load the same settings
            this.config.Serialize();

            //
            // Set the Backward/forward button handler.
            //
            this.dvtkWebBrowserResults.BackwardFormwardEnabledStateChangeEvent+= new DvtkWebBrowserNew.BackwardFormwardEnabledStateChangeEventHandler(BackwardFormwardEnabledStateChangeEvent);

            UpdateButtons();

            //
            // Other.
            //
            this.threadsStateChangeEventHandler = new ThreadManager.ThreadsStateChangeEventHandler(this.HandleThreadsStateChangeEvent);

            // Load definition and DCM files
            dcmEditorRISEmulator.DCMFileDataDirectory = validationResultsFileGroup.Directory;
            dcmEditorRISEmulator.DefFile = this.worklistOptions.DvtkScriptSession.DefinitionManagement.DefinitionFileRootDirectory + "ModalityWorklist-FIND.def";
            dcmEditorRISEmulator.DefFile = this.worklistOptions.DvtkScriptSession.DefinitionManagement.DefinitionFileRootDirectory + "ModalityPerformedProcedureStep.def";
            dcmEditorRISEmulator.DCMFile = rootPath + @"\Data\Worklist\d1I00001.dcm";
            dataDirectory = this.worklistOptions.DataDirectory;

            //Update settings from the config XML
            if (config.DataDirectoryForEmulation != "")
                dataDirectory = config.DataDirectoryForEmulation;
            else
                config.DataDirectoryForEmulation = dataDirectory;

            buttonBrowse.Visible = false;
            textBoxDataDir.Visible = false;
            buttonStart.Enabled = false;

            dataDirectoryForTempFiles = validationResultsFileGroup.Directory;

            this.WindowState = FormWindowState.Maximized;
        }