SendNGetRequest Example for Delphi
var
nRet: Integer;
strClassUID: String;
strInstance: String;
hPDU: LongInt;
nID: Integer;
begin
//send an N-GET-REQUEST to the server
//gszGetFile is a global variable used in the NetReceiveNGetResponse event
gstrGetFile:= InputBox('Select filename for retrieved data set', 'Get Request', 'd:\temp\N_GET_REQ.dic');
if(Length(gstrGetFile) < 1)then
Exit;
strClassUID:= InputBox('What class do you wish to get?', 'Get Request', UID_SC_IMAGE_STORAGE);
if(Length(strClassUID) < 1)then
Exit;
strInstance:= InputBox('What instance do you wish to get?', 'Get Request', '1.1.1.1');
if(Length(strInstance) < 1)then
Exit;
//here, you must create a list of the identifiers
//that you wish to get from the server
LEADDICOMNet1.RequestAttributeCount:= 4;
LEADDICOMNet1.RequestAttributes[0]:= TAG_PATIENT_NAME;
LEADDICOMNet1.RequestAttributes[1]:= TAG_PATIENT_ID;
LEADDICOMNet1.RequestAttributes[2]:= TAG_PATIENT_SEX;
LEADDICOMNet1.RequestAttributes[3]:= TAG_NUMBER_OF_PATIENT_RELATED_INSTANCES;
hPDU:= LEADDICOMNet1.GetAssociate (LEADDICOMNet1.hNet);
//now, send a request
nID:= LEADDICOMNet1.FindPresentationAbstract (hPDU, strClassUID);
if(nID = 0)then
begin
nRet:= LEADDicomDS1.FindUID (strClassUID);
if(nRet = 0)then
ShowMessage('Abstract Syntax, ' + LEADDicomDS1.DefaultInterface.Get_CurrentUID().Name + ', Not Supported by Association!')
else
ShowMessage('Abstract Syntax, ' + strClassUID + ', Not Supported by Association!');
Exit;
end;
LEADDICOMNet1.SendNGetRequest(LEADDICOMNet1.hNet, nID, 1, strClassUID, strInstance);
end;