SendNSetRequest Example for Delphi
var
nRet: Integer;
strClassUID: String;
strInstance: String;
hPDU: LongInt;
nID: Integer;
strNewID: String;
begin
//this sample allows you to change the patient id of an SOP Instance
//send an N-GET-REQUEST to the server
strClassUID:= InputBox('What class do you wish to set?', 'Set Request', UID_SC_IMAGE_STORAGE);
if(Length(strClassUID) < 1)then
Exit;
strInstance:= InputBox('What instance do you wish to set?', 'Set Request', '1.1.1.1');
if(Length(strInstance) < 1)then
Exit;
strNewID:= InputBox('Enter New Patient ID?', 'Set Request', '123-45-6789');
if(Length(strNewID) < 1)then
Exit;
//create the data set that encodes the changed element(s)
LEADDicomDS1.InitDS (DICOM_CLASS_UNKNOWN, 0);
LEADDicomDS1.ResetDS();
LEADDicomDS1.FindTag (TAG_PATIENT_ID);
LEADDicomDS1.InsertElement (False, TAG_PATIENT_ID, LEADDicomDS1.DefaultInterface.Get_CurrentTag().VR, False, 0);
LEADDicomDS1.StringValueCount:= 1;
LEADDicomDS1.StringValues [0]:= strNewID;
LEADDicomDS1.SetStringValue(1);
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.SendNSetRequest(LEADDICOMNet1.hNet, nID, 1, strClassUID, strInstance, LEADDicomDS1.hDicomDS);
end;