SendCFindRequest Example for Visual Basic
Returns 20000 on the following line:
LEADDICOM2.InsertElement False, TAG_ADDITIONAL_PATIENT_HISTORY, nVR, False, 0
Dim hPDU As Long
Dim nID As Long
Dim b As Boolean
Dim nRet As Integer
Dim nVR As Integer
Dim szUID As String
Dim x As Long
'this example sends a command that will find all STUDIES on a called AE that
'supports the Study Root Query/Retrieve Information Model - FIND SOP Class
'send a Find request to the server
hPDU = LEADDICOMNet1.GetAssociate (LEADDICOMNet1.hNet)
szUID = UID_STUDY_ROOT_QUERY_FIND
nID = LEADDICOMNet1.FindPresentationAbstract (hPDU, szUID)
If (nID = 0) Then
nRet = LEADDICOM1.FindUID(szUID)
If (nRet = 0) Then
MsgBox "Abstract Syntax, " & LEADDICOM1.CurrentUID.Name & ", Not Supported by Association!"
Else
MsgBox "Abstract Syntax, " & szUID & ", Not Supported by Association!"
End If
Exit Sub
End If
'create a find attribute data set
LEADDICOM2.InitDS DICOM_CLASS_UNKNOWN, 0
LEADDICOM2.ResetDS
'add the required fields for this seach
LEADDICOM2.FindTag TAG_QUERY_RETRIEVE_LEVEL
nVR = LEADDICOM2.CurrentTag.VR
LEADDICOM2.InsertElement False, TAG_QUERY_RETRIEVE_LEVEL, nVR, False, 0
LEADDICOM2.StringValueCount = 1
LEADDICOM2.StringValues (0) = "STUDY" 'we are searching at the study level
LEADDICOM2.SetStringValue 1
LEADDICOM2.FindTag TAG_STUDY_DATE
nVR = LEADDICOM2.CurrentTag.VR
LEADDICOM2.InsertElement False, TAG_STUDY_DATE, nVR, False, 0
LEADDICOM2.FindTag TAG_STUDY_TIME
nVR = LEADDICOM2.CurrentTag.VR
LEADDICOM2.InsertElement False, TAG_STUDY_TIME, nVR, False, 0
LEADDICOM2.FindTag TAG_ACCESSION_NUMBER
nVR = LEADDICOM2.CurrentTag.VR
LEADDICOM2.InsertElement False, TAG_ACCESSION_NUMBER, nVR, False, 0
LEADDICOM2.FindTag TAG_PATIENT_NAME
nVR = LEADDICOM2.CurrentTag.VR
LEADDICOM2.InsertElement False, TAG_PATIENT_NAME, nVR, False, 0
LEADDICOM2.FindTag TAG_PATIENT_ID
nVR = LEADDICOM2.CurrentTag.VR
LEADDICOM2.InsertElement False, TAG_PATIENT_ID, nVR, False, 0
LEADDICOM2.FindTag TAG_STUDY_ID
nVR = LEADDICOM2.CurrentTag.VR
LEADDICOM2.InsertElement False, TAG_STUDY_ID, nVR, False, 0
LEADDICOM2.FindTag TAG_STUDY_INSTANCE_UID
nVR = LEADDICOM2.CurrentTag.VR
LEADDICOM2.InsertElement False, TAG_STUDY_INSTANCE_UID, nVR, False, 0
'optional tags
LEADDICOM2.FindTag TAG_STUDY_DESCRIPTION
nVR = LEADDICOM2.CurrentTag.VR
LEADDICOM2.InsertElement False, TAG_STUDY_DESCRIPTION, nVR, False, 0
LEADDICOM2.FindTag TAG_PATIENT_BIRTH_DATE
nVR = LEADDICOM2.CurrentTag.VR
LEADDICOM2.InsertElement False, TAG_PATIENT_BIRTH_DATE, nVR, False, 0
LEADDICOM2.FindTag TAG_PATIENT_SEX
nVR = LEADDICOM2.CurrentTag.VR
LEADDICOM2.InsertElement False, TAG_PATIENT_SEX, nVR, False, 0
LEADDICOM2.FindTag TAG_OTHER_PATIENT_IDS
nVR = LEADDICOM2.CurrentTag.VR
LEADDICOM2.InsertElement False, TAG_OTHER_PATIENT_IDS, nVR, False, 0
LEADDICOM2.FindTag TAG_PATIENT_BIRTH_DATE
nVR = LEADDICOM2.CurrentTag.VR
LEADDICOM2.InsertElement False, TAG_PATIENT_BIRTH_DATE, nVR, False, 0
LEADDICOM2.FindTag TAG_ADDITIONAL_PATIENT_HISTORY
nVR = LEADDICOM2.CurrentTag.VR
LEADDICOM2.InsertElement False, TAG_ADDITIONAL_PATIENT_HISTORY, nVR, False, 0
LEADDICOM2.FindTag TAG_NUMBER_OF_STUDY_RELATED_INSTANCES
nVR = LEADDICOM2.CurrentTag.VR
LEADDICOM2.InsertElement False, TAG_NUMBER_OF_STUDY_RELATED_INSTANCES, nVR, False, 0
'now, send the command set and data set
LEADDICOMNet1.SendCFindRequest LEADDICOMNet1.hNet, nID, 1, szUID, COMMAND_PRIORITY_MEDIUM, LEADDICOM2.hDicomDS