L_DicomSendNCreateRequest)

#include "ltdic.h"

L_LTDIC_API L_INT L_DicomSendNCreateRequest(hNet, nPresentationID, nMessageID, pszClass, pszInstance, hDS)

HDICOMNET hNet;

/* a DICOM Network handle */

L_UCHAR nPresentationID;

/* presentation ID */

L_UINT16 nMessageID;

/* message ID */

L_TCHAR * pszClass;

/* class type */

L_TCHAR * pszInstance;

/* instance */

HDICOMDS hDS;

/* data set */

Sends an N-CREATE-REQ message to a peer member of a connection. This function is available in the Medical Suite Toolkit.

Parameter

Description

hNet

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

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.

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.

pszClass

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

pszInstance

The instance of the class. A server may, for example, have three instances of the Nuclear Medicine Class. This value identifies the data with a specific instance.

hDS

Data set with the information to use when creating.

Returns

0

SUCCESS

>0

An error occurred. Refer to Return Codes.

Comments

Calling this function generates a call to RECEIVENCREATEREQUESTCALLBACK on the SCP. The SCP should respond by calling L_DicomSendNCreateResponse which will generate a call to RECEIVENCREATERESPONSECALLBACK.

This function creates a new SOP Instance on the specified peer connection. The data set with the new information must be created and filled before calling this function.

Required DLLs and Libraries

LTDIC

For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application

See Also

Functions:

L_DicomSendNCreateResponse, RECEIVENCREATEREQUESTCALLBACK, RECEIVENCREATERESPONSECALLBACK

Topics:

Working with DICOM Network Connections

Example

L_INT DicomSendNCreateRequestExample(HDICOMNET hNet)
{
   L_TCHAR szClassUID[200];
   L_TCHAR szInstanceUID[200];
   HDICOMPDU hPDU;
   L_UCHAR nID;
   HDICOMDS hDS=NULL;
   L_TCHAR szMsg[200];
   L_UINT nRet;
   
   /* this sample uses fixed values */
   lstrcpy(szClassUID, UID_SC_IMAGE_STORAGE);
   lstrcpy(szInstanceUID, TEXT("1.2.840.113619.2.30.1.1762288927.1489.906240296.255"));
   
   /* send a Create Request Command to the server */
   hPDU = L_DicomGetAssociate(hNet);
   
   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
   {
      /*
         here, you should construct a Data Set that contains the attributes
         and values for the new SOP Instance.
         In this sample, we simply load a Data Set from a file on disk
         as the data set to send
      */
      hDS = L_DicomCreateDS(NULL);
      nRet = L_DicomLoadDS(hDS, TEXT("C:\\Program Files\\LEAD Technologies\\LEADTOOLS 15\\Images\\Test3.dic"), 0);
      if (nRet != DICOM_SUCCESS)
      {
         L_DicomFreeDS(hDS);
         return nRet;
      }
   
      /* send a Create Request message */
      nRet = L_DicomSendNCreateRequest(hNet, nID, 1, szClassUID, szInstanceUID, hDS);
      if (nRet != DICOM_SUCCESS)
      {
         L_DicomFreeDS(hDS);
         return nRet;
      }

      L_DicomFreeDS(hDS);
   }
   return DICOM_SUCCESS;
}