Esempio n. 1
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;
        }
Esempio n. 2
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;
        }
Esempio n. 3
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);
        }
Esempio n. 4
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);
        }
Esempio n. 5
0
        /// <summary>
        /// Create C-Move retrieve.
        /// </summary>
        /// <param name="informationModel">The information model.</param>
        /// <param name="moveDestination">The move destination.</param>
        /// <param name="retrieveTags">The retrieve tags.</param>
        /// <returns>teh C-MOVE message.</returns>
        public static DvtkHighLevelInterface.Dicom.Messages.DicomMessage MakeCMoveRetrieve(QueryRetrieveInformationModelEnum informationModel, System.String moveDestination, TagValueCollection retrieveTags)
        {
            DvtkHighLevelInterface.Dicom.Messages.DicomMessage retrieveMessage = new DvtkHighLevelInterface.Dicom.Messages.DicomMessage(DvtkData.Dimse.DimseCommand.CMOVERQ);
            DvtkData.Dimse.DataSet retrieveDataset = null;

            switch(informationModel)
            {
                case QueryRetrieveInformationModelEnum.PatientRootQueryRetrieveInformationModel:
                default:
                    retrieveMessage.Set("0x00000002", VR.UI, "1.2.840.10008.5.1.4.1.2.1.2");
                    retrieveDataset = new DvtkData.Dimse.DataSet("Patient Root Query/Retrieve Information Model - MOVE SOP Class");
                    break;
                case QueryRetrieveInformationModelEnum.StudyRootQueryRetrieveInformationModel:
                    retrieveMessage.Set("0x00000002", VR.UI, "1.2.840.10008.5.1.4.1.2.2.2");
                    retrieveDataset = new DvtkData.Dimse.DataSet("Study Root Query/Retrieve Information Model - MOVE SOP Class");
                    break;
                case QueryRetrieveInformationModelEnum.PatientStudyOnlyQueryRetrieveInformationModel:
                    retrieveMessage.Set("0x00000002", VR.UI, "1.2.840.10008.5.1.4.1.2.3.2");
                    retrieveDataset = new DvtkData.Dimse.DataSet("Patient/Study Only Query/Retrieve Info. Model - MOVE SOP Class");
                    break;
            }

            retrieveMessage.Set("0x00000600", VR.AE, moveDestination);

            // add the query keys
            AddQueryRetrieveKeys(retrieveTags, retrieveDataset);
            retrieveMessage.DataSet.DvtkDataDataSet = retrieveDataset;

            return retrieveMessage;
        }
Esempio n. 6
0
        /// <summary>
        /// Make C-FIND query.
        /// </summary>
        /// <param name="informationModel">The information model.</param>
        /// <param name="queryTags">The query tags.</param>
        /// <returns>The create C-FIND message.</returns>
        public static DvtkHighLevelInterface.Dicom.Messages.DicomMessage MakeCFindQuery(QueryRetrieveInformationModelEnum informationModel, TagValueCollection queryTags)
        {
            DvtkHighLevelInterface.Dicom.Messages.DicomMessage queryMessage = new DvtkHighLevelInterface.Dicom.Messages.DicomMessage(DvtkData.Dimse.DimseCommand.CFINDRQ);
            DvtkData.Dimse.DataSet queryDataset = null;

            switch(informationModel)
            {
                case QueryRetrieveInformationModelEnum.PatientRootQueryRetrieveInformationModel:
                default:
                    queryMessage.Set("0x00000002", VR.UI, "1.2.840.10008.5.1.4.1.2.1.1");
                    queryDataset = new DvtkData.Dimse.DataSet("Patient Root Query/Retrieve Information Model - FIND SOP Class");
                    break;
                case QueryRetrieveInformationModelEnum.StudyRootQueryRetrieveInformationModel:
                    queryMessage.Set("0x00000002", VR.UI, "1.2.840.10008.5.1.4.1.2.2.1");
                    queryDataset = new DvtkData.Dimse.DataSet("Study Root Query/Retrieve Information Model - FIND SOP Class");
                    break;
                case QueryRetrieveInformationModelEnum.PatientStudyOnlyQueryRetrieveInformationModel:
                    queryMessage.Set("0x00000002", VR.UI, "1.2.840.10008.5.1.4.1.2.3.1");
                    queryDataset = new DvtkData.Dimse.DataSet("Patient/Study Only Query/Retrieve Info. Model - FIND SOP Class");
                    break;
            }

            // add the query keys
            AddQueryRetrieveKeys(queryTags, queryDataset);
            queryMessage.DataSet.DvtkDataDataSet = queryDataset;

            return queryMessage;
        }