public override void ApplyConfig(DicomConfig config) { // set up the Query/Retrieve information models QueryRetrieveInformationModels informationModels = new QueryRetrieveInformationModels(); // load the information models informationModels.Load(config.DataDirectory); // add any default attribute values to the information models informationModels.AddDefaultAttribute("0x00080005", DvtkData.Dimse.VR.CS, "ISO IR 6"); informationModels.AddDefaultAttribute("0x00080090", DvtkData.Dimse.VR.PN, "Referring^Physician^Dr"); // add any additional attribute values to the information models informationModels.AddAdditionalAttribute("0x00080054", DvtkData.Dimse.VR.AE, config.DvtAeTitle); // set up the query/retrieve SCP QueryRetrieveScp queryRetrieveScp = new QueryRetrieveScp(); Scp = queryRetrieveScp; // apply the remaining configuration base.ApplyConfig(config); // add the default message handlers with the information models queryRetrieveScp.AddDefaultMessageHandlers(informationModels); }
/// <summary> /// Apply the Dicom Configuration to the Client, /// </summary> /// <param name="commonConfig">Common Configuration.</param> /// <param name="config">Dicom Configuration.</param> public override void ApplyConfig(CommonConfig commonConfig, DicomPeerToPeerConfig config) { // set up the Query/Retrieve information models QueryRetrieveInformationModels informationModels = new QueryRetrieveInformationModels(); // Do not load the Information Models here as they are loaded (refreshed) on each query // - just define the data directory informationModels.DataDirectory = RootedBaseDirectory.GetFullPathname(commonConfig.RootedBaseDirectory, config.SourceDataDirectory); // add any default attribute values to the information models bool overWriteExistingValue = true; informationModels.AddDefaultAttribute(overWriteExistingValue, "0x00080005", VR.CS, "ISO IR 6"); informationModels.AddDefaultAttribute(overWriteExistingValue, "0x00080090", VR.PN, "Referring^Physician^Dr"); // add any additional attribute values to the information models informationModels.AddAdditionalAttribute(overWriteExistingValue, "0x00080054", VR.AE, config.ToActorAeTitle); // set up the query/retrieve SCP QueryRetrieveScp queryRetrieveScp = new QueryRetrieveScp(); // update supported transfer syntaxes here //queryRetrieveScp.ClearTransferSyntaxes(); //queryRetrieveScp.AddTransferSyntax(HliScp.IMPLICIT_VR_LITTLE_ENDIAN); // Save the SCP and apply the configuration Scp = queryRetrieveScp; base.ApplyConfig(commonConfig, config); // add the default message handlers with the information models queryRetrieveScp.AddDefaultMessageHandlers(informationModels); }
/// <summary> /// Apply the Dicom Configuration to the Client, /// </summary> /// <param name="commonConfig">Common Configuration.</param> /// <param name="config">Dicom Configuration.</param> public override void ApplyConfig(CommonConfig commonConfig, DicomPeerToPeerConfig config) { // set up the Query/Retrieve information models QueryRetrieveInformationModels informationModels = new QueryRetrieveInformationModels(); // Do not load the Information Models here as they are loaded (refreshed) on each query // - just define the data directory informationModels.DataDirectory = RootedBaseDirectory.GetFullPathname(commonConfig.RootedBaseDirectory, config.SourceDataDirectory); // add any default attribute values to the information models bool overWriteExistingValue = true; informationModels.AddDefaultAttribute(overWriteExistingValue, "0x00080005", VR.CS, "ISO IR 6"); informationModels.AddDefaultAttribute(overWriteExistingValue, "0x00080090", VR.PN, "Referring^Physician^Dr"); // add any additional attribute values to the information models informationModels.AddAdditionalAttribute(overWriteExistingValue, "0x00080054", VR.AE, config.ToActorAeTitle); // set up the query/retrieve SCP QueryRetrieveScp queryRetrieveScp = new QueryRetrieveScp(); // update supported transfer syntaxes here //queryRetrieveScp.ClearTransferSyntaxes(); //queryRetrieveScp.AddTransferSyntax(HliScp.IMPLICIT_VR_LITTLE_ENDIAN); // Save the SCP and apply the configuration Scp = queryRetrieveScp; base.ApplyConfig(commonConfig, config); // add the default message handlers with the information models queryRetrieveScp.AddDefaultMessageHandlers(informationModels); }
/// <summary> /// Add the default message handlers - include the Information Models that should be used. /// </summary> /// <param name="informationModels">Information Model to use with this message handler.</param> /// <param name="eventDelay">Delay in milliseconds before N-EVENT-REPORT-RQ sent.</param> public void AddDefaultMessageHandlers(QueryRetrieveInformationModels informationModels, int eventDelay) { // add the NActionNEventReportHandler AddToBack(new NActionNEventReportHandler(informationModels, eventDelay)); // add the NEventReportHandler AddToBack(new NEventReportHandler()); }
/// <summary> /// Add the default message handlers - include the Information Models that should be used. /// </summary> /// <param name="informationModels">Information Model to use with this message handler.</param> /// <param name="eventDelay">Delay in milliseconds before N-EVENT-REPORT-RQ sent.</param> public void AddDefaultMessageHandlers(QueryRetrieveInformationModels informationModels, int eventDelay) { // add the NActionNEventReportHandler AddToBack(new NActionNEventReportHandler(informationModels, eventDelay)); // add the NEventReportHandler AddToBack(new NEventReportHandler()); }
/// <summary> /// Add the default message handlers - include the Information Models that should be used. /// </summary> /// <param name="informationModels">Query Retrieve Information Models.</param> public void AddDefaultMessageHandlers(QueryRetrieveInformationModels informationModels) { // add the CFindHandler with the Information Models CFindHandler cFindHandler = new CFindHandler(); if (informationModels.PatientRoot != null) { cFindHandler.PatientRootInformationModel = informationModels.PatientRoot; } if (informationModels.StudyRoot != null) { cFindHandler.StudyRootInformationModel = informationModels.StudyRoot; } if (informationModels.PatientStudyOnly != null) { cFindHandler.PatientStudyOnlyInformationModel = informationModels.PatientStudyOnly; } cFindHandler.RefreshInformationModelBeforeUse = true; AddToBack(cFindHandler); // add the CMoveHandler with the Information Models CMoveHandler cMoveHandler = new CMoveHandler(); if (informationModels.PatientRoot != null) { cMoveHandler.PatientRootInformationModel = informationModels.PatientRoot; } if (informationModels.StudyRoot != null) { cMoveHandler.StudyRootInformationModel = informationModels.StudyRoot; } if (informationModels.PatientStudyOnly != null) { cMoveHandler.PatientStudyOnlyInformationModel = informationModels.PatientStudyOnly; } cMoveHandler.RefreshInformationModelBeforeUse = true; AddToBack(cMoveHandler); // add the CGetHandler with the Information Models CGetHandler cGetHandler = new CGetHandler(); if (informationModels.PatientRoot != null) { cGetHandler.PatientRootInformationModel = informationModels.PatientRoot; } if (informationModels.StudyRoot != null) { cGetHandler.StudyRootInformationModel = informationModels.StudyRoot; } if (informationModels.PatientStudyOnly != null) { cGetHandler.PatientStudyOnlyInformationModel = informationModels.PatientStudyOnly; } cGetHandler.RefreshInformationModelBeforeUse = true; AddToBack(cGetHandler); }
/// <summary> /// Add the default message handlers - include the Information Models that should be used. /// </summary> /// <param name="informationModels">Query Retrieve Information Models.</param> public void AddDefaultMessageHandlers(QueryRetrieveInformationModels informationModels) { // add the CFindHandler with the Information Models CFindHandler cFindHandler = new CFindHandler(); if (informationModels.PatientRoot != null) { cFindHandler.PatientRootInformationModel = informationModels.PatientRoot; } if (informationModels.StudyRoot != null) { cFindHandler.StudyRootInformationModel = informationModels.StudyRoot; } if (informationModels.PatientStudyOnly != null) { cFindHandler.PatientStudyOnlyInformationModel = informationModels.PatientStudyOnly; } cFindHandler.RefreshInformationModelBeforeUse = true; AddToBack(cFindHandler); // add the CMoveHandler with the Information Models CMoveHandler cMoveHandler = new CMoveHandler(); if (informationModels.PatientRoot != null) { cMoveHandler.PatientRootInformationModel = informationModels.PatientRoot; } if (informationModels.StudyRoot != null) { cMoveHandler.StudyRootInformationModel = informationModels.StudyRoot; } if (informationModels.PatientStudyOnly != null) { cMoveHandler.PatientStudyOnlyInformationModel = informationModels.PatientStudyOnly; } cMoveHandler.RefreshInformationModelBeforeUse = true; AddToBack(cMoveHandler); // add the CGetHandler with the Information Models CGetHandler cGetHandler = new CGetHandler(); if (informationModels.PatientRoot != null) { cGetHandler.PatientRootInformationModel = informationModels.PatientRoot; } if (informationModels.StudyRoot != null) { cGetHandler.StudyRootInformationModel = informationModels.StudyRoot; } if (informationModels.PatientStudyOnly != null) { cGetHandler.PatientStudyOnlyInformationModel = informationModels.PatientStudyOnly; } cGetHandler.RefreshInformationModelBeforeUse = true; AddToBack(cGetHandler); }
private bool SendNEventReport(QueryRetrieveInformationModels qrInfoModels, DicomMessage dicomMessage) { // create the N-EVENT-REPORT-RQ based in the contents of the N-ACTION-RQ DicomMessage requestMessage = GenerateTriggers.MakeStorageCommitEvent(qrInfoModels, dicomMessage); // send the request this.Send(requestMessage); ReceiveDicomMessage(); isEventSent = true; return(isEventSent); }
QueryRetrieveInformationModels CreateQueryRetrieveInformationModels(bool randomizeFirst, string directory) { WriteInformation(string.Format("Creating the QR information model based on data directory : {0}", directory)); QueryRetrieveInformationModels queryRetrieveInformationModels = new QueryRetrieveInformationModels(); //Specify directory for temp DCM files //String tempDir = Path.Combine(Path.GetTempPath(), "DVTkStorageSCP"); //if (!Directory.Exists(tempDir)) //{ // Directory.CreateDirectory(tempDir); //} queryRetrieveInformationModels.DataDirectory = directory; DirectoryInfo directoryInfo = new DirectoryInfo(directory); FileInfo[] fileInfos = directoryInfo.GetFiles(); foreach (FileInfo fileInfo in fileInfos) { if ((fileInfo.Extension.ToLower() == ".dcm") || (fileInfo.Extension == "") || (fileInfo.Extension == null)) { try { DvtkHighLevelInterface.Dicom.Files.DicomFile dicomFile = new DvtkHighLevelInterface.Dicom.Files.DicomFile(); dicomFile.Read(fileInfo.FullName, this); if (randomizeFirst) { dicomFile.DataSet.Randomize("@"); } queryRetrieveInformationModels.Add(dicomFile, false); } catch (Exception) { string theErrorText = string.Format("Invalid DICOM File - {0} will be skiped from QR information model.", fileInfo.FullName); WriteInformation(theErrorText); } } } return(queryRetrieveInformationModels); }
/// <summary> /// Add the default message handlers - include the Information Models that should be used. /// </summary> /// <param name="informationModels">Query Retrieve Information Models.</param> public void AddDefaultMessageHandlers(QueryRetrieveInformationModels informationModels) { // add the CFindHandler with the Information Models CFindHandler cFindHandler = new CFindHandler(informationModels); AddToBack(cFindHandler); // add the CMoveHandler with the Information Models CMoveHandler cMoveHandler = new CMoveHandler(informationModels); AddToBack(cMoveHandler); // add the CGetHandler with the Information Models CGetHandler cGetHandler = new CGetHandler(informationModels); AddToBack(cGetHandler); }
/// <summary> /// Overridden N-ACTION-RQ message handler. Return an N-EVENT-REPORT-RQ /// after the N-ACTION-RSP. /// </summary> /// <param name="queryMessage">N-ACTION-RQ and Dataset.</param> /// <returns>Boolean - true if dicomMessage handled here.</returns> protected override void AfterHandlingNActionRequest(DicomMessage dicomMessage) { isEventSent = false; // set up the default N-ACTION-RSP with a successful status DicomMessage responseMessage = new DicomMessage(DvtkData.Dimse.DimseCommand.NACTIONRSP); responseMessage.Set("0x00000900", DvtkData.Dimse.VR.US, 0); // send the response this.Send(responseMessage); IsMessageHandled = true; // creating information model QueryRetrieveInformationModels qrInfoModels = CreateQueryRetrieveInformationModels(true, _dataDirectory); // delay before generating the N-EVENT-REPORT-RQ WriteInformation(string.Format("Delaying the N-EVENT-REPORT by {0} secs", _eventDelay / 1000)); isAssociated = true; int waitedTime = 0; if (WaitForPendingDataInNetworkInputBuffer(_eventDelay, ref waitedTime)) { ReleaseRq releaseRq = ReceiveReleaseRq(); if (releaseRq != null) { SendReleaseRp(); isAssociated = false; } } if (!isAssociated) { string info = "Sending the N-Event-Report asynchronously."; WriteInformation(info); SCU commitScu = new SCU(); commitScu.Initialize(this.Parent); // Set the correct settings for the overview DicomThread. // commitScu.Options.Identifier = "Storage_Commitment_SCU_association_" + storageCommitmentScuIndex.ToString(); commitScu.Options.ResultsFileNameOnlyWithoutExtension = (this.overviewThread as StoreCommitScp).startDateTime + "_Storage_Commitment_SCU_association_" + storageCommitmentScuIndex.ToString(); storageCommitmentScuIndex++; commitScu.Options.LocalAeTitle = this.Options.LocalAeTitle; commitScu.Options.RemoteAeTitle = _remoteAETitle; commitScu.Options.RemotePort = _port; commitScu.Options.RemoteHostName = _remoteHostName; commitScu.Options.RemoteRole = Dvtk.Sessions.SutRole.Requestor; commitScu.Options.ResultsDirectory = this.Options.ResultsDirectory; commitScu.Options.DataDirectory = this.Options.DataDirectory; commitScu.Options.StorageMode = Dvtk.Sessions.StorageMode.NoStorage; commitScu.Options.LogThreadStartingAndStoppingInParent = false; commitScu.Options.LogWaitingForCompletionChildThreads = false; commitScu.Options.AutoValidate = false; PresentationContext presentationContext = new PresentationContext("1.2.840.10008.1.20.1", // Abstract Syntax Name "1.2.840.10008.1.2"); // Transfer Syntax Name(s) PresentationContext[] presentationContexts = new PresentationContext[1]; presentationContexts[0] = presentationContext; // create the N-EVENT-REPORT-RQ based in the contents of the N-ACTION-RQ DicomMessage requestMessage = GenerateTriggers.MakeStorageCommitEvent(qrInfoModels, dicomMessage); if (waitedTime < _eventDelay) { Sleep(_eventDelay - waitedTime); } commitScu.Start(); isEventSent = commitScu.TriggerSendAssociationAndWait(requestMessage, presentationContexts); } else { string info = "Sending the N-Event-Report synchronously."; WriteInformation(info); if (!isEventSent) { SendNEventReport(qrInfoModels, dicomMessage); } } }
public CMoveHandler(QueryRetrieveInformationModels informationModels) { _informationModels = informationModels; }
public DicomStorageCommitServer(BaseActor parentActor, ActorNameEnum actorName) : base(parentActor, actorName) { // set up the Query/Retrieve information models _informationModels = new QueryRetrieveInformationModels(); }
private bool SendNEventReport(QueryRetrieveInformationModels qrInfoModels, DicomMessage dicomMessage) { // create the N-EVENT-REPORT-RQ based in the contents of the N-ACTION-RQ DicomMessage requestMessage = GenerateTriggers.MakeStorageCommitEvent(qrInfoModels, dicomMessage); // send the request this.Send(requestMessage); ReceiveDicomMessage(); isEventSent = true; return isEventSent; }
QueryRetrieveInformationModels CreateQueryRetrieveInformationModels(bool randomizeFirst, string directory) { WriteInformation(string.Format("Creating the QR information model based on data directory : {0}", directory)); QueryRetrieveInformationModels queryRetrieveInformationModels = new QueryRetrieveInformationModels(); //Specify directory for temp DCM files //String tempDir = Path.Combine(Path.GetTempPath(), "DVTkStorageSCP"); //if (!Directory.Exists(tempDir)) //{ // Directory.CreateDirectory(tempDir); //} queryRetrieveInformationModels.DataDirectory = directory; DirectoryInfo directoryInfo = new DirectoryInfo(directory); FileInfo[] fileInfos = directoryInfo.GetFiles(); foreach (FileInfo fileInfo in fileInfos) { if ((fileInfo.Extension.ToLower() == ".dcm") || (fileInfo.Extension == "") || (fileInfo.Extension == null)) { try { DvtkHighLevelInterface.Dicom.Files.DicomFile dicomFile = new DvtkHighLevelInterface.Dicom.Files.DicomFile(); dicomFile.Read(fileInfo.FullName, this); if (randomizeFirst) dicomFile.DataSet.Randomize("@"); queryRetrieveInformationModels.Add(dicomFile, false); } catch (Exception) { string theErrorText = string.Format("Invalid DICOM File - {0} will be skiped from QR information model.", fileInfo.FullName); WriteInformation(theErrorText); } } } return (queryRetrieveInformationModels); }
/// <summary> /// Cretae a storage commitment event. /// </summary> /// <param name="informationModels">The information models.</param> /// <param name="actionMessage">The action message.</param> /// <returns>The created event.</returns> public static DvtkHighLevelInterface.Dicom.Messages.DicomMessage MakeStorageCommitEvent(QueryRetrieveInformationModels informationModels, DvtkHighLevelInterface.Dicom.Messages.DicomMessage actionMessage) { // refresh the information models informationModels.Refresh(); DvtkHighLevelInterface.Dicom.Messages.DicomMessage eventMessage = new DvtkHighLevelInterface.Dicom.Messages.DicomMessage(DvtkData.Dimse.DimseCommand.NEVENTREPORTRQ); eventMessage.Set("0x00000002", VR.UI, "1.2.840.10008.1.20.1"); eventMessage.Set("0x00001000", VR.UI, "1.2.840.10008.1.20.1.1"); DvtkData.Dimse.DataSet actionDataset = actionMessage.DataSet.DvtkDataDataSet; DvtkData.Dimse.DataSet eventDataset = new DvtkData.Dimse.DataSet(); DvtkData.Dimse.Attribute eventReferenceSopSequence = new DvtkData.Dimse.Attribute(0x00081199, DvtkData.Dimse.VR.SQ); SequenceOfItems eventReferenceSopSequenceOfItems = new SequenceOfItems(); eventReferenceSopSequence.DicomValue = eventReferenceSopSequenceOfItems; DvtkData.Dimse.Attribute eventFailedSopSequence = new DvtkData.Dimse.Attribute(0x00081198, DvtkData.Dimse.VR.SQ); SequenceOfItems eventFailedSopSequenceOfItems = new SequenceOfItems(); eventFailedSopSequence.DicomValue = eventFailedSopSequenceOfItems; if (actionDataset != null) { DvtkData.Dimse.Attribute transactionUid = actionDataset.GetAttribute(DvtkData.Dimse.Tag.TRANSACTION_UID); if (transactionUid != null) { eventDataset.Add(transactionUid); } DvtkData.Dimse.Attribute referencedSopSequence = actionDataset.GetAttribute(DvtkData.Dimse.Tag.REFERENCED_SOP_SEQUENCE); if (referencedSopSequence != null) { SequenceOfItems sequenceOfItems = (SequenceOfItems)referencedSopSequence.DicomValue; foreach(DvtkData.Dimse.SequenceItem item in sequenceOfItems.Sequence) { System.String sopClassUid = ""; System.String sopInstanceUid = ""; DvtkData.Dimse.Attribute attribute = item.GetAttribute(DvtkData.Dimse.Tag.REFERENCED_SOP_CLASS_UID); if (attribute != null) { UniqueIdentifier uniqueIdentifier = (UniqueIdentifier)attribute.DicomValue; if (uniqueIdentifier.Values.Count > 0) { sopClassUid = uniqueIdentifier.Values[0]; } } attribute = item.GetAttribute(DvtkData.Dimse.Tag.REFERENCED_SOP_INSTANCE_UID); if (attribute != null) { UniqueIdentifier uniqueIdentifier = (UniqueIdentifier)attribute.DicomValue; if (uniqueIdentifier.Values.Count > 0) { sopInstanceUid = uniqueIdentifier.Values[0]; } } if (informationModels.PatientRoot.IsInstanceInInformationModel(sopClassUid, sopInstanceUid)) { DvtkData.Dimse.SequenceItem itemOk = new DvtkData.Dimse.SequenceItem(); itemOk.AddAttribute(0x00081150, DvtkData.Dimse.VR.UI, sopClassUid); itemOk.AddAttribute(0x00081155, DvtkData.Dimse.VR.UI, sopInstanceUid); // add instance to committed list eventReferenceSopSequenceOfItems.Sequence.Add(itemOk); } else { DvtkData.Dimse.SequenceItem itemNotOk = new DvtkData.Dimse.SequenceItem(); itemNotOk.AddAttribute(0x00081150, DvtkData.Dimse.VR.UI, sopClassUid); itemNotOk.AddAttribute(0x00081155, DvtkData.Dimse.VR.UI, sopInstanceUid); itemNotOk.AddAttribute(0x00081197, DvtkData.Dimse.VR.US, 0x0110); // add instance to failed list eventFailedSopSequenceOfItems.Sequence.Add(itemNotOk); } } } if (eventReferenceSopSequenceOfItems.Sequence.Count > 0) { eventMessage.Set("0x00001002", VR.US, 1); eventDataset.Add(eventReferenceSopSequence); } if (eventFailedSopSequenceOfItems.Sequence.Count > 0) { eventMessage.Set("0x00001002", VR.US, 2); eventDataset.Add(eventFailedSopSequence); } } eventMessage.DataSet.DvtkDataDataSet = eventDataset; return eventMessage; }
protected override void Execute() { selectedSopClassesList.Clear(); // // The Query/Retrieve message handler. // this.WriteInformation(string.Format("Creating the QR information model based on data directory : {0}", QREmulator.dataDirectory.ToString())); QueryRetrieveInformationModels queryRetrieveInformationModels = QREmulator.CreateQueryRetrieveInformationModels(true, false, isPatientRoot, isStudyRoot, isPatientStudyRoot, this.sourceQRDicomThread); Dvtk.DvtkDicomEmulators.QueryRetrieveMessageHandlers.CFindHandler cFindHandler = new Dvtk.DvtkDicomEmulators.QueryRetrieveMessageHandlers.CFindHandler(); Dvtk.DvtkDicomEmulators.QueryRetrieveMessageHandlers.CMoveHandler cMoveHandler = new Dvtk.DvtkDicomEmulators.QueryRetrieveMessageHandlers.CMoveHandler(); cMoveHandler.EnableMultipleMoveDestinations(DicomPeers); Dvtk.DvtkDicomEmulators.QueryRetrieveMessageHandlers.CGetHandler cGetHandler = new Dvtk.DvtkDicomEmulators.QueryRetrieveMessageHandlers.CGetHandler(); //Set supported PCs for QR responses selectedSopClassesList.Add("1.2.840.10008.1.1"); if (isPatientRoot) { // add any additional attribute values to the information models queryRetrieveInformationModels.PatientRoot.AddAdditionalAttributeToInformationModel(true, "0x00080054", VR.AE, sourceQRDicomThread.Options.RemoteAeTitle); cFindHandler.PatientRootInformationModel = queryRetrieveInformationModels.PatientRoot; cMoveHandler.PatientRootInformationModel = queryRetrieveInformationModels.PatientRoot; cGetHandler.PatientRootInformationModel = queryRetrieveInformationModels.PatientRoot; selectedSopClassesList.Add("1.2.840.10008.5.1.4.1.2.1.1"); selectedSopClassesList.Add("1.2.840.10008.5.1.4.1.2.1.2"); selectedSopClassesList.Add("1.2.840.10008.5.1.4.1.2.1.3"); } if (isStudyRoot) { // add any additional attribute values to the information models queryRetrieveInformationModels.StudyRoot.AddAdditionalAttributeToInformationModel(true, "0x00080054", VR.AE, sourceQRDicomThread.Options.RemoteAeTitle); cFindHandler.StudyRootInformationModel = queryRetrieveInformationModels.StudyRoot; cMoveHandler.StudyRootInformationModel = queryRetrieveInformationModels.StudyRoot; cGetHandler.StudyRootInformationModel = queryRetrieveInformationModels.StudyRoot; selectedSopClassesList.Add("1.2.840.10008.5.1.4.1.2.2.1"); selectedSopClassesList.Add("1.2.840.10008.5.1.4.1.2.2.2"); selectedSopClassesList.Add("1.2.840.10008.5.1.4.1.2.2.3"); } if (isPatientStudyRoot) { // add any additional attribute values to the information models queryRetrieveInformationModels.PatientStudyOnly.AddAdditionalAttributeToInformationModel(true, "0x00080054", VR.AE, sourceQRDicomThread.Options.RemoteAeTitle); cFindHandler.PatientStudyOnlyInformationModel = queryRetrieveInformationModels.PatientStudyOnly; cMoveHandler.PatientStudyOnlyInformationModel = queryRetrieveInformationModels.PatientStudyOnly; cGetHandler.PatientStudyOnlyInformationModel = queryRetrieveInformationModels.PatientStudyOnly; selectedSopClassesList.Add("1.2.840.10008.5.1.4.1.2.3.1"); selectedSopClassesList.Add("1.2.840.10008.5.1.4.1.2.3.2"); selectedSopClassesList.Add("1.2.840.10008.5.1.4.1.2.3.3"); } // // Create the actual SCP // QRScp qRScp = new QRScp("QR_SCP"); qRScp.Initialize(this); qRScp.Options.DeepCopyFrom(sourceQRDicomThread.Options); qRScp.Options.Identifier = "QR_SCP"; qRScp.setSupportedSopClasses(selectedSopClassesList); qRScp.setSupportedTS(selectedTSList); qRScp.Options.LogThreadStartingAndStoppingInParent = false; qRScp.Options.LogWaitingForCompletionChildThreads = false; // Add the message handlers. qRScp.AddToFront(cFindHandler); qRScp.AddToFront(cMoveHandler); qRScp.AddToFront(cGetHandler); qRScp.Start(); }
/// <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> /// Class constructor. /// </summary> /// <param name="informationModels">Information Model to use with this message handler.</param> /// <param name="eventDelay">Delay in milliseconds before N-EVENT-REPORT-RQ sent.</param> public NActionNEventReportHandler(QueryRetrieveInformationModels informationModels, int eventDelay) { _informationModels = informationModels; _eventDelay = eventDelay; }
/// <summary> /// Add the default message handlers - include the Information Models that should be used. /// </summary> /// <param name="informationModels">Query Retrieve Information Models.</param> public void AddDefaultMessageHandlers(QueryRetrieveInformationModels informationModels) { // add the CStoreHandler with the Information Models AddToBack(new CStoreHandler(informationModels)); }
/// <summary> /// Class constructor. /// </summary> /// <param name="parentActor">Parent Actor Name - containing actor.</param> /// <param name="actorName">Destination Actor Name.</param> public DicomStorageCommitServer(BaseActor parentActor, ActorName actorName) : base(parentActor, actorName) { // set up the Query/Retrieve information models _informationModels = new QueryRetrieveInformationModels(); }
/// <summary> /// Class constructor. /// </summary> /// <param name="informationModels">Information Model to use with this message handler.</param> /// <param name="eventDelay">Delay in milliseconds before N-EVENT-REPORT-RQ sent.</param> public NActionNEventReportHandler(QueryRetrieveInformationModels informationModels, int eventDelay) { _informationModels = informationModels; _eventDelay = eventDelay; }