DicomConnection.Move
Note: This page applies only to the COM version of DicomObjects - the threading model of the equivalent DicomAssociation object in the .NET version is very different
The Move method allows a C-MOVE operation to be carried out on an existing DicomConnection. This has several benefits compared to any of the DicomQuery-based alternatives:
- It allows finer control over the exact presentation contexts offered
- Multiple operations can occur on one association
- Perhaps most importantly, if the DicomConnection is asynchronous, then it provides the best solution to using C-MOVE in DicomObjects, avoiding the problems of deadlocking or lack of return status which affect some of the alternatives.
When used on an asynchronous DicomConnection this methods sends out a C-MOVE request and returns immediately. A common mistake made by people is declare DicomConnection as a synchronous object in which case the benefits are lost. Therefore it is important that the DicomConnection is created using the New method of a DicomViewer or DicomServer and not simply using ‘New DicomConnection’ - will always make a synchronous object.
Below is sample vb6 code to demonstrate how to implement DicomConnection.Move. This is an example of a study root, series level query, but all other combinations are possible by changing the items in bold, and adding/removing identifiers to/from the dataset.
Dim cn As DicomConnection
Set cn = DicomViewer1.New("DicomConnection")
Dim dataset As New DicomDataSet
' The images to be moved are defined by the dataset parameter,
' which must include the Query Level (0008,0052) and any main IDs (PatientID,
' StudyUID, SeriesUID and InstanceUID between the Root and Study Levels (inclusive).
dataset.Attributes.Add &H8, &H52, "SERIES"
dataset.StudyUID = ...
dataset.SeriesUID = ...
cn.Contexts.Add "1.2.840.10008.5.1.4.1.2.1.2" 'This is Patient Root C-MOVE SOP Class
cn.Contexts.Add "1.2.840.10008.5.1.4.1.2.2.2" 'This is Study Root C-MOVE SOP Class
cn.SetDestination "localhost", 104, "SCU", "SCP"
cn.Move "STUDY", DestinationAET, dataset
' Do not do any more operations on the cn object in this routine (or it will become synchronous!)
When Move has finished, the DicomViewer’s ActionComplete Event will fire:
Private Sub DicomViewer1_ActionComplete(ByVal Connection As DicomObjects.DicomConnection, ByVal Action As String,
ByVal Tag As Variant, ByVal Success As Boolean, ByVal ErrorMessage As String)
If Action = "Move" Then
Dim LastResponse As DicomDataSet
Set LastResponse = Connection.ReturnedResponses(Connection.ReturnedResponses.Count)
' Get the last response and the total number of Images sent
MsgBox Action & " Result is " & Success & " Images returned " & LastResponse.Attributes(&H0, &H1201).Value
Connection.Close ' Must be here, not in the original calling routine
End If
End Sub
For a more general discussion on implementing DicomConnection Q/R methods, and migrating from their DicomQuery based equivalents, please see : Converting from DicomQuery to DicomConnection for Q/R