NetReceiveCMoveRequest Example for VB.NET
'LEADDICOMNet1 is a predefined LEADDicomNet object
'LEADDICOM1 is a DICOM Dataset defined outside this method
'This example uses the predefined variable "TreeView1" of type
"TreeView" from ".NET Framework".
Private Sub LEADDICOMNet1_NetReceiveCMoveRequest(ByVal
hNet As Integer, ByVal nPresentationID As Short, ByVal nMessageID As Short,
ByVal pszClass As String, ByVal nPriority As Short, ByVal pszMoveAE As
String, ByVal hDS As Integer) Handles LEADDICOMNet1.NetReceiveCMoveRequest
Dim nRet
As Short
Dim NewNode
As System.Windows.Forms.TreeNode
Dim szReply
As String
Dim szName
As String
Dim hPDU
As Integer
Dim szAbstract
As String
Dim szTransfer
As String
Dim szInstance
As String
Dim szClassUID
As String
Dim nID
As Short
NewNode
= New System.Windows.Forms.TreeNode("Command Set - " & "C-MOVE-REQUEST")
TreeView1.Nodes.Add(NewNode)
NewNode.EnsureVisible()
hPDU = LEADDICOMNet1.GetAssociate(hNet)
NewNode.Nodes.Add("Presentation ID: " & CStr(nPresentationID))
NewNode.Nodes.Add("Message ID: " & CStr(nMessageID))
nRet = LEADDICOM1.FindUID(pszClass)
If (nRet = 0) Then
szName = LEADDICOM1.CurrentUID.Name
NewNode.Nodes.Add("Affected SOP Class: " & szName & " - " & pszClass)
Else
NewNode.Nodes.Add("Affected SOP Class: " & pszClass)
End If
NewNode.Nodes.Add("Priority: " & CStr(nPriority))
NewNode.Nodes.Add("Move AE Title: " & pszMoveAE)
'this
sample simply returns a fixed dicom data set.
LEADDICOM1.LoadDS("e:\images\dicom16.dic",
0)
LEADDICOM1.MoveFirstElement (False)
LEADDICOM1.FindFirstElement(LTDICLib.DicomDataSetTagConstants1.TAG_SOP_INSTANCE_UID, False)
LEADDICOM1.GetStringValue(0, 1)
szInstance = LEADDICOM1.StringValues(0)
LEADDICOM1.MoveFirstElement(False)
LEADDICOM1.FindFirstElement(LTDICLib.DicomDataSetTagConstants1.TAG_SOP_CLASS_UID, False)
LEADDICOM1.GetStringValue(0, 1)
szClassUID = LEADDICOM1.StringValues(0)
nID
= LEADDICOMNet1.FindPresentationAbstract(hPDU,
szClassUID)
If (nID
= 0) Then
nRet
= LEADDICOM1.FindUID(szClassUID)
If
(nRet = 0) Then
MessageBox.Show("Abstract
Syntax, " & LEADDICOM1.CurrentUID.Name & ", Not Supported
by Association!")
Else
MessageBox.Show("Abstract
Syntax, " & szClassUID & ", Not Supported by Association!")
End
If
'send
a response
LEADDICOMNet1.SendCMoveResponse(hNet,
nPresentationID, nMessageID, pszClass, LTDNCLib.DicomCommandStatusConstants.COMMAND_STATUS_NO_SUCH_CLASS,
0, 0, 1, 0, 0)
Exit
Sub
End If
'now,
send the C-STORE sub operation
LEADDICOMNet1.SendCStoreRequest(hNet,
nID, nMessageID + 1, szClassUID, szInstance, nPriority, pszMoveAE, nMessageID,
LEADDICOM1.hDicomDS)
'send
a response
LEADDICOMNet1.SendCMoveResponse(hNet,
nPresentationID, nMessageID, pszClass, LTDNCLib.DicomCommandStatusConstants.COMMAND_STATUS_SUCCESS,
0, 1, 0, 0, 0)
End Sub