Retrieving by Accession Number


We are sometimes asked how to retrieve as study based on the accession number. This is only possible by doing an initial query to find the StudyUID then using those in a retrieval.

The explanation is that the DICOM rules allow only the Instance UID, Series UID, Study UID and Patient ID to be used in C-MOVE and C-GET requests. If you wish to retrieve a study based on accession number (or anything else except those 4 identifiers). Then you must first do a C-FIND query to identify the study or studies with that accession number then use the Study UID returned to you by the query to pass on to the subsequent retrieve request.

Note, Accession number is a STUDY level attribute so the code below will only work for STUDY level queries.

.NET Version

The method needed is DicomQuery.Find. You can generate a query dataset using the QueryDataSet method and add more query parameters to it.

 DicomQuery q = new DicomQuery();
 q.Node = "DicomServer.co.uk";
 q.Port = 104;
 q.CallingAE = "scu";
 q.CalledAE = "DicomServer";

 q.Root = QueryRoot.Study;
 q.Level = QueryLevel.STUDY;
            
 DicomDataSet queryDS = q.QueryDataSet();
 queryDS.Add(Keyword.AccessionNumber, "12345");
 queryDS.StudyUID = ""; // please return Study UID

 DicomDataSetCollection results = q.Find(queryDS);

 foreach (DicomDataSet result in results)
 {
	string studyUID = result.StudyUID;
	// with Study UID obtained, you can either do further C-FIND queries to get Series/Instance UIDs
	// or you can go ahead and retrieve the entire Study via C-GET or C-MOVE
 }

COM Version

The method needed is DicomQuery.DoRawQuery, You can generate a default query dataset as a starting point, using the QueryDataSet method, and then add more query parameters to it:

 Dim q As New DicomQuery
 q.Node = "DicomServer.co.uk"
 q.Port = 104
 q.CallingAE = "scu"
 q.CalledAE = "DicomServer"

 q.Root = "STUDY"
 q.level = "STUDY"

 Dim queryDS As DicomDataSet
 Set queryDS = q.QueryDataSet
 queryDS.Attributes.Add &H8, &H50, "12345" 
 queryDS.studyUID = "" ' please return STUDY UID
 Dim results As DicomDataSets
 Set results = q.DoRawQuery(queryDS)
 Dim result As DicomDataSet
 For Each result In results
	Dim studyUID As String
	studyUID = result.studyUID
 Next 


We use cookies to give you the best possible experience on our website. By continuing to use this website, you agree with our use of cookies. for more information please click HERE