/// <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));
        }
Пример #2
0
        public override bool HandleCMoveRequest(DicomMessage retrieveMessage)
        {
            // try to get the SOP Class Uid so that we know which Information Model to use.
            DvtkHighLevelInterface.Dicom.Other.Values values = retrieveMessage.CommandSet["0x00000002"].Values;
            System.String sopClassUid = values[0];
            DvtkData.Dul.AbstractSyntax abstractSyntax = new DvtkData.Dul.AbstractSyntax(sopClassUid);

            // try to get the Move Destination AE.
            values = retrieveMessage.CommandSet["0x00000600"].Values;
            string vr = retrieveMessage.CommandSet["0x00000600"].VR.ToString();

            System.String moveDestinationAE = values[0];
            string        hexString         = moveDestinationAE;

            System.Text.StringBuilder sb = new System.Text.StringBuilder();
            if (DicomThread.Options.LoadedDefinitionFileNames.Length < 10)
            {
                WriteWarning("Some of the definition files is not loaded properly.");
            }
            if (vr == "UN")
            {
                for (int i = 0; i <= hexString.Length - 2; i += 2)
                {
                    sb.Append(Convert.ToString(Convert.ToChar(Int32.Parse(hexString.Substring(i, 2), System.Globalization.NumberStyles.HexNumber))));
                }
            }
            else if (vr == "AE")
            {
                sb.Append(moveDestinationAE);
            }
            if (moveDestinationAE == null || moveDestinationAE == "")
            {
                DicomMessage responseMessage = new DicomMessage(DvtkData.Dimse.DimseCommand.CMOVERSP);
                responseMessage.Set("0x00000900", VR.US, 0xA801);
                responseMessage.Set("0x00000902", VR.LO, "Unknown Move Destination");
                this.Send(responseMessage);
                return(true);
            }
            MoveAEdetailsIndex = FindMoveAEDetails(sb.ToString());
            if (IsHaveMoveDestinations && MoveAEdetailsIndex == -1)
            {
                DicomMessage responseMessage = new DicomMessage(DvtkData.Dimse.DimseCommand.CMOVERSP);
                responseMessage.Set("0x00000900", VR.US, 0xA801);
                responseMessage.Set("0x00000902", VR.LO, "Move Destination not registered in SCP");
                this.Send(responseMessage);
                WriteWarning("Move destination is not registered in SCP");
                return(true);
            }
            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) &&
                (PatientRootInformationModel != null))
            {
                // check if the information model should be refreshed before retrieving
                if (RefreshInformationModelBeforeUse == true)
                {
                    PatientRootInformationModel.RefreshInformationModel();
                }

                // perform retrieve
                retrieveList = PatientRootInformationModel.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) &&
                     (StudyRootInformationModel != null))
            {
                // check if the information model should be refreshed before retrieving
                if (RefreshInformationModelBeforeUse == true)
                {
                    StudyRootInformationModel.RefreshInformationModel();
                }

                // perform retrieve
                retrieveList = StudyRootInformationModel.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) &&
                     (PatientStudyOnlyInformationModel != null))
            {
                // check if the information model should be refreshed before retrieving
                if (RefreshInformationModelBeforeUse == true)
                {
                    PatientStudyOnlyInformationModel.RefreshInformationModel();
                }

                // perform retrieve
                retrieveList = PatientStudyOnlyInformationModel.RetrieveInformationModel(retrieveMessage);
            }

            // process the retrieve list
            return(ProcessRetrieveList(moveDestinationAE, retrieveList));
        }