NetReceiveCGetRequest 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_NetReceiveCGetRequest(ByVal
hNet As Integer, ByVal nPresentationID As Short, ByVal nMessageID As Short,
ByVal pszClass As String, ByVal nPriority As Short, ByVal hDS As Integer)
Handles LEADDICOMNet1.NetReceiveCGetRequest
Dim nRet
As Short
Dim szFile
As String
Dim NewNode
As System.Windows.Forms.TreeNode
Dim szReply
As String
Dim szName
As String
Dim szAE
As String
Dim hPDU
As Integer
Dim szInstance
As String
NewNode
= New System.Windows.Forms.TreeNode("Command Set - " & "C-GET-REQUEST")
TreeView1.Nodes.Add(NewNode)
NewNode.EnsureVisible()
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))
'perform
the get 'here, the AE should check the data set, and perform
'matching
against the files stored on the AE to determine
'what data
set(s) should be sent back to the calling AE.
'In our
case, we just send back a predetermined file for
'this demo!
'load the sample file
'NOTE: this sample is looking for a particular filename TEST2.DIC
szFile = "e:\images\dicom16.dic"
nRet = LEADDICOM1.LoadDS(szFile, 0)
'now, send a store command for the get sub-operation
hPDU = LEADDICOMNet1.GetAssociate(hNet)
szAE = LEADDICOMNet1.GetCalling(hPDU)
nRet = LEADDICOM1.FindFirstElement(LTDICLib.DicomDataSetTagConstants1.TAG_SOP_INSTANCE_UID, False)
If (nRet = 0) Then
nRet = LEADDICOM1.GetStringValue(0, 1)
If (nRet = 0) Then
szInstance = LEADDICOM1.StringValues(0)
End If
End If
nRet = LEADDICOMNet1.SendCStoreRequest(hNet, nPresentationID, nMessageID + 1, pszClass, szInstance, nPriority, szAE, nMessageID, LEADDICOM1.hDicomDS)
'the above will cause a ReceiveCStoreResponse event on this machine
'we
will send a get response after we have received the CStoreResponse from
the calling AE
End Sub