Example #1
0
File: SCU.cs Project: ewcasas/DVTK
        public void Trigger(DicomMessage dicomMessage, params PresentationContext[] presentationContexts)
        {
            DicomMessageCollection dicomMessageCollection = new DicomMessageCollection();
            dicomMessageCollection.Add(dicomMessage);

            Trigger(dicomMessageCollection, presentationContexts);
        }
Example #2
0
        /// <summary>
        /// Return the DicomMessages from this collection that have the specified DimseCommand.
        /// </summary>
        /// <param name="dimseCommand">the DimseCommand.</param>
        /// <returns>The DicomMessages with the specified DimseCommand.</returns>
        private DicomMessageCollection DicomMessagesForDimseCommand(DvtkData.Dimse.DimseCommand dimseCommand)
        {
            DicomMessageCollection dicomMessages = new DicomMessageCollection();

            foreach (DicomMessage dicomMessage in this)
            {
                if (dicomMessage.CommandSet.DimseCommand == dimseCommand)
                {
                    dicomMessages.Add(dicomMessage);
                }
            }

            return(dicomMessages);
        }
Example #3
0
        /// <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;
        }
Example #4
0
        /// <summary>
        /// Return the DicomMessages from this collection that have the specified DimseCommand.
        /// </summary>
        /// <param name="dimseCommand">the DimseCommand.</param>
        /// <returns>The DicomMessages with the specified DimseCommand.</returns>
        private DicomMessageCollection DicomMessagesForDimseCommand(DvtkData.Dimse.DimseCommand dimseCommand)
        {
            DicomMessageCollection dicomMessages = new DicomMessageCollection();

            foreach(DicomMessage dicomMessage in this)
            {
                if (dicomMessage.CommandSet.DimseCommand == dimseCommand)
                {
                    dicomMessages.Add(dicomMessage);
                }
            }

            return(dicomMessages);
        }
Example #5
0
        // Return boolean geeft aan of associatie wel of niet geaccept is.
        // This method only expects one response.
        public bool SendAssociation(DicomMessageCollection dicomMessages, params PresentationContext[] presentationContexts)
        {
            bool isAssociationAccepted = true;

            // Send the associate request.
            SendAssociateRq(presentationContexts);

            // Receive the associate repsonse (may be an accept or reject).
            DulMessage associateRp = ReceiveAssociateRp();

            // If an associate accept was received, send the collection of DicomMessages, receive a response and
            // release the association.
            if (associateRp is AssociateAc)
            {

                foreach(DicomMessage dicomMessage in dicomMessages)
                {
                    Send(dicomMessage);
                }

                ReceiveDicomMessage();

                SendReleaseRq();

                ReceiveReleaseRp();
            }

            return(isAssociationAccepted);
        }
Example #6
0
        // Return boolean geeft aan of associatie wel of niet geaccept is.
        // This method only expects one response.
        public bool SendAssociation(DicomMessage dicomMessage, params PresentationContext[] presentationContexts)
        {
            DicomMessageCollection dicomMessages = new DicomMessageCollection();

            dicomMessages.Add(dicomMessage);

            return(SendAssociation(dicomMessages, presentationContexts));
        }
Example #7
0
File: SCU.cs Project: ewcasas/DVTK
 public DicomMessageCollectionPresentationContexts(DicomMessageCollection dicomMessageCollection, params PresentationContext[] presentationContexts)
 {
     this.dicomMessageCollection = dicomMessageCollection;
     this.presentationContexts = new ArrayList(presentationContexts);
 }
Example #8
0
File: SCU.cs Project: ewcasas/DVTK
        public void Trigger(DicomMessageCollection dicomMessageCollection, params PresentationContext[] presentationContexts)
        {
            DicomMessageCollectionPresentationContexts trigger = new DicomMessageCollectionPresentationContexts(dicomMessageCollection, presentationContexts);

            base.Trigger(trigger);
        }