public OverviewThread(DicomThread sourceQRDicomThread, ArrayList selectedTS, bool patientRoot, bool studyRoot, bool patientStudyRoot,List<DICOMPeer> dicomPeers) { this.sourceQRDicomThread = sourceQRDicomThread; this.selectedTSList = selectedTS; isPatientRoot = patientRoot; isStudyRoot = studyRoot; isPatientStudyRoot = patientStudyRoot; DicomPeers = dicomPeers; }
public OverviewThread(DicomThreadOptions mppsOptions, DicomThread thread, ArrayList selectedTS, bool isSendRandomRsps, string dcmFile, int nrOfRsps) { this.mppsOptions = mppsOptions; this.worklistThread = thread; this.worklistOptions = thread.Options; this.selectedTSList = selectedTS; this.sendRandomizeRsps = isSendRandomRsps; this.selectedDCMFile = dcmFile; this.nrOfRandomRsps = nrOfRsps; }
public static void SetOptions(DicomThread dicomThread, String testName, String identifier) { String TestResultsDirectory = Path.Combine(Paths.ResultsDirectoryFullPath, testName); if (!Directory.Exists(TestResultsDirectory)) { Directory.CreateDirectory(TestResultsDirectory); } dicomThread.Options.LocalPort = 104; dicomThread.Options.RemotePort = 104; dicomThread.Options.RemoteHostName = "localhost"; dicomThread.Options.ResultsDirectory = TestResultsDirectory; dicomThread.Options.Identifier = identifier; }
/// <summary> /// Constructor. /// </summary> /// <param name="dicomThread">The DicomThread to add the mapping information to in it's results.</param> public AttributeSetResultsLoggingVisitor(DvtkHighLevelInterface.Dicom.Threads.DicomThread dicomThread) { this.dicomThread = dicomThread; }
public StorageSCPEmulator() { // // Required for Windows Form Designer support // InitializeComponent(); this.dvtkWebBrowserSCPEmulator.XmlStyleSheetFullFileName = applDirectory + "\\DVT_RESULTS.xslt"; this.dvtkWebBrowserSCPEmulator.BackwardFormwardEnabledStateChangeEvent += new DvtkWebBrowserNew.BackwardFormwardEnabledStateChangeEventHandler(dvtkWebBrowserSCPEmulator_BackwardFormwardEnabledStateChangeEvent); this.dvtkWebBrowserSCPEmulator.ErrorWarningEnabledStateChangeEvent += new DvtkWebBrowserNew.ErrorWarningEnabledStateChangeEventHandler(dvtkWebBrowserSCPEmulator_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"); selectedTS.Add("1.2.840.10008.1.2.4.70"); selectedTS.Add("1.2.840.10008.1.2.4.50"); selectedTS.Add("1.2.840.10008.1.2.5"); selectedSops.Add("1.2.840.10008.1.1"); selectedTSCommit.Add("1.2.840.10008.1.2"); selectedTSCommit.Add("1.2.840.10008.1.2.1"); selectedTSCommit.Add("1.2.840.10008.1.2.2"); // // Set the .Net thread name for debugging purposes. // System.Threading.Thread.CurrentThread.Name = "Storage SCP Emulator"; // // The ThreadManager. // this.threadManager = new ThreadManager(); // // Construct the Storage DicomOptions implicitly by constructing a DicomThread. // storageSCPDicomThread = new SCP(); storageSCPDicomThread.Initialize(this.threadManager); this.storageOptions = storageSCPDicomThread.Options; this.storageOptions.Identifier = "Storage SCP"; this.storageOptions.AttachChildsToUserInterfaces = true; this.storageOptions.StorageMode = Dvtk.Sessions.StorageMode.AsMedia; this.storageOptions.LogThreadStartingAndStoppingInParent = false; this.storageOptions.LogWaitingForCompletionChildThreads = false; // // Construct the Storage DicomOptions implicitly by constructing a DicomThread. // storageCommitSCPDicomThread = new SCP(); storageCommitSCPDicomThread.Initialize(this.threadManager); this.storageCommitOptions = storageCommitSCPDicomThread.Options; this.storageCommitOptions.Identifier = "Storage Commit SCP"; this.storageCommitOptions.AttachChildsToUserInterfaces = true; this.storageCommitOptions.StorageMode = Dvtk.Sessions.StorageMode.NoStorage; this.storageCommitOptions.LogThreadStartingAndStoppingInParent = false; this.storageCommitOptions.LogWaitingForCompletionChildThreads = false; this.threadsStateChangeEventHandler = new ThreadManager.ThreadsStateChangeEventHandler(this.HandleThreadsStateChangeEvent); }
private void CheckErrorsAndWarnings(DicomThread dicomScriptThread, string scriptFile, int expectedNrOfGeneralErrors, int expectedNrOfGeneralWarnings, int expectedNrOfUserErrors, int expectedNrOfUserWarnings, int expectedNrOfValidationErrors, int expectedNrOfValidationWarnings) { bool different = false; // Start with new row dicomThread.Table.NewRow(); // Comment column if (expectedNrOfGeneralErrors != dicomScriptThread.NrOfGeneralErrors) { dicomThread.Table.AddRedItem(COMMENT_INDEX, String.Format("Number of general errors differs (expected {0}, actual {1}).", expectedNrOfGeneralErrors, dicomScriptThread.NrOfGeneralErrors)); different = true; } // Comment column if (expectedNrOfGeneralWarnings != dicomScriptThread.NrOfGeneralWarnings) { dicomThread.Table.AddRedItem(COMMENT_INDEX, String.Format("Number of general warnings differs (expected {0}, actual {1}).", expectedNrOfGeneralWarnings, dicomScriptThread.NrOfGeneralWarnings)); different = true; } // Comment column if (expectedNrOfUserErrors != dicomScriptThread.NrOfUserErrors) { dicomThread.Table.AddRedItem(COMMENT_INDEX, String.Format("Number of user errors differs (expected {0}, actual {1}).", expectedNrOfUserErrors, dicomScriptThread.NrOfUserErrors)); different = true; } // Comment column if (expectedNrOfUserWarnings != dicomScriptThread.NrOfUserWarnings) { dicomThread.Table.AddRedItem(COMMENT_INDEX, String.Format("Number of user warnings differs (expected {0}, actual {1}).", expectedNrOfUserWarnings, dicomScriptThread.NrOfUserWarnings)); different = true; } // Comment column if (expectedNrOfValidationErrors != dicomScriptThread.NrOfValidationErrors) { dicomThread.Table.AddRedItem(COMMENT_INDEX, String.Format("Number of validation errors differs (expected {0}, actual {1}).", expectedNrOfValidationErrors, dicomScriptThread.NrOfValidationErrors)); different = true; } // Comment column if (expectedNrOfValidationWarnings != dicomScriptThread.NrOfValidationWarnings) { dicomThread.Table.AddRedItem(COMMENT_INDEX, String.Format("Number of validation warnings differs (expected {0}, actual {1}).", expectedNrOfValidationWarnings, dicomScriptThread.NrOfValidationWarnings)); different = true; } dicomThread.Table.AddBlackItem(COMMENT_INDEX, "<A HREF='" + dicomScriptThread.Options.DetailResultsFileNameOnly + "'>See detail" + "</A>" + " " + "<A HREF='" + dicomScriptThread.Options.SummaryResultsFileNameOnly + "'>See summary" + "</A>"); // Session column. dicomThread.Table.AddBlackItem(SESSION_INDEX, dicomScriptThread.Options.DvtkScriptSession.SessionFileName); // Test Case column. dicomThread.Table.AddBlackItem(TEST_CASE_INDEX, scriptFile); // PASSED or FAILED column. if (different) dicomThread.Table.AddRedItem(PASSED_FAILED_INDEX, "F"); else dicomThread.Table.AddBlackItem(PASSED_FAILED_INDEX, "P"); }
/// <summary> /// Create the QR information model on the fly /// </summary> /// <param name="randomizeFirst"></param> /// <param name="isCreationForDisplay"></param> /// <param name="patientRoot"></param> /// <param name="studyRoot"></param> /// <param name="patientStudyRoot"></param> /// <param name="dicomThread"></param> /// <returns></returns> public static QueryRetrieveInformationModels CreateQueryRetrieveInformationModels(bool randomizeFirst, bool isCreationForDisplay, bool patientRoot, bool studyRoot, bool patientStudyRoot, DicomThread dicomThread) { QueryRetrieveInformationModels queryRetrieveInformationModels = new QueryRetrieveInformationModels(); //Specify directory for temp DCM files queryRetrieveInformationModels.DataDirectory = dataDirectoryForTempFiles; DirectoryInfo directoryInfo = new DirectoryInfo(dataDirectory); FileInfo[] fileInfos = directoryInfo.GetFiles(); foreach (FileInfo fileInfo in fileInfos) { try { DvtkHighLevelInterface.Dicom.Files.DicomFile dicomFile = new DvtkHighLevelInterface.Dicom.Files.DicomFile(); if (isCreationForDisplay) dicomFile.DataSet.StoreOBOFOWValuesWhenReading = false; dicomFile.Read(fileInfo.FullName, dicomThread); if (randomizeFirst) dicomFile.DataSet.Randomize("@"); //queryRetrieveInformationModels.Add(dataSet, true); if (patientRoot) queryRetrieveInformationModels.PatientRoot.AddToInformationModel(dicomFile, true); if (studyRoot) queryRetrieveInformationModels.StudyRoot.AddToInformationModel(dicomFile, true); if (patientStudyRoot) queryRetrieveInformationModels.PatientStudyOnly.AddToInformationModel(dicomFile, true); } catch (Exception) { string theErrorText = string.Format("Invalid DICOM File - {0} will be skiped from QR information model.", fileInfo.FullName); dicomThread.WriteInformation(theErrorText); } } return (queryRetrieveInformationModels); }
/// <summary> /// Determines if the first received DicomMessage in a DicomThread instance has an explicit transfer syntax. /// </summary> /// <param name="dicomThread">The DicomThread.</param> /// <returns>Boolean indicating if the first received DicomMessage has an explicit transfer syntax.</returns> private bool IsDataTransferExplicit(DicomThread dicomThread) { bool isDataTransferExplicit = true; if ((dicomThread.Messages.ReceivedMessages.DicomMessages.Count > 0)) { DicomMessage firstReceivedDicomMessage = dicomThread.Messages.ReceivedMessages.DicomMessages[0]; byte presentationContextIdFirstReceivedDicomMessage = firstReceivedDicomMessage.EncodedPresentationContextID; AssociateAc firstReceivedAssociateAc = null; foreach (DulMessage dulMessage in dicomThread.Messages.SendMessages.DulMessages) { if (dulMessage is AssociateAc) { firstReceivedAssociateAc = dulMessage as AssociateAc; break; } } if (firstReceivedAssociateAc != null) { foreach (PresentationContext presentationContext in firstReceivedAssociateAc.PresentationContexts) { if (presentationContext.ID == presentationContextIdFirstReceivedDicomMessage) { String transferSyntax = presentationContext.TransferSyntax; if (transferSyntax == "1.2.840.10008.1.2") { isDataTransferExplicit = false; } else { isDataTransferExplicit = true; } } } } } return (isDataTransferExplicit); }
// !!!! Duidelijk maken dat onderstaande event wordt geraised vanwege childs. private void HandleChildAssociationReleasedEvent(DicomThread dicomThread) { TriggerAssociationReleasedEvent(dicomThread); }
protected void TriggerAssociationReleasedEvent(DicomThread dicomThread) { if (AssociationReleasedEvent != null) { AssociationReleasedEvent(dicomThread); } }
/// <summary> /// /// </summary> /// <param name="scuAeTitle"></param> /// <param name="randomizeFirst"></param> /// <returns></returns> public static ModalityWorklistInformationModel CreateMWLInformationModel(bool randomizeFirst, DicomThread dicomThread) { dicomThread.WriteInformation(string.Format("Creating the MWL information model based on data directory : {0}", dataDirectory)); ModalityWorklistInformationModel modalityWorklistInformationModel = new ModalityWorklistInformationModel(); //Specify directory for temp DCM files modalityWorklistInformationModel.DataDirectory = dataDirectoryForTempFiles; DirectoryInfo directoryInfo = new DirectoryInfo(dataDirectory); FileInfo[] fileInfos = directoryInfo.GetFiles(); if (fileInfos.Length != 0) { foreach (FileInfo fileInfo in fileInfos) { try { DataSet dataSet = new DataSet(); dataSet.Read(fileInfo.FullName); if (randomizeFirst) { dataSet.Randomize("@"); } modalityWorklistInformationModel.AddToInformationModel(dataSet); } catch (Exception ) { string theErrorText = string.Format("Invalid DICOM File - {0} will be skiped from MWL information model.\n\n", fileInfo.FullName); dicomThread.WriteInformation(theErrorText); } } } if (isCurrentSPSD) { //modalityWorklistInformationModel.AddDefaultAttributeToInformationModel(true, "0x00400001", DvtkData.Dimse.VR.AE, scuAeTitle); modalityWorklistInformationModel.AddDefaultAttributeToInformationModel(true, "0x00400100[1]/0x00400002", DvtkData.Dimse.VR.DA, System.DateTime.Now.ToString("yyyyMMdd", System.Globalization.CultureInfo.InvariantCulture)); modalityWorklistInformationModel.AddDefaultAttributeToInformationModel(true, "0x00400100[1]/0x00400003", DvtkData.Dimse.VR.TM, System.DateTime.Now.ToString("HHmmss", System.Globalization.CultureInfo.InvariantCulture)); } return (modalityWorklistInformationModel); }