SendNReportRequest Example for Delphi
var
x: Integer;
hClient: LongInt;
nVR: Integer;
szClass: String;
szInstance: String;
hPDU: LongInt;
nID: Integer;
nRet: Integer;
begin
//send an event report message to all clients
//let them know a new patient was created
//this sample just uses a made up instance
szClass := UID_US_IMAGE_STORAGE;
szInstance := '1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1';
//create the data set
LEADDicomDS1.InitDS (DICOM_CLASS_UNKNOWN, 0);
LEADDicomDS1.ResetDS();
//add the required elements
LEADDicomDS1.FindTag (TAG_SPECIFIC_CHARACTER_SET);
nVR := LEADDicomDS1.DefaultInterface.Get_CurrentTag().VR;
LEADDicomDS1.InsertElement (False, TAG_SPECIFIC_CHARACTER_SET, nVR, False, 0);
LEADDicomDS1.FindTag (TAG_INSTANCE_CREATION_DATE);
nVR := LEADDicomDS1.DefaultInterface.Get_CurrentTag().VR;
LEADDicomDS1.InsertElement (False, TAG_INSTANCE_CREATION_DATE, nVR, False, 0);
LEADDicomDS1.DateValueCount := 1;
LEADDicomDS1.DateValues [0].Day := 31;
LEADDicomDS1.DateValues [0].Month := 12;
LEADDicomDS1.DateValues [0].Year := 1999;
LEADDicomDS1.SetDateValue (1);
LEADDicomDS1.FindTag (TAG_INSTANCE_CREATION_TIME);
nVR := LEADDicomDS1.DefaultInterface.Get_CurrentTag().VR;
LEADDicomDS1.InsertElement (False, TAG_INSTANCE_CREATION_TIME, nVR, False, 0);
LEADDicomDS1.TimeValueCount := 1;
LEADDicomDS1.TimeValues [0].Hours := 12;
LEADDicomDS1.TimeValues [0].Minutes := 30;
LEADDicomDS1.SetTimeValue (1);
LEADDicomDS1.FindTag (TAG_INSTANCE_CREATOR_UID);
nVR := LEADDicomDS1.DefaultInterface.Get_CurrentTag().VR;
LEADDicomDS1.InsertElement (False, TAG_INSTANCE_CREATOR_UID, nVR, False, 0);
LEADDicomDS1.StringValueCount := 1;
LEADDicomDS1.StringValues [0] := '9.9.9999.9'; //some unique value
LEADDicomDS1.SetStringValue (1);
LEADDicomDS1.FindTag (TAG_PATIENT_NAME);
nVR := LEADDicomDS1.DefaultInterface.Get_CurrentTag().VR;
LEADDicomDS1.InsertElement (False, TAG_PATIENT_NAME, nVR, False, 0);
LEADDicomDS1.StringValueCount := 1;
LEADDicomDS1.StringValues [0] := 'dummy_patient_name';
LEADDicomDS1.SetStringValue (1);
//add the optional fields that we want returned
LEADDicomDS1.FindTag (TAG_PATIENT_ID);
nVR := LEADDicomDS1.DefaultInterface.Get_CurrentTag().VR;
LEADDicomDS1.InsertElement (False, TAG_PATIENT_ID, nVR, False, 0);
LEADDicomDS1.StringValueCount := 1;
LEADDicomDS1.StringValues [0] := 'dummy_patient_id';
LEADDicomDS1.SetStringValue (1);
LEADDicomDS1.FindTag (TAG_PATIENT_BIRTH_DATE);
nVR := LEADDicomDS1.DefaultInterface.Get_CurrentTag().VR;
LEADDicomDS1.InsertElement (False, TAG_PATIENT_BIRTH_DATE, nVR, False, 0);
LEADDicomDS1.DateValueCount := 1;
LEADDicomDS1.DateValues [0].Day := 31;
LEADDicomDS1.DateValues [0].Month := 12;
LEADDicomDS1.DateValues [0].Year := 1999;
LEADDicomDS1.SetDateValue (1);
LEADDicomDS1.FindTag (TAG_PATIENT_SEX);
nVR := LEADDicomDS1.DefaultInterface.Get_CurrentTag().VR;
LEADDicomDS1.InsertElement (False, TAG_PATIENT_SEX, nVR, False, 0);
LEADDicomDS1.StringValueCount := 1;
LEADDicomDS1.StringValues [0] := 'M';
LEADDicomDS1.SetConvertValue();
for x:= 0 to LEADDICOMNet1.GetClientCount (LEADDICOMNet1.hNet) - 1 do
begin
hClient := LEADDICOMNet1.GetClient (LEADDICOMNet1.hNet, x);
hPDU := LEADDICOMNet1.GetAssociate (hClient);
nID := LEADDICOMNet1.FindPresentationAbstract (hPDU, szClass);
if(nID = 0)then
begin
nRet := LEADDicomDS1.FindUID (szClass);
if(nRet = 0)then
ShowMessage('Abstract Syntax, ' + LEADDicomDS1.DefaultInterface.Get_CurrentUID().Name + ', Not Supported by Association!')
else
ShowMessage('Abstract Syntax, ' + szClass + ', Not Supported by Association!');
Screen.Cursor:= crDefault;
end;
//now, send the message
LEADDICOMNet1.SendNReportRequest(hClient, nID, 1, szClass, szInstance, 1, LEADDicomDS1.hDicomDS);
end;
end;