L_DicomSetDebugDS

Summary

This function is for debugging purposes.

Syntax

#include "Ltdic.h"

L_LTDIC_API L_VOID L_DicomSetDebugDS(hDS, pfnCallback, pUserData)

Parameters

HDICOMDS hDS

A DICOM handle.

CONFORMANCECALLBACK pfnCallback

Optional callback function. If you do not provide a callback function, use NULL as the value of this parameter. If you do provide a callback function, use the function pointer as the value of this parameter. The callback function must adhere to the function prototype described in CONFORMANCECALLBACK Function.

L_VOID * pUserData

Void pointer that you can use to pass one or more additional parameters that the callback function needs.

To use this feature, assign a value to a variable or create a structure that contains as many fields as you need. Then, in this parameter, pass the address of the variable or structure, casting it to L_VOID. The callback function, which receives the address in its own pUserData parameter, can cast it to a pointer of the appropriate data type to access your variable or structure. If the additional parameters are not needed, you can pass NULL in this parameter.

Returns

None.

Comments

When you access an invalid element, then the callback function will be called to notify you of the error. This may be seen when calling L_DicomGetCountImage in the example below. For any error that is found, nFlags should be set with the appropriate error and False returned from the callback function.

Required DLLs and Libraries

Platforms

Win32, x64, Linux.

See Also

Functions

Topics

Example

L_BOOL DebugCallback(pDICOMELEMENT pElement, L_UINT16 nFlags, L_VOID *pUserData) 
{ 
   UNREFERENCED_PARAMETER(pElement); 
   HWND hWnd = (HWND)pUserData; 
   if(nFlags == CALLBACK_ERROR_ELEMENT) 
      MessageBox(hWnd, TEXT("You accessed an invalid element"), TEXT("Debug"), MB_OK); 
   return TRUE; 
} 
 
L_INT DicomSetDebugDSExample(HWND hWnd) 
{ 
   HDICOMDS hDS=NULL; 
   L_UINT32 lCount; 
 
   pDICOMELEMENT pElement=(pDICOMELEMENT)0x1234; /* init the element to a bad value */  
   hDS = L_DicomCreateDS(NULL);  
   L_DicomInitDS(hDS, CLASS_CR_IMAGE_STORAGE, 0);  
 
   /* set the debug callback */ 
   L_DicomSetDebugDS(hDS, (CONFORMANCECALLBACK)DebugCallback, (L_VOID *)hWnd);  
 
   /* to access the invalid element */ 
   lCount = L_DicomGetCountImage(hDS, pElement);  
   L_DicomFreeDS(hDS); 
   return DICOM_SUCCESS; 
} 
Help Version 22.0.2022.12.7
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2023 LEAD Technologies, Inc. All Rights Reserved.

LEADTOOLS DICOM C API Help
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2023 LEAD Technologies, Inc. All Rights Reserved.