Esempio n. 1
0
        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);
        }
Esempio n. 2
0
        /// <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);
        }
Esempio n. 3
0
 /// <summary>
 /// Class constructor with the Information Models provided.
 /// </summary>
 /// <param name="informationModels">Query Retrieve Information Models.</param>
 public CFindHandler(QueryRetrieveInformationModels informationModels)
 {
     _informationModels = informationModels;
 }
Esempio n. 4
0
 /// <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));
 }
Esempio n. 5
0
        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);
        }
Esempio n. 6
0
 public DicomStorageCommitServer(BaseActor parentActor, ActorNameEnum actorName)
     : base(parentActor, actorName)
 {
     // set up the Query/Retrieve information models
     _informationModels = new QueryRetrieveInformationModels();
 }