/// <summary> /// Copy the default dataset attributes to the Information Entities in the Information /// Models that define them. Do not overrule any attribute with the same tag as the default /// attribute that may already be in the Information Entity. /// </summary> /// <param name="parameters">Default attribute - tag, vr, value(s).</param> public void AddDefaultAttributeToInformationModel(params Object[] parameters) { // need DicomMessage to be able to set the attribute in the dataset DicomMessage dicomMessage = new DicomMessage(DvtkData.Dimse.DimseCommand.UNDEFINED); dicomMessage.Set(parameters); _root.AddDefaultAttributesToInformationModel(dicomMessage.DataSet.DvtkDataDataSet); }
public void Trigger(DicomMessage dicomMessage, params PresentationContext[] presentationContexts) { DicomMessageCollection dicomMessageCollection = new DicomMessageCollection(); dicomMessageCollection.Add(dicomMessage); Trigger(dicomMessageCollection, presentationContexts); }
/// <summary> /// Overridden C-FIND-RQ message handler that makes use of the appropriate Information Model to handle the query. /// </summary> /// <param name="queryMessage">C-FIND-RQ Identifier (Dataset) containing query attributes.</param> /// <returns>Boolean - true if dicomMessage handled here.</returns> public override bool HandleCFindRequest(DicomMessage queryMessage) { if (_informationModels == null) return false; // Refresh the Information Models _informationModels.Refresh(); // Validate the received message System.String iodName = DicomThread.GetIodNameFromDefinition(queryMessage); DicomThread.Validate(queryMessage, iodName); // try to get the SOP Class Uid so that we know which Information Model to use. DvtkHighLevelInterface.Values values = queryMessage.CommandSet.GetAttributeValues("0x00000002"); System.String sopClassUid = values.GetString(1); DvtkData.Dul.AbstractSyntax abstractSyntax = new DvtkData.Dul.AbstractSyntax(sopClassUid); // check if we should use the Patient Root Information Model if ((abstractSyntax.UID == DvtkData.Dul.AbstractSyntax.Patient_Root_Query_Retrieve_Information_Model_FIND.UID) && (_informationModels.PatientRoot != null)) { DicomMessageCollection responseMessages = _informationModels.PatientRoot.QueryInformationModel(queryMessage); foreach (DicomMessage responseMessage in responseMessages) { this.Send(responseMessage); } } // check if we should use the Study Root Information Model else if ((abstractSyntax.UID == DvtkData.Dul.AbstractSyntax.Study_Root_Query_Retrieve_Information_Model_FIND.UID) && (_informationModels.StudyRoot != null)) { DicomMessageCollection responseMessages = _informationModels.StudyRoot.QueryInformationModel(queryMessage); foreach (DicomMessage responseMessage in responseMessages) { this.Send(responseMessage); } } // check if we should use the Patient Study Only Information Model else if ((abstractSyntax.UID == DvtkData.Dul.AbstractSyntax.Patient_Study_Only_Query_Retrieve_Information_Model_FIND.UID) && (_informationModels.PatientStudyOnly != null)) { DicomMessageCollection responseMessages = _informationModels.PatientStudyOnly.QueryInformationModel(queryMessage); foreach (DicomMessage responseMessage in responseMessages) { this.Send(responseMessage); } } else { // should never get here - but send a final CFINDRSP anyway DicomMessage responseMessage = new DicomMessage(DvtkData.Dimse.DimseCommand.CFINDRSP); this.Send(responseMessage); } // message handled return true; }
public DicomComparator InitializeDicomComparator(DicomMessage dicomMessage) { DicomComparator dicomComparator = new DicomComparator(_name); bool initialized = dicomComparator.Initialize(dicomMessage.DvtkDataDicomMessage); if (initialized == false) { dicomComparator = null; } return dicomComparator; }
/// <summary> /// Constructor with initialization. Shallow copy. /// </summary> /// <param name="arrayOfValues">values to copy.</param> public DicomMessageCollection(DicomMessage[] arrayOfValues) { if (arrayOfValues == null) { throw new ArgumentNullException(); } foreach (DicomMessage value in arrayOfValues) { this.Add(value); } }
public void Validate(DicomThread dicomThread, DicomMessage dicomMessage1, DicomMessage dicomMessage2) { this.thread.WriteInformationInternal("Validate Dicom message..."); Dvtk.Sessions.ValidationControlFlags validationFlags = Dvtk.Sessions.ValidationControlFlags.None; // Determine if the VR's need to be validated. validationFlags |= ValidateValueRepresentations(dicomMessage1); // Determine if the DicomMessage can or needs to be validated against a definition file. validationFlags |= ValidateUseDefinitions(dicomThread, dicomMessage1); this.thread.WriteInformationInternal("- Using reference Dicom message."); dicomThread.DvtkScriptSession.Validate(dicomMessage1.DvtkDataDicomMessage, dicomMessage2.DvtkDataDicomMessage, validationFlags | Dvtk.Sessions.ValidationControlFlags.UseReferences); }
public override bool HandleCGetRequest(DicomMessage dicomMessage) { // Validate the received message System.String iodName = DicomThread.GetIodNameFromDefinition(dicomMessage); DicomThread.Validate(dicomMessage, iodName); // Storage suboperations should be sent over the same association as the CGET. // The CGET SCU becomes a Storage SCP for the duration of the storage suboperations. // The CGET SCU should ensure that all the necessary storage SOP Classes are negotiated // during association establishment. DicomMessage responseMessage = new DicomMessage(DvtkData.Dimse.DimseCommand.CGETRSP); this.Send(responseMessage); return true; }
public override bool HandleNSetRequest(DicomMessage dicomMessage) { // Try to get the IOD Name System.String iodName = DicomThread.GetIodNameFromDefinition(dicomMessage); System.String messsage = String.Format("Processed N-SET-RQ {0}", iodName); DicomThread.WriteInformation(messsage); DicomMessage responseMessage = new DicomMessage(DvtkData.Dimse.DimseCommand.NSETRSP); responseMessage.Set("0x00000900", DvtkData.Dimse.VR.US, 0); this.Send(responseMessage); return true; }
public override bool HandleCMoveRequest(DicomMessage retrieveMessage) { if (_informationModels == null) return false; // Refresh the Information Models _informationModels.Refresh(); // Validate the received message System.String iodName = DicomThread.GetIodNameFromDefinition(retrieveMessage); DicomThread.Validate(retrieveMessage, iodName); // try to get the SOP Class Uid so that we know which Information Model to use. DvtkHighLevelInterface.Values values = retrieveMessage.CommandSet.GetAttributeValues("0x00000002"); System.String sopClassUid = values.GetString(1); DvtkData.Dul.AbstractSyntax abstractSyntax = new DvtkData.Dul.AbstractSyntax(sopClassUid); // try to get the Move Destination AE. values = retrieveMessage.CommandSet.GetAttributeValues("0x00000600"); System.String moveDestinationAE = values.GetString(1); DvtkData.Collections.StringCollection retrieveList = null; // check if we should use the Patient Root Information Model if ((abstractSyntax.UID == DvtkData.Dul.AbstractSyntax.Patient_Root_Query_Retrieve_Information_Model_MOVE.UID) && (_informationModels.PatientRoot != null)) { retrieveList = _informationModels.PatientRoot.RetrieveInformationModel(retrieveMessage); } // check if we should use the Study Root Information Model else if ((abstractSyntax.UID == DvtkData.Dul.AbstractSyntax.Study_Root_Query_Retrieve_Information_Model_MOVE.UID) && (_informationModels.StudyRoot != null)) { retrieveList = _informationModels.StudyRoot.RetrieveInformationModel(retrieveMessage); } // check if we should use the Patient Study Only Information Model else if ((abstractSyntax.UID == DvtkData.Dul.AbstractSyntax.Patient_Study_Only_Query_Retrieve_Information_Model_MOVE.UID) && (_informationModels.PatientStudyOnly != null)) { retrieveList = _informationModels.PatientStudyOnly.RetrieveInformationModel(retrieveMessage); } // process the retrieve list return ProcessRetrieveList(moveDestinationAE, retrieveList); }
/// <summary> /// Validate the Dicom Message by inspecting the VR's. /// </summary> /// <param name="dicomMessage">The Dicom Message.</param> public void Validate(DicomThread dicomThread, DicomMessage dicomMessage) { this.thread.WriteInformationInternal("Validate Dicom message..."); Dvtk.Sessions.ValidationControlFlags validationFlags = Dvtk.Sessions.ValidationControlFlags.None; // Determine if the VR's need to be validated. validationFlags |= ValidateValueRepresentations(dicomMessage); // Determine if the DicomMessage can or needs to be validated against a definition file. validationFlags |= ValidateUseDefinitions(dicomThread, dicomMessage); // If validation is needed, do it now. if (validationFlags != Dvtk.Sessions.ValidationControlFlags.None) { dicomThread.DvtkScriptSession.Validate(dicomMessage.DvtkDataDicomMessage, null, validationFlags); } else { dicomThread.WriteInformationInternal("No validation performed."); } }
/// <summary> /// Overridden C-STORE-RQ message handler that makes use of the appropriate Information Model to handle the storage. /// </summary> /// <param name="queryMessage">C-STORE-RQ and Dataset.</param> /// <returns>Boolean - true if dicomMessage handled here.</returns> public override bool HandleCStoreRequest(DicomMessage dicomMessage) { // Validate the received message System.String iodName = DicomThread.GetIodNameFromDefinition(dicomMessage); DicomThread.Validate(dicomMessage, iodName); // update the information models if (_informationModels != null) { // add this dataset to the information models _informationModels.Add(dicomMessage.DataSet); } // set up the default C-STORE-RSP with a successful status DicomMessage responseMessage = new DicomMessage(DvtkData.Dimse.DimseCommand.CSTORERSP); responseMessage.Set("0x00000900", DvtkData.Dimse.VR.US, 0); // send the response this.Send(responseMessage); // message handled return true; }
/// <summary> /// Override this method to handle a C-CANCEL-RQ message. /// </summary> /// <param name="dicomMessage">The received C-CANCEL-RQ message.</param> /// <returns>Return true when this methods has handled the received C-CANCEL-RQ message , otherwise false.</returns> public virtual bool HandleCCancelRequest(DicomMessage dicomMessage) { return false; }
/// <summary> /// Query the Information Model using the given query message. /// </summary> /// <param name="queryMessage">Message used to query the Information Model.</param> /// <returns>DicomMessageCollection - containing the query responses. The final query response (without a dataset) is also included.</returns> public DicomMessageCollection QueryInformationModel(DicomMessage queryMessage) { DicomMessageCollection responseMessages = new DicomMessageCollection(); DvtkHighLevelInterface.Values values = queryMessage.CommandSet.GetAttributeValues("0x00000002"); System.String sopClassUid = values.GetString(1); DataSet queryDataset = queryMessage.DataSet; DataSetCollection queryResponses = _root.QueryInformationModel(queryDataset.DvtkDataDataSet); DvtkData.Dimse.DicomMessage dvtkDicomMessage = null; DvtkData.Dimse.CommandSet dvtkCommand = null; DicomMessage responseMessage = null; foreach (DvtkData.Dimse.DataSet dvtkDataset in queryResponses) { dvtkDicomMessage = new DvtkData.Dimse.DicomMessage(); dvtkCommand = new DvtkData.Dimse.CommandSet(DvtkData.Dimse.DimseCommand.CFINDRSP); dvtkCommand.AddAttribute(0x0000, 0x0002, DvtkData.Dimse.VR.UI, sopClassUid); dvtkCommand.AddAttribute(0x0000, 0x0900, DvtkData.Dimse.VR.US, 0xFF00); dvtkDicomMessage.Apply(dvtkCommand, dvtkDataset); responseMessage = new DicomMessage(dvtkDicomMessage); responseMessages.Add(responseMessage); } dvtkDicomMessage = new DvtkData.Dimse.DicomMessage(); dvtkCommand = new DvtkData.Dimse.CommandSet(DvtkData.Dimse.DimseCommand.CFINDRSP); dvtkCommand.AddAttribute(0x0000, 0x0002, DvtkData.Dimse.VR.UI, sopClassUid); dvtkCommand.AddAttribute(0x0000, 0x0900, DvtkData.Dimse.VR.US, 0x0000); dvtkDicomMessage.Apply(dvtkCommand); responseMessage = new DicomMessage(dvtkDicomMessage); responseMessages.Add(responseMessage); return responseMessages; }
public void Validate(DicomMessage dicomMessage1, DicomMessage dicomMessage2) { this.validator.Validate(this, dicomMessage1, dicomMessage2); }
/// <summary> /// Retrieve data from the Information Model using the given retrieve message. /// </summary> /// <param name="retrieveMessage">Message used to retrieve the Information Model.</param> /// <returns>File list - containing the filenames of all instances matching the retrieve dataset attributes.</returns> public DvtkData.Collections.StringCollection RetrieveInformationModel(DicomMessage retrieveMessage) { StudyRootInformationModel root = (StudyRootInformationModel)Root; return root.RetrieveInformationModel(retrieveMessage.DataSet.DvtkDataDataSet); }
public abstract void Apply(DicomMessage dicomMessage);
public override bool HandleNDeleteRequest(DicomMessage dicomMessage) { DicomMessage responseMessage = new DicomMessage(DvtkData.Dimse.DimseCommand.NDELETERSP); this.Send(responseMessage); return true; }
/// <summary> /// Determines the index of a specific item in the <see cref="System.Collections.IList"/>. /// </summary> /// <param name="value">The item to locate in the <see cref="System.Collections.IList"/>.</param> /// <returns>The index of <c>value</c> if found in the list; otherwise, -1.</returns> public int IndexOf(DicomMessage value) { return base.IndexOf(value); }
/// <summary> /// Override this method to handle a N-SET-RSP message. /// </summary> /// <param name="dicomMessage">The received N-SET-RSP message.</param> /// <returns>Return true when this methods has handled the received N-SET-RSP message , otherwise false.</returns> public virtual bool HandleNSetResponse(DicomMessage dicomMessage) { return false; }
/// <summary> /// This method is indirectly called by a MessageIterator to let this object try /// to handle the received DicomMessage. /// </summary> /// <param name="dicomMessage">The received DicomMessage.</param> /// <returns>Returns true if this object has handled the DicomMessage, otherwise false.</returns> private bool HandleDicomMessage(DicomMessage dicomMessage) { bool handled = false; switch(dicomMessage.CommandSet.DimseCommand) { case DvtkData.Dimse.DimseCommand.CCANCELRQ: handled = HandleCCancelRequest(dicomMessage); break; case DvtkData.Dimse.DimseCommand.CECHORQ: handled = HandleCEchoRequest(dicomMessage); break; case DvtkData.Dimse.DimseCommand.CECHORSP: handled = HandleCEchoResponse(dicomMessage); break; case DvtkData.Dimse.DimseCommand.CFINDRQ: handled = HandleCFindRequest(dicomMessage); break; case DvtkData.Dimse.DimseCommand.CFINDRSP: handled = HandleCFindResponse(dicomMessage); break; case DvtkData.Dimse.DimseCommand.CGETRQ: handled = HandleCGetRequest(dicomMessage); break; case DvtkData.Dimse.DimseCommand.CGETRSP: handled = HandleCGetResponse(dicomMessage); break; case DvtkData.Dimse.DimseCommand.CMOVERQ: handled = HandleCMoveRequest(dicomMessage); break; case DvtkData.Dimse.DimseCommand.CMOVERSP: handled = HandleCMoveResponse(dicomMessage); break; case DvtkData.Dimse.DimseCommand.CSTORERQ: handled = HandleCStoreRequest(dicomMessage); break; case DvtkData.Dimse.DimseCommand.CSTORERSP: handled = HandleCStoreResponse(dicomMessage); break; case DvtkData.Dimse.DimseCommand.NACTIONRQ: handled = HandleNActionRequest(dicomMessage); break; case DvtkData.Dimse.DimseCommand.NACTIONRSP: handled = HandleNActionResponse(dicomMessage); break; case DvtkData.Dimse.DimseCommand.NCREATERQ: handled = HandleNCreateRequest(dicomMessage); break; case DvtkData.Dimse.DimseCommand.NCREATERSP: handled = HandleNCreateResponse(dicomMessage); break; case DvtkData.Dimse.DimseCommand.NDELETERQ: handled = HandleNDeleteRequest(dicomMessage); break; case DvtkData.Dimse.DimseCommand.NDELETERSP: handled = HandleNDeleteResponse(dicomMessage); break; case DvtkData.Dimse.DimseCommand.NEVENTREPORTRQ: handled = HandleNEventReportRequest(dicomMessage); break; case DvtkData.Dimse.DimseCommand.NEVENTREPORTRSP: handled = HandleNEventReportResponse(dicomMessage); break; case DvtkData.Dimse.DimseCommand.NGETRQ: handled = HandleNGetRequest(dicomMessage); break; case DvtkData.Dimse.DimseCommand.NGETRSP: handled = HandleNGetResponse(dicomMessage); break; case DvtkData.Dimse.DimseCommand.NSETRQ: handled = HandleNSetRequest(dicomMessage); break; case DvtkData.Dimse.DimseCommand.NSETRSP: handled = HandleNSetResponse(dicomMessage); break; default: Debug.Assert(true, "Not yet implemented."); break; } return(handled); }
// // - Methods - // /// <summary> /// Adds an item to the <see cref="System.Collections.IList"/>. /// </summary> /// <param name="value">The item to add to the <see cref="System.Collections.IList"/>. </param> /// <returns>The position into which the new element was inserted.</returns> public int Add(DicomMessage value) { return base.Add(value); }
/// <summary> /// Removes the first occurrence of a specific item from the IList. /// </summary> /// <param name="value">The item to remove from the <see cref="System.Collections.IList"/>.</param> public void Remove(DicomMessage value) { base.Remove(value); }
/// <summary> /// Inserts an item to the IList at the specified position. /// </summary> /// <param name="index">The zero-based index at which <c>value</c> should be inserted. </param> /// <param name="value">The item to insert into the <see cref="System.Collections.IList"/>.</param> public void Insert(int index, DicomMessage value) { base.Insert(index, value); }
/// <summary> /// Override this method to handle a N-EVENT-REPORT-RQ message. /// </summary> /// <param name="dicomMessage">The received N-EVENT-REPORT-RQ message.</param> /// <returns>Return true when this methods has handled the received N-EVENT-REPORT-RQ message , otherwise false.</returns> public virtual bool HandleNEventReportRequest(DicomMessage dicomMessage) { return false; }
public override void Apply(DicomMessage dicomMessage) { dicomMessage.Set(this.parameters.ToArray()); }
/// <summary> /// Override this method to handle a N-SET-RQ message. /// </summary> /// <param name="dicomMessage">The received N-SET-RQ message.</param> /// <returns>Return true when this methods has handled the received N-SET-RQ message , otherwise false.</returns> public virtual bool HandleNSetRequest(DicomMessage dicomMessage) { return false; }
/// <summary> /// Determines whether the <see cref="System.Collections.IList"/> contains a specific item. /// </summary> /// <param name="value">The item to locate in the <see cref="System.Collections.IList"/>.</param> /// <returns><see langword="true"/> if the item is found in the <see cref="System.Collections.IList"/>; otherwise, <see langword="false"/>.</returns> public bool Contains(DicomMessage value) { return base.Contains(value); }
/// <summary> /// Send a DicomMessage. /// </summary> /// <param name="dicomMessage">The DicomMessage.</param> public void Send(DicomMessage dicomMessage) { this.DicomThread.Send(dicomMessage); }
private bool HandleSubOperation(System.String moveDestinationAE, System.String dcmFilename, int subOperationIndex) { SCU storageScu = new SCU(true); storageScu.Initialize(DicomThread.ThreadManager); storageScu.Options.Identifier = "StorageSubOperationAsScu"; if (DicomThread.Options.StartAndEndResultsGathering == true) { storageScu.Options.StartAndEndResultsGathering = true; storageScu.Options.ResultsFilePerAssociation = false; System.String filenameFormat = DicomThread.Options.ResultsFileName.Replace("_res", "_StorageSubOperationAsScu{0}_res"); System.String resultsFilename = String.Format(filenameFormat, subOperationIndex); storageScu.Options.ResultsFileName = resultsFilename; storageScu.Options.ResultsDirectory = DicomThread.Options.ResultsDirectory; System.String message = String.Format("StorageSubOperation filename: {0}", storageScu.Options.ResultsDirectory + "Detail_" + storageScu.Options.ResultsFileName); DicomThread.WriteInformation(message); } else { storageScu.Options.StartAndEndResultsGathering = false; } storageScu.Options.DvtAeTitle = DicomThread.Options.DvtAeTitle; storageScu.Options.DvtPort = DicomThread.Options.DvtPort; storageScu.Options.SutAeTitle = moveDestinationAE; storageScu.Options.SutPort = DicomThread.Options.SutPort; storageScu.Options.SutIpAddress = DicomThread.Options.SutIpAddress; storageScu.Options.DataDirectory = DicomThread.Options.DataDirectory; storageScu.Options.StorageMode = Dvtk.Sessions.StorageMode.AsDataSet; // foreach (System.String filename in config.DefinitionFiles) // { // storageScu.Options.LoadDefinitionFile(filename); // } System.String sopClassUid = "1.2.840.10008.5.1.4.1.1.7"; PresentationContext presentationContext = new PresentationContext(sopClassUid, // Abstract Syntax Name "1.2.840.10008.1.2"); // Transfer Syntax Name(s) PresentationContext[] presentationContexts = new PresentationContext[1]; presentationContexts[0] = presentationContext; DicomMessage storageMessage = new DicomMessage(DvtkData.Dimse.DimseCommand.CSTORERQ); storageMessage.DataSet.Read(dcmFilename, storageScu); storageScu.NonThreadedStart(); bool sendResult = false; try { sendResult = storageScu.SendAssociation(storageMessage, presentationContexts); } catch (System.Exception) { DicomThread.WriteError("Storage Sub-Operation As SCU Failed"); } finally { storageScu.NonThreadedStop(); } return sendResult; }
private void SendCMoveRsp(UInt16 status, UInt16 remainingSubOperations, UInt16 completeSubOperations, UInt16 failedSubOperations, UInt16 warningSubOperations) { DicomMessage responseMessage = new DicomMessage(DvtkData.Dimse.DimseCommand.CMOVERSP); responseMessage.Set("0x00000900", DvtkData.Dimse.VR.US, status); responseMessage.Set("0x00001020", DvtkData.Dimse.VR.US, remainingSubOperations); responseMessage.Set("0x00001021", DvtkData.Dimse.VR.US, completeSubOperations); responseMessage.Set("0x00001022", DvtkData.Dimse.VR.US, failedSubOperations); responseMessage.Set("0x00001023", DvtkData.Dimse.VR.US, warningSubOperations); this.Send(responseMessage); }
public static DvtkHighLevelInterface.Messages.DicomMessage MakeStorageCommitEvent(QueryRetrieveInformationModels informationModels, DvtkHighLevelInterface.Messages.DicomMessage actionMessage) { // refresh the information models informationModels.Refresh(); DvtkHighLevelInterface.Messages.DicomMessage eventMessage = new DvtkHighLevelInterface.Messages.DicomMessage(DvtkData.Dimse.DimseCommand.NEVENTREPORTRQ); eventMessage.Set("0x00000002", DvtkData.Dimse.VR.UI, "1.2.840.10008.1.20.1"); eventMessage.Set("0x00001000", DvtkData.Dimse.VR.UI, "1.2.840.10008.1.20.1.1"); eventMessage.Set("0x00001002", DvtkData.Dimse.VR.US, 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; sopClassUid = uniqueIdentifier.Values[0]; } attribute = item.GetAttribute(DvtkData.Dimse.Tag.REFERENCED_SOP_INSTANCE_UID); if (attribute != null) { UniqueIdentifier uniqueIdentifier = (UniqueIdentifier)attribute.DicomValue; 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) { eventDataset.Add(eventReferenceSopSequence); } if (eventFailedSopSequenceOfItems.Sequence.Count > 0) { eventDataset.Add(eventFailedSopSequence); } } eventMessage.DataSet.DvtkDataDataSet = eventDataset; return(eventMessage); }