NetReceiveCGetRequest Example for Delphi
procedure TForm1.LEADDicomNet1NetReceiveCGetRequest (ASender: TObject;
hNet: Integer; nPresentationID, nMessageID: Smallint;
const pszClass: WideString; nPriority: Smallint; hDS: Integer);
var
nRet: Integer;
szFile: String;
NewNode: TTreeNode;
strName: String;
strAE: String;
hPDU: LongInt;
strInstance: String;
begin
NewNode:= TreeView1.Items.Add(TreeView1.Selected, 'Command Set - ' + 'C-GET-REQUEST');
NewNode.MakeVisible();
TreeView1.Items.Add(NewNode, 'Presentation ID: ' + IntToStr(nPresentationID));
TreeView1.Items.Add(NewNode, 'Message ID: ' + IntToStr(nMessageID));
nRet:= LEADDicomDS1.FindUID (pszClass);
if(nRet = 0)then
begin
strName:= LEADDicomDS1.DefaultInterface.Get_CurrentUID().Name;
TreeView1.Items.Add(NewNode, 'Affected SOP Class: ' + strName + ' - ' + pszClass);
end
else
TreeView1.Items.Add(NewNode, 'Affected SOP Class: ' + pszClass);
TreeView1.Items.Add(NewNode, 'Priority: ' + IntToStr(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:= LEADDicomDS1.LoadDS (szFile, 0);
//now, send a store command for the get sub-operation
hPDU:= LEADDICOMNet1.GetAssociate (hNet);
strAE:= LEADDICOMNet1.GetCalling(hPDU);
nRet:= LEADDicomDS1.FindFirstElement (TAG_SOP_INSTANCE_UID, False);
if(nRet = 0)then
begin
nRet:= LEADDicomDS1.GetStringValue (0, 1);
if(nRet = 0)then
strInstance:= LEADDicomDS1.StringValues [0];
end;
nRet:= LEADDICOMNet1.SendCStoreRequest(hNet, nPresentationID, nMessageID + 1, pszClass, strInstance, nPriority, strAE, nMessageID, LEADDicomDS1.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;