L_DicomSendCGetRequest

#include "ltdic.h"

L_LTDIC_API L_INT L_DicomSendCGetRequest(hNet, nPresentationID, nMessageID, pszClass, nPriority, hDS)

Sends a C-GET-REQ message to a peer member of a connection.

Parameters

HDICOMNET hNet

A DICOM Network handle to the peer member of the connection.

L_UCHAR nPresentationID

Presentation ID. The presentation ID provides information about both the class type of the data and the transfer syntax to use when transferring the data.

L_UINT16 nMessageID

Message ID. Each message sent by a member of a connection should have a unique ID. Since a member of a connection may send several messages, this ID allows that member to identify when a specific request has been completed.

L_TCHAR * pszClass

Class affected by the request. This will be an SOP Class or an SOP MetaClass.

L_UINT16 nPriority

The priority level of the message. The Service Class Provider may or may not support priority. Therefore, setting this parameter may or may not have any effect. Possible values are:

Value Meaning
COMMAND_PRIORITY_LOW [0x0002] Low priority message.
COMMAND_PRIORITY_MEDIUM [0x0000] Medium priority message.
COMMAND_PRIORITY_HIGH [0x0001] High priority message.

HDICOMDS hDS

Pointer to the data set to be found.

Returns

Value Meaning
DICOM_SUCCESS The function was successful.
>0 An error occurred. Refer to Return Codes.

Comments

Calling this function generates a call to RECEIVECGETREQUESTCALLBACK on the SCP. The SCP should respond by calling L_DicomSendCGetResponse which will generate a call to RECEIVECGETRESPONSECALLBACK.

You must create a data set and insert elements corresponding to the data you wish to get. The data set returned will include the entire data set that includes the requested data.

Required DLLs and Libraries

Platforms

Win32, x64, Linux.

See Also

Functions

Topics

Example

L_INT DicomSendCGetRequestExample(HDICOMNET hNet, L_TCHAR gszGetFile[L_MAXPATH]) 
{ 
   L_TCHAR szMsg[200]; 
   L_TCHAR szClassUID[800]; 
   HDICOMDS hDS=NULL; 
   pDICOMTAG pTag=NULL; 
   pDICOMELEMENT pElement=NULL; 
   HDICOMPDU hPDU; 
   L_UCHAR   nID; 
   L_INT nRet; 
    
   if (gszGetFile == NULL) 
      return ERROR_INV_PARAMETER; 
 
   /* send a get request to the server */ 
    
   /* gszGetFile will be used when this AE receives the NetReceiveCStoreRequest */ 
   /* associated with this CGetRequest to save the data set                     */ 
   lstrcpy(gszGetFile, MAKE_IMAGE_PATH(TEXT("Get_request.dcm"))); 
 
   /* this sample uses fixed values */ 
   lstrcpy(szClassUID, UID_SC_IMAGE_STORAGE); 
    
   /* create the data set that encodes the identifier to be matched */ 
   hDS = L_DicomCreateDS(NULL); 
   L_DicomInitDS(hDS, CLASS_UNKNOWN, 0); 
   L_DicomResetDS(hDS); 
 
   /* add the required elements */ 
   pTag = L_DicomFindTag(TAG_QUERY_RETRIEVE_LEVEL); 
   pElement = L_DicomInsertElement(hDS, NULL, FALSE, TAG_QUERY_RETRIEVE_LEVEL, pTag->nVR, FALSE, 0); 
   if (pElement == NULL) 
   { 
      L_DicomFreeDS(hDS); 
      return DICOM_ERROR_MEMORY; 
   } 
 
   L_DicomSetStringValue(hDS, pElement, TEXT("PATIENT"), 1,  DICOM_CHARACTER_SET_DEFAULT); 
    
   pTag = L_DicomFindTag(TAG_PATIENT_NAME); 
   pElement = L_DicomInsertElement(hDS, NULL, FALSE, TAG_QUERY_RETRIEVE_LEVEL, pTag->nVR, FALSE, 0); 
   if (pElement == NULL) 
   { 
      L_DicomFreeDS(hDS); 
      return DICOM_ERROR_MEMORY; 
   } 
 
   L_DicomSetStringValue(hDS, pElement, TEXT("*"), 1, DICOM_CHARACTER_SET_DEFAULT); 
 
   /* add the optional fields that we want returned */ 
   pTag = L_DicomFindTag(TAG_PATIENT_ID); 
   pElement = L_DicomInsertElement(hDS, NULL, FALSE, TAG_QUERY_RETRIEVE_LEVEL, pTag->nVR, FALSE, 0); 
   if (pElement == NULL) 
   { 
      L_DicomFreeDS(hDS); 
      return DICOM_ERROR_MEMORY; 
   } 
 
   pTag = L_DicomFindTag(TAG_PATIENT_BIRTH_DATE); 
   pElement = L_DicomInsertElement(hDS, NULL, FALSE, TAG_QUERY_RETRIEVE_LEVEL, pTag->nVR, FALSE, 0); 
   if (pElement == NULL) 
   { 
      L_DicomFreeDS(hDS); 
      return DICOM_ERROR_MEMORY; 
   } 
    
   pTag = L_DicomFindTag(TAG_PATIENT_SEX); 
   pElement = L_DicomInsertElement(hDS, NULL, FALSE, TAG_QUERY_RETRIEVE_LEVEL, pTag->nVR, FALSE, 0); 
   if (pElement == NULL) 
   { 
      L_DicomFreeDS(hDS); 
      return DICOM_ERROR_MEMORY; 
   } 
 
   pTag = L_DicomFindTag(TAG_NUMBER_OF_PATIENT_RELATED_INSTANCES); 
   pElement = L_DicomInsertElement(hDS, NULL, FALSE, TAG_QUERY_RETRIEVE_LEVEL, pTag->nVR, FALSE, 0); 
   if (pElement == NULL) 
   { 
      L_DicomFreeDS(hDS); 
      return DICOM_ERROR_MEMORY; 
   } 
 
   hPDU = L_DicomGetAssociate(hNet); 
    
   /* now, send a request */ 
   nID = L_DicomFindAbstract(hPDU, szClassUID); 
   if(nID == 0) 
   { 
      wsprintf(szMsg, TEXT("Abstract Syntax %s Not Supported by Association!"), szClassUID); 
      MessageBox(NULL, szMsg, TEXT("Error"), MB_OK); 
   } 
   else 
   { 
      nRet = L_DicomSendCGetRequest(hNet, nID, 1, szClassUID, COMMAND_PRIORITY_MEDIUM, hDS); 
      if (nRet != DICOM_SUCCESS) 
      { 
         L_DicomFreeDS(hDS); 
         return nRet; 
      } 
   } 
 
   L_DicomFreeDS(hDS); 
    
   /* we now must wait for the response and for the C-STORE sub-operations */ 
   return DICOM_SUCCESS; 
} 
Help Version 20.0.2020.4.2
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2020 LEAD Technologies, Inc. All Rights Reserved.

LEADTOOLS DICOM C API Help