NetReceiveCMoveRequest Example for Delphi
procedure TForm1.LEADDicomNet1NetReceiveCMoveRequest (ASender: TObject;
hNet: Integer; nPresentationID, nMessageID: Smallint;
const pszClass: WideString; nPriority: Smallint;
const pszMoveAE: WideString; hDS: Integer);
var
nRet: Integer;
NewNode: TTreeNode;
strName: String;
hPDU: LongInt;
strInstance: String;
strClassUID: String;
nID: Integer;
begin
NewNode:= TreeView1.Items.Add(TreeView1.Selected, 'Command Set - ' + 'C-MOVE-REQUEST');
NewNode.MakeVisible();
hPDU:= LEADDICOMNet1.GetAssociate (hNet);
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));
TreeView1.Items.Add(NewNode, 'Move AE Title: ' + pszMoveAE);
//this sample simply returns a fixed dicom data set.
LEADDicomDS1.LoadDS ('e:\images\dicom16.dic', 0);
LEADDicomDS1.MoveFirstElement (False);
LEADDicomDS1.FindFirstElement (TAG_SOP_INSTANCE_UID, False);
LEADDicomDS1.GetStringValue (0, 1);
strInstance:= LEADDicomDS1.StringValues [0];
LEADDicomDS1.MoveFirstElement (False);
LEADDicomDS1.FindFirstElement (TAG_SOP_CLASS_UID, False);
LEADDicomDS1.GetStringValue (0, 1);
strClassUID:= LEADDicomDS1.StringValues [0];
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!');
//send a response
LEADDICOMNet1.SendCMoveResponse(hNet, nPresentationID, nMessageID, pszClass, COMMAND_STATUS_NO_SUCH_CLASS, 0, 0, 1, 0, 0);
Exit;
end;
//now, send the C-STORE sub operation
LEADDICOMNet1.SendCStoreRequest(hNet, nID, nMessageID + 1, strClassUID, strInstance, nPriority, pszMoveAE, nMessageID, LEADDicomDS1.hDicomDS);
//send a response
LEADDICOMNet1.SendCMoveResponse(hNet, nPresentationID, nMessageID, pszClass, COMMAND_STATUS_SUCCESS, 0, 1, 0, 0, 0);
end;