Example #1
0
        /// <summary>
        /// Handle a Dicom Transaction from the given Actor Name.
        /// </summary>
        /// <param name="actorName">Source Actor Name.</param>
        /// <param name="dicomTransaction">Dicom Transaction.</param>
        protected override void HandleTransactionFrom(ActorName actorName, DicomTransaction dicomTransaction)
        {
            switch (actorName.Type)
            {
            case ActorTypeEnum.DssOrderFiller:
                // received Image Availability Query [RAD-11] or
                // received Performed Work Status Update [RAD-42]
                break;

            case ActorTypeEnum.PerformedProcedureStepManager:
                // received Modality Procedure Step In Progress [RAD-6] or
                // received Modality Procedure Step Completed [RAD-7] or
                // received Creator Procedure Step In Progress [RAD-20] or
                // received Creator Procedure Step Completed [RAD-21]
                break;

            case ActorTypeEnum.AcquisitionModality:
                // received Storage Commitment [RAD-10]
                break;

            case ActorTypeEnum.EvidenceCreator:
                // received Storage Commitment [RAD-10]
                break;

            case ActorTypeEnum.ReportManager:
                // received Image Availability Query [RAD-11]
                break;

            default:
                break;
            }
        }
Example #2
0
        /// <summary>
        /// Get the number of DICOM messages in the transaction that match the DICOM command name.
        /// </summary>
        /// <param name="dimseCommandName">DICOM command name.</param>
        /// <returns>int - number of times the given DICOM command name is found in the transaction.</returns>
        public int GetNumberOfDicomMessages(String dimseCommandName)
        {
            bool matchFound       = false;
            int  numberOfMessages = 0;

            if (_transaction is DicomTransaction)
            {
                DicomTransaction dicomTransaction = (DicomTransaction)_transaction;
                for (int i = 0; i < dicomTransaction.DicomMessages.Count; i++)
                {
                    DicomMessage dicomMessage = (DicomMessage)dicomTransaction.DicomMessages[i];
                    if (dicomMessage.CommandSet != null)
                    {
                        if (dicomMessage.CommandSet.DimseCommandName == dimseCommandName)
                        {
                            matchFound = true;
                            numberOfMessages++;
                        }
                    }
                }
            }

            if (matchFound == false)
            {
                numberOfMessages = -1;
            }
            return(numberOfMessages);
        }
Example #3
0
 public override void HandleTransactionFrom(ActorNameEnum actorName, DicomTransaction dicomTransaction)
 {
     switch (actorName)
     {
         case ActorNameEnum.DssOrderFiller:
             // received Image Availability Query [RAD-11] or
             // received Performed Work Status Update [RAD-42]
             break;
         case ActorNameEnum.PerformedProcedureStepManager:
             // received Modality Procedure Step In Progress [RAD-6] or
             // received Modality Procedure Step Completed [RAD-7] or
             // received Creator Procedure Step In Progress [RAD-20] or
             // received Creator Procedure Step Completed [RAD-21]
             break;
         case ActorNameEnum.AcquisitionModality:
             // received Storage Commitment [RAD-10]
             break;
         case ActorNameEnum.EvidenceCreator:
             // received Storage Commitment [RAD-10]
             break;
         case ActorNameEnum.ReportManager:
             // received Image Availability Query [RAD-11]
             break;
         default:
             break;
     }
 }
Example #4
0
        public override void HandleTransactionFrom(ActorNameEnum actorName, DicomTransaction dicomTransaction)
        {
            switch (actorName)
            {
                case ActorNameEnum.AcquisitionModality:
                    // received Modality Procedure Step In Progress [RAD-6] or
                    // received Modality Procedur Step Completed [RAD-7]
                case ActorNameEnum.EvidenceCreator:
                {

                    // received Creator Procedure Step In Progress [RAD-20] or
                    // received Creator Procedure Step Completed [RAD-21]
                    TransactionNameEnum transactionName = dicomTransaction.TransactionName;
                    DicomMessage dicomMessage = (DicomMessage)dicomTransaction.DicomMessages[0];

                    // make a trigger from the transaction message
                    DicomTrigger dicomTrigger = new DicomTrigger(transactionName);
                    dicomTrigger.Trigger = dicomMessage;

                    // trigger the following actors
                    TriggerActor(ActorNameEnum.DssOrderFiller, dicomTrigger);
                    TriggerActor(ActorNameEnum.ImageManager, dicomTrigger);
                    break;
                }
                default:
                    break;
            }
        }
Example #5
0
 public override void HandleTransactionFrom(ActorNameEnum actorName, DicomTransaction dicomTransaction)
 {
     switch (actorName)
     {
         case ActorNameEnum.ImageManager:
             // received Storage Commitment [RAD-10]
             break;
         default:
             break;
     }
 }
Example #6
0
 public override void HandleTransactionFrom(ActorNameEnum actorName, DicomTransaction dicomTransaction)
 {
     switch (actorName)
     {
         case ActorNameEnum.ImageArchive:
             // received Retrieve Images [RAD-16]
             break;
         default:
             break;
     }
 }
Example #7
0
        /// <summary>
        /// Handle a Dicom Transaction from the given Actor Name.
        /// </summary>
        /// <param name="actorName">Source Actor Name.</param>
        /// <param name="dicomTransaction">Dicom Transaction.</param>
        protected override void HandleTransactionFrom(ActorName actorName, DicomTransaction dicomTransaction)
        {
            switch (actorName.Type)
            {
            case ActorTypeEnum.ImageArchive:
                // received Retrieve Images [RAD-16]
                break;

            default:
                break;
            }
        }
Example #8
0
        /// <summary>
        /// Handle a Dicom Transaction from the given Actor Name.
        /// </summary>
        /// <param name="actorName">Source Actor Name.</param>
        /// <param name="dicomTransaction">Dicom Transaction.</param>
        protected override void HandleTransactionFrom(ActorName actorName, DicomTransaction dicomTransaction)
        {
            switch (actorName.Type)
            {
            case ActorTypeEnum.ImageManager:
                // received Storage Commitment [RAD-10]
                break;

            default:
                break;
            }
        }
Example #9
0
        /// <summary>
        /// Handle a Dicom Transaction from the given Actor Name.
        /// </summary>
        /// <param name="actorName">Source Actor Name.</param>
        /// <param name="dicomTransaction">Dicom Transaction.</param>
        protected override void HandleTransactionFrom(ActorName actorName, DicomTransaction dicomTransaction)
        {
            switch (actorName.Type)
            {
            case ActorTypeEnum.PrintComposer:
                // received Print Request with Presentation LUT [RAD-23]
                break;

            default:
                break;
            }
        }
        private void InitializeModalityProcedureStepCompletedDiscontinued()
        {
            // Get the C-STORE-RSPs returned
            foreach (ActorsTransaction actorsTransaction in ActorsTransactionLog)
            {
                if (actorsTransaction.FromActorName.Type == ActorTypeEnum.ImageArchive)
                {
                    BaseTransaction baseTransaction = actorsTransaction.Transaction;
                    if (baseTransaction is DicomTransaction)
                    {
                        DicomTransaction dicomTransaction = (DicomTransaction)baseTransaction;

                        DicomMessageCollection cStoreResponses = dicomTransaction.DicomMessages.CStoreResponses;
                        GenerateTriggers.HandleCStoreResponses(_storageCommitItems, cStoreResponses);
                    }
                }
            }
        }
        private bool TriggerModalityWorklistQuery(DicomTrigger trigger)
        {
            // Start with empty worklist and storage commit items
            _modalityWorklistItems    = new DicomQueryItemCollection();
            _storageCommitItems       = new ReferencedSopItemCollection();
            _nCreateSetMppsInProgress = null;

            // RAD-5 - trigger the DssOrderFiller
            bool triggerResult = TriggerActorInstances(ActorTypeEnum.DssOrderFiller, trigger, true);

            // Get the worklist items returned
            if (triggerResult == true)
            {
                foreach (ActorsTransaction actorsTransaction in ActorsTransactionLog)
                {
                    if (actorsTransaction.FromActorName.Type == ActorTypeEnum.DssOrderFiller)
                    {
                        BaseTransaction baseTransaction = actorsTransaction.Transaction;
                        if (baseTransaction is DicomTransaction)
                        {
                            DicomTransaction dicomTransaction = (DicomTransaction)baseTransaction;
                            if (dicomTransaction.Processed == false)
                            {
                                DicomMessageCollection cFindResponses = dicomTransaction.DicomMessages.CFindResponses;
                                int index = 0;
                                foreach (DvtkHighLevelInterface.Dicom.Messages.DicomMessage dicomMessage in cFindResponses)
                                {
                                    if (dicomMessage.DataSet.Count != 0)
                                    {
                                        DicomQueryItem dicomWorklistItem = new DicomQueryItem(index++, dicomMessage);
                                        _modalityWorklistItems.Add(dicomWorklistItem);
                                    }
                                }
                                dicomTransaction.Processed = true;
                            }
                        }
                    }
                }
            }

            return(triggerResult);
        }
Example #12
0
 public override void HandleTransactionFrom(ActorNameEnum actorName, DicomTransaction dicomTransaction)
 {
     switch (actorName)
     {
         case ActorNameEnum.AcquisitionModality:
             // received Query Modality Worklist [RAD-5]
             break;
         case ActorNameEnum.PerformedProcedureStepManager:
             // received Modality Procedure Step In Progress [RAD-6] or
             // received Modality Procedure Step Completed [RAD-7] or
             // received Creator Procedure Step In Progress [RAD-20] or
             // received Creator Procedure Step Completed [RAD-21]
             break;
         case ActorNameEnum.ImageManager:
             // received Instance Availability Notification [RAD-49]
             break;
         default:
             break;
     }
 }
        /// <summary>
        /// Handle a Dicom Transaction from the given Actor Name.
        /// </summary>
        /// <param name="actorName">Source Actor Name.</param>
        /// <param name="dicomTransaction">Dicom Transaction.</param>
        protected override void HandleTransactionFrom(ActorName actorName, DicomTransaction dicomTransaction)
        {
            switch (actorName.Type)
            {
            case ActorTypeEnum.ImageManager:
                // received Storage Commitment [RAD-10]
                DicomMessageCollection nEventReportRequests = dicomTransaction.DicomMessages.NEventReportRequests;

                foreach (DvtkHighLevelInterface.Dicom.Messages.DicomMessage dicomMessage in nEventReportRequests)
                {
                    // Update the storage commit items with the appropriate status - as received in the
                    // event report request
                    GenerateTriggers.HandleNEventReportStorageCommitment(_storageCommitItems, dicomMessage);
                }
                break;

            default:
                break;
            }
        }
Example #14
0
        /// <summary>
        /// Handle a Dicom Transaction from the given Actor Name.
        /// </summary>
        /// <param name="actorName">Source Actor Name.</param>
        /// <param name="dicomTransaction">Dicom Transaction.</param>
        protected override void HandleTransactionFrom(ActorName actorName, DicomTransaction dicomTransaction)
        {
            switch (actorName.Type)
            {
            case ActorTypeEnum.AcquisitionModality:
                // received Modality Images Stored [RAD-8]
                break;

            case ActorTypeEnum.EvidenceCreator:
                // received Creator Images Stored [RAD-18]
                break;

            case ActorTypeEnum.ImageDisplay:
                // received Query Images [RAD-14] or
                // received Retrieve Images [RAD-16]
                break;

            default:
                break;
            }
        }
Example #15
0
        /// <summary>
        /// Get the first value of the given attribute in the DICOM message with the given DICOM command name.
        /// First search the command set and then the dataset (if present).
        /// </summary>
        /// <param name="dimseCommandName">DICOM command name.</param>
        /// <param name="tag">Tag identifying attribute whose first value will be returned.</param>
        /// <param name="attributeValue">Out - returned attribute value.</param>
        /// <returns>bool - indicates whether the dimseCommandName was found in the transaction or not - true / false.</returns>
        public bool GetFirstDicomAttributeValue(String dimseCommandName, DvtkData.Dimse.Tag tag, out String attributeValue)
        {
            attributeValue = String.Empty;
            bool dimseCommandFound = false;

            if (_transaction is DicomTransaction)
            {
                String group     = tag.GroupNumber.ToString("X").PadLeft(4, '0');
                String element   = tag.ElementNumber.ToString("X").PadLeft(4, '0');
                String tagString = String.Format("0x{0}{1}", group, element);

                DicomTransaction dicomTransaction = (DicomTransaction)_transaction;
                for (int i = 0; i < dicomTransaction.DicomMessages.Count; i++)
                {
                    DicomMessage dicomMessage = (DicomMessage)dicomTransaction.DicomMessages[i];
                    if (dicomMessage.CommandSet != null)
                    {
                        if (dicomMessage.CommandSet.DimseCommandName == dimseCommandName)
                        {
                            dimseCommandFound = true;

                            // check the command set
                            if (dicomMessage.CommandSet.Exists(tagString) == true)
                            {
                                attributeValue = dicomMessage.CommandSet.GetValues(tagString)[0];
                            }
                            else if ((dicomMessage.DataSet != null) &&
                                     (dicomMessage.DataSet.Exists(tagString) == true))
                            {
                                // check the dataset
                                attributeValue = dicomMessage.DataSet.GetValues(tagString)[0];
                            }
                            break;
                        }
                    }
                }
            }

            return(dimseCommandFound);
        }
Example #16
0
        /// <summary>
        /// Handle a Dicom Transaction from the given Actor Name.
        /// </summary>
        /// <param name="actorName">Source Actor Name.</param>
        /// <param name="dicomTransaction">Dicom Transaction.</param>
        protected override void HandleTransactionFrom(ActorName actorName, DicomTransaction dicomTransaction)
        {
            switch (actorName.Type)
            {
            case ActorTypeEnum.AcquisitionModality:
            // received Modality Procedure Step In Progress [RAD-6] or
            // received Modality Procedur Step Completed [RAD-7]
            case ActorTypeEnum.EvidenceCreator:
            {
                // received Creator Procedure Step In Progress [RAD-20] or
                // received Creator Procedure Step Completed [RAD-21]
                TransactionNameEnum transactionName = dicomTransaction.TransactionName;
                DicomMessage        dicomMessage    = (DicomMessage)dicomTransaction.DicomMessages[0];

                // ignore the C-ECHO-RQ used in the Verification SOP Class
                // - no need to forward this
                if (dicomMessage.CommandSet.DimseCommand != DvtkData.Dimse.DimseCommand.CECHORQ)
                {
                    // make a trigger from the transaction message
                    DicomTrigger dicomTrigger = new DicomTrigger(transactionName);
                    dicomTrigger.AddItem(dicomMessage,
                                         "1.2.840.10008.3.1.2.3.3",
                                         "1.2.840.10008.1.2");

                    // trigger the following actors
                    bool triggerResult = TriggerActorInstances(ActorTypeEnum.DssOrderFiller, dicomTrigger, false);
                    if (triggerResult == true)
                    {
                        triggerResult = TriggerActorInstances(ActorTypeEnum.ImageManager, dicomTrigger, false);
                    }
                }
                break;
            }

            default:
                break;
            }
        }
Example #17
0
        /// <summary>
        /// Handle a Dicom Transaction from the given Actor Name.
        /// </summary>
        /// <param name="actorName">Source Actor Name.</param>
        /// <param name="dicomTransaction">Dicom Transaction.</param>
        protected override void HandleTransactionFrom(ActorName actorName, DicomTransaction dicomTransaction)
        {
            switch (actorName.Type)
            {
            case ActorTypeEnum.AcquisitionModality:
                // received Query Modality Worklist [RAD-5]
                break;

            case ActorTypeEnum.PerformedProcedureStepManager:
                // received Modality Procedure Step In Progress [RAD-6] or
                // received Modality Procedure Step Completed [RAD-7] or
                // received Creator Procedure Step In Progress [RAD-20] or
                // received Creator Procedure Step Completed [RAD-21]
                break;

            case ActorTypeEnum.ImageManager:
                // received Instance Availability Notification [RAD-49]
                break;

            default:
                break;
            }
        }
Example #18
0
        /// <summary>
        /// Send a C-MOVE-RQ Information Model Retrieve.
        /// Retrieve based on the informationModel provided and the query/retrieve level. Take
        /// the retrieve tags from the retrieveTags provided. The retrieve is done to the move
        /// destination.
        ///
        /// The C-MOVE-RSP messages returned are stored in a DicomQueryItemCollection named RetrieveItems.
        /// </summary>
        /// <param name="informationModel">Q/R Information Model to be used in the retrieve operation.</param>
        /// <param name="level">Query / retrieve level.</param>
        /// <param name="moveDestination">AE Title of the "move" destination.</param>
        /// <param name="retrieveTags">List of Retrieve Tags.</param>
        /// <returns>Boolean indicating success or failure.</returns>
        public bool SendRetrieveImages(QueryRetrieveInformationModelEnum informationModel, QueryRetrieveLevelEnum level, System.String moveDestination, TagValueCollection retrieveTags)
        {
            System.String queryRetrieveLevel = System.String.Empty;
            switch (level)
            {
            case QueryRetrieveLevelEnum.PatientQueryRetrieveLevel:
                queryRetrieveLevel = "PATIENT";
                break;

            case QueryRetrieveLevelEnum.StudyQueryRetrieveLevel:
                queryRetrieveLevel = "STUDY";
                break;

            case QueryRetrieveLevelEnum.SeriesQueryRetrieveLevel:
                queryRetrieveLevel = "SERIES";
                break;

            case QueryRetrieveLevelEnum.InstanceQueryRetrieveLevel:
                queryRetrieveLevel = "IMAGE";
                break;

            default:
                return(false);
            }
            if (retrieveTags.Find(Tag.QUERY_RETRIEVE_LEVEL) == null)
            {
                retrieveTags.Add(new DicomTagValue(Tag.QUERY_RETRIEVE_LEVEL, queryRetrieveLevel));
            }
            _retrieveItems = new DicomQueryItemCollection();

            DicomTrigger trigger = new DicomTrigger(TransactionNameEnum.RAD_16);

            System.String sopClassUid = System.String.Empty;
            switch (informationModel)
            {
            case QueryRetrieveInformationModelEnum.PatientRootQueryRetrieveInformationModel:
                sopClassUid = "1.2.840.10008.5.1.4.1.2.1.2";
                break;

            case QueryRetrieveInformationModelEnum.StudyRootQueryRetrieveInformationModel:
                sopClassUid = "1.2.840.10008.5.1.4.1.2.2.2";
                break;

            case QueryRetrieveInformationModelEnum.PatientStudyOnlyQueryRetrieveInformationModel:
                sopClassUid = "1.2.840.10008.5.1.4.1.2.3.2";
                break;

            default:
                return(false);
            }
            trigger.AddItem(GenerateTriggers.MakeCMoveRetrieve(informationModel, moveDestination, retrieveTags),
                            sopClassUid,
                            "1.2.840.10008.1.2");

            // RAD-16 - trigger the ImageArchive
            bool triggerResult = TriggerActorInstances(ActorTypeEnum.ImageArchive, trigger, true);

            // Get the retrieve items returned
            if (triggerResult == true)
            {
                foreach (ActorsTransaction actorsTransaction in ActorsTransactionLog)
                {
                    if (actorsTransaction.FromActorName.Type == ActorTypeEnum.ImageArchive)
                    {
                        BaseTransaction baseTransaction = actorsTransaction.Transaction;
                        if (baseTransaction is DicomTransaction)
                        {
                            DicomTransaction dicomTransaction = (DicomTransaction)baseTransaction;
                            if (dicomTransaction.Processed == false)
                            {
                                DicomMessageCollection cMoveResponses = dicomTransaction.DicomMessages.CMoveResponses;
                                int index = 0;
                                foreach (DvtkHighLevelInterface.Dicom.Messages.DicomMessage dicomMessage in cMoveResponses)
                                {
                                    // store all C-MOVE-RSP messages
                                    // - use DicomQueryItem.GetValue(Tag.NUMBER_OF_COMPLETED_SUBOPERATIONS) to get completed count
                                    // - use DicomQueryItem.GetValue(Tag.NUMBER_OF_FAILED_SUBOPERATIONS) to get failed count
                                    // - use DicomQueryItem.GetValue(Tag.NUMBER_OF_REMAINING_SUBOPERATIONS) to get remaining count
                                    // - use DicomQueryItem.GetValue(Tag.NUMBER_OF_WARNING_SUBOPERATIONS) to get warning count
                                    DicomQueryItem dicomRetriveItem = new DicomQueryItem(index++, dicomMessage);
                                    _retrieveItems.Add(dicomRetriveItem);
                                }
                                dicomTransaction.Processed = true;
                            }
                        }
                    }
                }
            }

            return(triggerResult);
        }
Example #19
0
        /// <summary>
        /// Set the Comparators needed to handle each message in the Transaction.
        /// </summary>
        /// <param name="comparatorCollection">Comparator collection to fill.</param>
        public void SetComparators(Dvtk.Comparator.BaseComparatorCollection comparatorCollection)
        {
            if (_transaction is DicomTransaction)
            {
                System.String name = System.String.Empty;

                DicomTransaction dicomTransaction = (DicomTransaction)_transaction;
                switch (dicomTransaction.Direction)
                {
                case TransactionDirectionEnum.TransactionReceived:
                    name = System.String.Format("Received by {0}:{1} from {2}:{3}",
                                                ActorTypes.Type(_toActorName.Type),
                                                _toActorName.Id,
                                                ActorTypes.Type(_fromActorName.Type),
                                                _fromActorName.Id);
                    break;

                case TransactionDirectionEnum.TransactionSent:
                    name = System.String.Format("Sent from {0}:{1} to {2}:{3}",
                                                ActorTypes.Type(_toActorName.Type),
                                                _toActorName.Id,
                                                ActorTypes.Type(_fromActorName.Type),
                                                _fromActorName.Id);
                    break;

                default:
                    break;
                }

                for (int i = 0; i < dicomTransaction.DicomMessages.Count; i++)
                {
                    DicomMessage dicomMessage = (DicomMessage)dicomTransaction.DicomMessages[i];

                    DvtkHighLevelInterface.Comparator.Comparator comparator = new DvtkHighLevelInterface.Comparator.Comparator(name);
                    Dvtk.Comparator.DicomComparator dicomComparator         = comparator.InitializeDicomComparator(dicomMessage);
                    if (dicomComparator != null)
                    {
                        comparatorCollection.Add(dicomComparator);
                    }
                }
            }
            else if (_transaction is Hl7Transaction)
            {
                System.String name = System.String.Empty;

                Hl7Transaction hl7Transaction = (Hl7Transaction)_transaction;
                switch (hl7Transaction.Direction)
                {
                case TransactionDirectionEnum.TransactionReceived:
                    name = System.String.Format("Received by {0}:{1} from {2}:{3}",
                                                ActorTypes.Type(_toActorName.Type),
                                                _toActorName.Id,
                                                ActorTypes.Type(_fromActorName.Type),
                                                _fromActorName.Id);
                    break;

                case TransactionDirectionEnum.TransactionSent:
                    name = System.String.Format("Sent from {0}:{1} to {2}:{3}",
                                                ActorTypes.Type(_toActorName.Type),
                                                _toActorName.Id,
                                                ActorTypes.Type(_fromActorName.Type),
                                                _fromActorName.Id);
                    break;

                default:
                    break;
                }

                Hl7Message hl7Message = hl7Transaction.Request;

                DvtkHighLevelInterface.Comparator.Comparator comparator = new DvtkHighLevelInterface.Comparator.Comparator(name);
                Dvtk.Comparator.Hl7Comparator hl7Comparator             = comparator.InitializeHl7Comparator(hl7Message);
                if (hl7Comparator != null)
                {
                    comparatorCollection.Add(hl7Comparator);
                }
            }
        }
Example #20
0
        /// <summary>
        /// Log the transaction to the given stream.
        /// </summary>
        /// <param name="sw">Stream Writer - log the transaction to this stream.</param>
        public void LogToStream(StreamWriter sw)
        {
            sw.WriteLine("<<- {0} -------------------------------------------------------------->>", _transactionNumber);
            if (_transaction is DicomTransaction)
            {
                DicomTransaction dicomTransaction = (DicomTransaction)_transaction;
                switch (dicomTransaction.Direction)
                {
                case TransactionDirectionEnum.TransactionSent:
                    sw.WriteLine("DICOM Transaction received by {0}:{1}", ActorTypes.Type(_fromActorName.Type), _fromActorName.Id);
                    sw.WriteLine("from {0}:{1}", ActorTypes.Type(_toActorName.Type), _toActorName.Id);
                    break;

                case TransactionDirectionEnum.TransactionReceived:
                    sw.WriteLine("DICOM Transaction sent from {0}:{1}", ActorTypes.Type(_fromActorName.Type), _fromActorName.Id);
                    sw.WriteLine("to {0}:{1}", ActorTypes.Type(_toActorName.Type), _toActorName.Id);
                    break;

                default:
                    break;
                }
                sw.WriteLine("{0} errors, {1} warnings", _nrErrors, _nrWarnings);
                for (int i = 0; i < dicomTransaction.DicomMessages.Count; i++)
                {
                    sw.WriteLine("DICOM Message {0}...", i + 1);
                    DicomMessage dicomMessage = (DicomMessage)dicomTransaction.DicomMessages[i];
                    if (dicomMessage.CommandSet != null)
                    {
                        sw.WriteLine("Command: {0} \"{1}\"", dicomMessage.CommandSet.DimseCommandName, dicomMessage.CommandSet.GetSopClassUid());
                    }
                    if (dicomMessage.DataSet != null)
                    {
                        sw.WriteLine("Dataset Attributes: {0}", dicomMessage.DataSet.Count);
                    }
                }
            }
            else
            {
                Hl7Transaction hl7Transaction = (Hl7Transaction)_transaction;
                switch (hl7Transaction.Direction)
                {
                case TransactionDirectionEnum.TransactionSent:
                    sw.WriteLine("HL7 Transaction received by {0}:{1}", ActorTypes.Type(_fromActorName.Type), _fromActorName.Id);
                    sw.WriteLine("from {0}:{1}", ActorTypes.Type(_toActorName.Type), _toActorName.Id);
                    break;

                case TransactionDirectionEnum.TransactionReceived:
                    sw.WriteLine("HL7 Transaction sent from {0}:{1}", ActorTypes.Type(_fromActorName.Type), _fromActorName.Id);
                    sw.WriteLine("to {0}:{1}", ActorTypes.Type(_toActorName.Type), _toActorName.Id);
                    break;

                default:
                    break;
                }
                sw.WriteLine("{0} errors, {1} warnings", _nrErrors, _nrWarnings);
            }
            sw.WriteLine("Results Filename: \"{0}\"", _resultsFilename);
            sw.WriteLine("Results Pathname: \"{0}\"", _resultsPathname);

            sw.WriteLine("<<------------------------------------------------------------------>>");
        }
Example #21
0
        /// <summary>
        /// Send a C-FIND-RQ Information Model Query.
        /// Query based on the informationModel provided and the query/retrieve level. Take
        /// the query tags from the queryTags provided.
        ///
        /// The C-FIND-RSP messages returned are stored in a DicomQueryItemCollection named QueryItems.
        /// </summary>
        /// <param name="informationModel">Q/R Information Model to be used in the query operation.</param>
        /// <param name="level">Query / retrieve level.</param>
        /// <param name="queryTags">List of Query Tags.</param>
        /// <returns>Boolean indicating success or failure.</returns>
        public bool SendQueryImages(QueryRetrieveInformationModelEnum informationModel, QueryRetrieveLevelEnum level, TagValueCollection queryTags)
        {
            System.String queryRetrieveLevel = System.String.Empty;
            switch (level)
            {
            case QueryRetrieveLevelEnum.PatientQueryRetrieveLevel:
                _patientLevelQueryItems = new DicomQueryItemCollection();
                queryRetrieveLevel      = "PATIENT";
                break;

            case QueryRetrieveLevelEnum.StudyQueryRetrieveLevel:
                _studyLevelQueryItems = new DicomQueryItemCollection();
                queryRetrieveLevel    = "STUDY";
                break;

            case QueryRetrieveLevelEnum.SeriesQueryRetrieveLevel:
                _seriesLevelQueryItems = new DicomQueryItemCollection();
                queryRetrieveLevel     = "SERIES";
                break;

            case QueryRetrieveLevelEnum.InstanceQueryRetrieveLevel:
                _instanceLevelQueryItems = new DicomQueryItemCollection();
                queryRetrieveLevel       = "IMAGE";
                break;

            default:
                return(false);
            }
            if (queryTags.Find(Tag.QUERY_RETRIEVE_LEVEL) == null)
            {
                queryTags.Add(new DicomTagValue(Tag.QUERY_RETRIEVE_LEVEL, queryRetrieveLevel));
            }

            DicomQueryItemCollection queryItems = QueryItems(level);

            DicomTrigger trigger = new DicomTrigger(TransactionNameEnum.RAD_14);

            System.String sopClassUid = System.String.Empty;
            switch (informationModel)
            {
            case QueryRetrieveInformationModelEnum.PatientRootQueryRetrieveInformationModel:
                sopClassUid = "1.2.840.10008.5.1.4.1.2.1.1";
                break;

            case QueryRetrieveInformationModelEnum.StudyRootQueryRetrieveInformationModel:
                sopClassUid = "1.2.840.10008.5.1.4.1.2.2.1";
                break;

            case QueryRetrieveInformationModelEnum.PatientStudyOnlyQueryRetrieveInformationModel:
                sopClassUid = "1.2.840.10008.5.1.4.1.2.3.1";
                break;

            default:
                return(false);
            }
            trigger.AddItem(GenerateTriggers.MakeCFindQuery(informationModel, queryTags),
                            sopClassUid,
                            "1.2.840.10008.1.2");

            // RAD-14 - trigger the ImageArchive
            bool triggerResult = TriggerActorInstances(ActorTypeEnum.ImageArchive, trigger, true);

            // Get the query items returned
            if (triggerResult == true)
            {
                foreach (ActorsTransaction actorsTransaction in ActorsTransactionLog)
                {
                    if (actorsTransaction.FromActorName.Type == ActorTypeEnum.ImageArchive)
                    {
                        BaseTransaction baseTransaction = actorsTransaction.Transaction;
                        if (baseTransaction is DicomTransaction)
                        {
                            DicomTransaction dicomTransaction = (DicomTransaction)baseTransaction;
                            if (dicomTransaction.Processed == false)
                            {
                                DicomMessageCollection cFindResponses = dicomTransaction.DicomMessages.CFindResponses;
                                int index = 0;
                                foreach (DvtkHighLevelInterface.Dicom.Messages.DicomMessage dicomMessage in cFindResponses)
                                {
                                    if (dicomMessage.DataSet.Count != 0)
                                    {
                                        DicomQueryItem dicomQueryItem = new DicomQueryItem(index++, dicomMessage);
                                        queryItems.Add(dicomQueryItem);
                                    }
                                }
                                dicomTransaction.Processed = true;
                            }
                        }
                    }
                }
            }

            return(triggerResult);
        }
Example #22
0
 /// <summary>
 /// Handle a Dicom Transaction from the given Actor Name.
 /// </summary>
 /// <param name="actorName">Source Actor Name.</param>
 /// <param name="dicomTransaction">Dicom Transaction.</param>
 protected virtual void HandleTransactionFrom(ActorName actorName, DicomTransaction dicomTransaction)
 {
 }