Relational Queries

Relational Queries have been in the DICOM standard since the start, but are supported by only about half the PACS in the world. They are negotiated using Extended_Negotiation and if requested by the SCU and accepted by the SCP then they remove several of the normal C-FIND rules, namely:

  • It is no longer necessary to quote the unique identifiers for every level above the current query level
  • It is possible to use matching attributes at different levels of the hierarchy

e.g. with standard queries, it would not be possible to include series and study queries in the same request, but with hierarchical queries that is allowed.

In DicomObjects, to use these as an SCU:

In DicomObjects, to use these as an SCP:

  • Set DicomGlobal.EnableExtendedNegotiation to true
  • If the AssociationRequest event, check the value of the ExtendedNegotiationValues property of the requested contexts, and leave at 1 if you accept, or set to 0 if you do not.

SCU use in DicomObjects

The following code is a simple example, which does a series level relational query against the Medical_Connections_Public_DICOM_Server. Note that the Patient ID and Study UID which would otherwise be required for a series level query are not specified.

   Dim g As New DicomGlobal
   g.EnableExtendedNegotiation = True
   Dim cn As New DicomConnection
   Dim cxt As DicomContext
   Set cxt = cn.Contexts.Add(DicomObjects.Constants.doSOP_StudyRootQR_FIND)
   cxt.ExtendedNegotiationValues = 1
   cn.SetDestination "", 104, "CallingAE", "CalledAE"
   Dim ds As New DicomDataSet
   ds.Attributes.Add &H8, &H52, "SERIES"                ' all attributes must still be at or above the level used
   ds.Attributes.Add &H8, &H20, ""                      ' Give me the study date.
   ds.Attributes.Add &H8, &H1030, ""                    ' give me the Study name / description.
   ds.Attributes.Add &H8, &H103E, "OBL*"                ' series description must begin with....
   ds.Attributes.Add &H10, &H10, ""                     ' Give me the patient name.
   ds.Attributes.Add &H10, &H20, "*"                    ' Give me the patient id.
   ds.Attributes.Add &H20, &H10, ""                     ' for this study ID.
   ds.Attributes.Add &H20, &HD, ""                      ' give me the study instance UID.
   ds.Attributes.Add &H20, &HE, ""                      ' give me the series instance UID.
   ds.Attributes.Add &H20, &H11, ""                     ' give me the series number.
   cn.Find "STUDY", ds
   Set res = cn.ReturnedDataSets