Products | Support | Send comments on this topic. | Email a link to this topic. | Back to Getting Started | Help Version 18.0.10.23
LEADTOOLS DICOM C DLL Help

L_DicomSendNReportRequest

Show in webframe

#include "ltdic.h"

L_LTDIC_API L_INT L_DicomSendNReportRequest(hNet, nPresentationID, nMessageID, pszClass, pszInstance, nEvent, 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 */

L_UINT16 nEvent;

/* event */

HDICOMDS hDS;

/* data set */

Sends an N-EVENT-REPORT-REQ message to a peer member of a connection. This function is available in the PACS Imaging 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.

nEvent

An application specific event for which a report is to be generated.

hDS

Application specific data set which contains information related to the operation.

Returns

DICOM_SUCCESS

The function was successful.

>0

An error occurred. Refer to Return Codes.

Comments

Calling this function generates a call to RECEIVENREPORTREQUESTCALLBACK on the SCP. The SCP should respond by calling L_DicomSendNReportResponse which will generate a call to RECEIVENREPORTRESPONSECALLBACK.

A report is generated to let all peers attached to a server know of some event that has occurred. This event may be the addition of a new patient, the deletion of a patient, the addition of a new study, etc. The nEvent value, which designates the event that occurred is determined by the server. To find out the values used, you must contact the organization that created the server. When creating a server, the values and their corresponding meanings are determined by those creating the server.

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

Platforms

Win32, x64, Linux.

See Also

Functions:

L_DicomSendNReportResponse, RECEIVENREPORTREQUESTCALLBACK, RECEIVENREPORTRESPONSECALLBACK

Topics:

Working with DICOM Network Connections

Example

L_INT DicomSendNReportRequestExample(HDICOMNET hServer)
{
   L_UINT32 x;
   HDICOMNET hClient=NULL;
   L_TCHAR szClass[200];
   L_TCHAR szInstance[200];
   L_TCHAR szMsg[200];
   HDICOMPDU hPDU;
   L_UCHAR nID;
   HDICOMDS hDS=NULL;
   pDICOMTAG pTag = NULL;
   pDICOMELEMENT pElement=NULL;
   VALUEDATE d;
   VALUETIME t;
   L_INT nRet;
   
   /* send an event report message to all clients */
   /* let them know a new patient was created */
   
   /* this sample just uses a made up instance */
   lstrcpy(szClass, UID_US_IMAGE_STORAGE);
   lstrcpy(szInstance, TEXT("1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1"));
   
   /* create the data set */
   hDS = L_DicomCreateDS(NULL);
   L_DicomInitDS(hDS, CLASS_UNKNOWN, 0);
   
   /* add the required elements */
   pTag = L_DicomFindTag(TAG_SPECIFIC_CHARACTER_SET);
   pElement = L_DicomInsertElement(hDS, NULL, FALSE, TAG_SPECIFIC_CHARACTER_SET, pTag->nVR, FALSE, 0);
   if (pElement == NULL)
   {
      L_DicomFreeDS(hDS);
      return DICOM_ERROR_MEMORY;
   }
   
   pTag = L_DicomFindTag(TAG_INSTANCE_CREATION_DATE);
   pElement = L_DicomInsertElement(hDS, NULL, FALSE, TAG_INSTANCE_CREATION_DATE, pTag->nVR, FALSE, 0);
   if (pElement == NULL)
   {
      L_DicomFreeDS(hDS);
      return DICOM_ERROR_MEMORY;
   }
   d.nDay   = 31;
   d.nMonth = 12;
   d.nYear  = 1999;
   L_DicomSetDateValue(hDS, pElement, &d, 1);
   
   pTag = L_DicomFindTag(TAG_INSTANCE_CREATION_TIME);
   pElement = L_DicomInsertElement(hDS, NULL, FALSE, TAG_INSTANCE_CREATION_TIME, pTag->nVR, FALSE, 0);
   if (pElement == NULL)
   {
      L_DicomFreeDS(hDS);
      return DICOM_ERROR_MEMORY;
   }
   t.nHours       = 12;
   t.nMinutes     = 30;
   t.nSeconds     = 0;
   t.nFractions   = 0;
   L_DicomSetTimeValue(hDS, pElement, &t, 1);
   
   pTag = L_DicomFindTag(TAG_INSTANCE_CREATOR_UID);
   pElement = L_DicomInsertElement(hDS, NULL, FALSE, TAG_INSTANCE_CREATOR_UID, pTag->nVR, FALSE, 0);
   if (pElement == NULL)
   {
      L_DicomFreeDS(hDS);
      return DICOM_ERROR_MEMORY;
   }
   L_DicomSetStringValue(hDS, pElement, TEXT("9.9.9999.9"), 1, DICOM_CHARACTER_SET_DEFAULT); /* some unique value */
   
   pTag = L_DicomFindTag(TAG_PATIENT_NAME);
   pElement = L_DicomInsertElement(hDS, NULL, FALSE, TAG_PATIENT_NAME, pTag->nVR, FALSE, 0);
   if (pElement == NULL)
   {
      L_DicomFreeDS(hDS);
      return DICOM_ERROR_MEMORY;
   }
   L_DicomSetStringValue(hDS, pElement, TEXT("dummy_patient_name"), 1, DICOM_CHARACTER_SET_DEFAULT);
   pTag = L_DicomFindTag(TAG_PATIENT_ID);
   pElement = L_DicomInsertElement(hDS, NULL, FALSE, TAG_PATIENT_ID, pTag->nVR, FALSE, 0);
   if (pElement == NULL)
   {
      L_DicomFreeDS(hDS);
      return DICOM_ERROR_MEMORY;
   }
   L_DicomSetStringValue(hDS, pElement, TEXT("dummy_patient_id"), 1, DICOM_CHARACTER_SET_DEFAULT);
   pTag = L_DicomFindTag(TAG_PATIENT_BIRTH_DATE);
   pElement = L_DicomInsertElement(hDS, NULL, FALSE, TAG_PATIENT_BIRTH_DATE, pTag->nVR, FALSE, 0);
   if (pElement == NULL)
   {
      L_DicomFreeDS(hDS);
      return DICOM_ERROR_MEMORY;
   }
   L_DicomSetStringValue(hDS, pElement, TEXT("dummy_patient_id"), 1, DICOM_CHARACTER_SET_DEFAULT);
   pTag = L_DicomFindTag(TAG_PATIENT_BIRTH_DATE);
   pElement = L_DicomInsertElement(hDS, NULL, FALSE, TAG_PATIENT_BIRTH_DATE, pTag->nVR, FALSE, 0);
   if (pElement == NULL)
   {
      L_DicomFreeDS(hDS);
      return DICOM_ERROR_MEMORY;
   }
   L_DicomSetStringValue(hDS, pElement, TEXT("dummy_patient_id"), 1, DICOM_CHARACTER_SET_DEFAULT);
   L_DicomSetDateValue(hDS, pElement, &d, 1);
   
   pTag = L_DicomFindTag(TAG_PATIENT_SEX);
   pElement = L_DicomInsertElement(hDS, NULL, FALSE, TAG_PATIENT_SEX, pTag->nVR, FALSE, 0);
   if (pElement == NULL)
   {
      L_DicomFreeDS(hDS);
      return DICOM_ERROR_MEMORY;
   }
   L_DicomSetStringValue(hDS, pElement, TEXT("M"), 1, DICOM_CHARACTER_SET_DEFAULT);
   for(x=0; x<L_DicomGetClientCount(hServer); x++)
   {
      hClient = L_DicomGetClient(hServer, x);
      hPDU = L_DicomGetAssociate(hClient);
      nID = L_DicomFindAbstract(hPDU, szClass);
      if(nID == 0)
      {
         wsprintf(szMsg, TEXT("Abstract Syntax %s Not Supported by Association!"), szClass);
         MessageBox(NULL, szMsg, TEXT("Error"), MB_OK);
      }
      else
      {
         /* now, send the message */
         nRet = L_DicomSendNReportRequest(hClient, nID, 1, szClass, szInstance, 1, hDS);
         if (nRet != DICOM_SUCCESS)
         {
            L_DicomFreeDS(hDS);
            return nRet;
         }
      }
   }
   L_DicomFreeDS(hDS);
   return DICOM_SUCCESS;
}
Products | Support | Contact Us | Copyright Notices
© 2006-2014 All Rights Reserved. LEAD Technologies, Inc.