Example #1
0
        //
        // - Methods -
        //
        /// <summary>
        /// Check if the supplied values are equal to the content of this object.
        /// </summary>
        /// <param name="values">Values to compare with.</param>
        /// <returns>Boolean indicating if the Values are equal.</returns>
        public override bool EqualTo(Values values)
        {
            // Start Interface logging.
            // InterfaceLogging.Start(this, values);

            bool equalTo = true;

            if (values is InvalidValues)
            {
                InvalidValues attributeToCompareWith = values as InvalidValues;
                // InterfaceLogging.WriteError("Comparing the values of two non-existing attributes with tag sequence " + this.TagSequence + " and " + attributeToCompareWith.TagSequence + "\r\nReturning true.");
                equalTo = true;
            }
            else if (values is ValidValues)
            {
                ValidValues validValues = values as ValidValues;
                // InterfaceLogging.WriteError("Comparing the value of a non-existing sttribute with tag " + this.TagSequence + " with valid values from attribute with tag " + validValues.TagSequence + ".\r\nReturning false.");
                equalTo = false;
            }
            else
            {
                // InterfaceLogging.WriteError("This type of Values descendant object not expected. Returning false.");
                equalTo = false;
            }

            // End Interface logging.
            // InterfaceLogging.End(equalTo);

            return equalTo;
        }
Example #2
0
        public override bool HandleCMoveRequest(DicomMessage retrieveMessage)
        {
            if (_informationModels == null)
            {
                return(false);
            }

            // Refresh the Information Models
            _informationModels.Refresh();

            // Validate the received message
            System.String iodName = DicomThread.GetIodNameFromDefinition(retrieveMessage);
            DicomThread.Validate(retrieveMessage, iodName);

            // try to get the SOP Class Uid so that we know which Information Model to use.
            DvtkHighLevelInterface.Values values       = retrieveMessage.CommandSet.GetAttributeValues("0x00000002");
            System.String sopClassUid                  = values.GetString(1);
            DvtkData.Dul.AbstractSyntax abstractSyntax = new DvtkData.Dul.AbstractSyntax(sopClassUid);

            // try to get the Move Destination AE.
            values = retrieveMessage.CommandSet.GetAttributeValues("0x00000600");
            System.String moveDestinationAE = values.GetString(1);

            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) &&
                (_informationModels.PatientRoot != null))
            {
                retrieveList = _informationModels.PatientRoot.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) &&
                     (_informationModels.StudyRoot != null))
            {
                retrieveList = _informationModels.StudyRoot.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) &&
                     (_informationModels.PatientStudyOnly != null))
            {
                retrieveList = _informationModels.PatientStudyOnly.RetrieveInformationModel(retrieveMessage);
            }

            // process the retrieve list
            return(ProcessRetrieveList(moveDestinationAE, retrieveList));
        }
Example #3
0
		public override bool HandleNCreateRequest(DicomMessage dicomMessage)
		{
			// Try to get the IOD Name
			System.String iodName = DicomThread.GetIodNameFromDefinition(dicomMessage);

			// Try to get the Patient Name			
			DvtkHighLevelInterface.Values attributeValues = dicomMessage.GetAttributeValues("0x00100010");
			System.String patientName = attributeValues.GetString(1);
			System.String messsage = String.Format("Processed N-CREATE-RQ {0}: \"{1}\"", iodName, patientName);
			DicomThread.WriteInformation(messsage);

			DicomMessage responseMessage = new DicomMessage(DvtkData.Dimse.DimseCommand.NCREATERSP);

			responseMessage.Set("0x00000900", DvtkData.Dimse.VR.US, 0);

			this.Send(responseMessage);
			return true;
		}
Example #4
0
        /// <summary>
        /// Check if the supplied values are equal to the content of this object.
        /// </summary>
        /// <param name="values">Values to compare with.</param>
        /// <returns>Boolean indicating if the Values are equal.</returns>
        public override bool EqualTo(Values values)
        {
            // Start Interface logging.
            // InterfaceLogging.Start(this, values);

            bool equalTo = true;

            if (values is InvalidValues)
            {
                InvalidValues invalidValues = values as InvalidValues;
                // InterfaceLogging.WriteError("the values to compare with are from a non-existing attribute with tag sequence" + invalidValues.TagSequence + ".\r\nReturning false.");
                equalTo = false;
            }
            else if (values is ValidValues)
            {
                ValidValues validValues = values as ValidValues;

                if (Count == validValues.Count)
                {
                    for (int index = 1; index <= Count; index++)
                    {
                        if (GetString(index) != validValues.GetString(index))
                        {
                            equalTo = false;
                            break;
                        }
                    }
                }
                else
                {
                    equalTo = false;
                }
            }
            else
            {
                // InterfaceLogging.WriteError("This type of Values descendant object not expected.\r\n Returning false.");
                equalTo = false;
            }

            // End Interface logging.
            // InterfaceLogging.End(equalTo);

            return equalTo;
        }
Example #5
0
 /// <summary>
 /// Check if the supplied values are equal to the content of this object.
 /// </summary>
 /// <param name="values">Values to compare with.</param>
 /// <returns>Boolean indicating if the Values are equal.</returns>
 public abstract bool EqualTo(Values values);
Example #6
0
        /// <summary>
        /// Overridden C-FIND-RQ message handler that makes use of the appropriate Information Model to handle the query.
        /// </summary>
        /// <param name="queryMessage">C-FIND-RQ Identifier (Dataset) containing query attributes.</param>
        /// <returns>Boolean - true if dicomMessage handled here.</returns>
        public override bool HandleCFindRequest(DicomMessage queryMessage)
        {
            if (_informationModels == null)
            {
                return(false);
            }

            // Refresh the Information Models
            _informationModels.Refresh();

            // Validate the received message
            System.String iodName = DicomThread.GetIodNameFromDefinition(queryMessage);
            DicomThread.Validate(queryMessage, iodName);

            // try to get the SOP Class Uid so that we know which Information Model to use.
            DvtkHighLevelInterface.Values values       = queryMessage.CommandSet.GetAttributeValues("0x00000002");
            System.String sopClassUid                  = values.GetString(1);
            DvtkData.Dul.AbstractSyntax abstractSyntax = new DvtkData.Dul.AbstractSyntax(sopClassUid);

            // check if we should use the Patient Root Information Model
            if ((abstractSyntax.UID == DvtkData.Dul.AbstractSyntax.Patient_Root_Query_Retrieve_Information_Model_FIND.UID) &&
                (_informationModels.PatientRoot != null))
            {
                DicomMessageCollection responseMessages = _informationModels.PatientRoot.QueryInformationModel(queryMessage);

                foreach (DicomMessage responseMessage in responseMessages)
                {
                    this.Send(responseMessage);
                }
            }
            // check if we should use the Study Root Information Model
            else if ((abstractSyntax.UID == DvtkData.Dul.AbstractSyntax.Study_Root_Query_Retrieve_Information_Model_FIND.UID) &&
                     (_informationModels.StudyRoot != null))
            {
                DicomMessageCollection responseMessages = _informationModels.StudyRoot.QueryInformationModel(queryMessage);

                foreach (DicomMessage responseMessage in responseMessages)
                {
                    this.Send(responseMessage);
                }
            }
            // 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_FIND.UID) &&
                     (_informationModels.PatientStudyOnly != null))
            {
                DicomMessageCollection responseMessages = _informationModels.PatientStudyOnly.QueryInformationModel(queryMessage);

                foreach (DicomMessage responseMessage in responseMessages)
                {
                    this.Send(responseMessage);
                }
            }
            else
            {
                // should never get here - but send a final CFINDRSP anyway
                DicomMessage responseMessage = new DicomMessage(DvtkData.Dimse.DimseCommand.CFINDRSP);
                this.Send(responseMessage);
            }

            // message handled
            return(true);
        }
Example #7
0
 /// <summary>
 /// Check if the supplied values are equal to the content of this object.
 /// </summary>
 /// <param name="values">Values to compare with.</param>
 /// <returns>Boolean indicating if the Values are equal.</returns>
 public abstract bool EqualTo(Values values);