SendCMoveRequest Example for Delphi
var
nRet: Integer;
strClassUID: String;
nVR: Integer;
hPDU: LongInt;
nID: Integer;
begin
//send a Move Request to the server
//gszGetFile is a global variable that will be used when we get
//the C-STORE-RQ event to store the file
gszGetFile:= InputBox('Select filename for retrieved data set', 'Move Request', 'd:\temp\move_request.dic');
if(Length(gszGetFile) < 1)then
Exit;
strClassUID:= InputBox('What class do you wish to move?', 'Move Request', UID_NM_IMAGE_STORAGE);
if(Length(strClassUID) < 1)then
Exit;
//create the data set that encodes the identifier to be matched
LEADDicomDS1.InitDS (DICOM_CLASS_UNKNOWN, 0);
//add the required elements
LEADDicomDS1.FindTag (TAG_QUERY_RETRIEVE_LEVEL);
nVR:= LEADDicomDS1.DefaultInterface.Get_CurrentTag().VR;
LEADDicomDS1.InsertElement (False, TAG_QUERY_RETRIEVE_LEVEL, nVR, False, 0);
LEADDicomDS1.StringValueCount:= 1;
LEADDicomDS1.StringValues [0]:= 'PATIENT';
LEADDicomDS1.SetStringValue(1);
LEADDicomDS1.FindTag (TAG_PATIENT_NAME);
LEADDicomDS1.InsertElement (False, TAG_PATIENT_NAME, LEADDicomDS1.DefaultInterface.Get_CurrentTag().VR, False, 0);
//add the optional fields that we want returned
LEADDicomDS1.FindTag (TAG_PATIENT_ID);
LEADDicomDS1.InsertElement (False, TAG_PATIENT_ID, LEADDicomDS1.DefaultInterface.Get_CurrentTag().VR, False, 0);
LEADDicomDS1.FindTag (TAG_PATIENT_BIRTH_DATE);
nVR:= LEADDicomDS1.DefaultInterface.Get_CurrentTag().VR;
LEADDicomDS1.InsertElement (False, TAG_PATIENT_BIRTH_DATE, nVR, False, 0);
LEADDicomDS1.FindTag (TAG_PATIENT_SEX);
nVR:= LEADDicomDS1.DefaultInterface.Get_CurrentTag().VR;
LEADDicomDS1.InsertElement (False, TAG_PATIENT_SEX, nVR, False, 0);
LEADDicomDS1.FindTag (TAG_NUMBER_OF_PATIENT_RELATED_INSTANCES);
nVR:= LEADDicomDS1.DefaultInterface.Get_CurrentTag().VR;
LEADDicomDS1.InsertElement (False, TAG_NUMBER_OF_PATIENT_RELATED_INSTANCES, nVR, False, 0);
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;
//we are asking the Called AE to move the SOP Instance to ourselves
LEADDICOMNet1.SendCMoveRequest(LEADDICOMNet1.hNet, nID, 1, strClassUID, COMMAND_PRIORITY_MEDIUM, 'MI_TEST', LEADDicomDS1.hDicomDS);
//we now must wait for the response and for the C-STORE sub-operations
end;