L_DicomGetElementOffset

#include "Ltdic.h"

L_LTDIC_API L_INT64 L_DicomGetElementOffset(hDS, pElement)

HDICOMDS hDS;

a DICOM handle

pDICOMELEMENT pElement;

pointer to a DICOMELEMENT structure

Returns the offset of the DICOM element pElement in the DICOM file.

Parameter

Description

hDS

A DICOM handle.

pElement

Pointer to a DICOMELEMENT structure within the Data Set.

Returns

DICOM_SUCCESS

The offset of the element is unknown.

>0

The offset of the element in the DICOM file.

Comments

You must load a DICOM file using the flag DS_LOAD_STORE_OFFSETS to use this function.  Otherwise, L_DicomGetElementOffset will always return 0.

This method is used to return the offset (or physical location) in a DICOM file of any DICOM element.

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_DicomLoadDS, L_DicomFindFirstElement, L_DicomFindNextElement

Topics:

Working with Data Sets

 

How to Disable the Automatic Loading of the default DICOM IOD Table

Example

This example loads a DICOM file, and finds the physical offset of the TAG_PATIENT_ID in the file.

#define MAKE_IMAGE_PATH(pFileName) TEXT("C:\\Users\\Public\\Documents\\LEADTOOLS Images\\")pFileName 
L_VOID DicomGetElementOffsetExample() 
{ 
   HDICOMDS hDS = L_DicomCreateDS(NULL); 
   if (hDS == NULL) 
      return; 
   L_TCHAR *pszFile = MAKE_IMAGE_PATH(TEXT("image2.dcm")); 
   L_DicomLoadDS(hDS, pszFile, DS_LOAD_STORE_OFFSETS); 
   pDICOMELEMENT pElement = L_DicomFindFirstElement(hDS, NULL, TAG_PATIENT_ID, TRUE); 
   if (pElement == NULL) 
      return; 
   // uOffset will contain the file offset of the TAG_PATIENT_ID element 
   L_INT64 uOffset = L_DicomGetElementOffset(hDS, pElement); 
   L_TCHAR szMsg[200]={0}; 
   wsprintf(szMsg, TEXT("The offset of the TAG_PATIENT_ID in file '%s' is: 0x%x"), pszFile, uOffset); 
   OutputDebugString(szMsg); 
   // Clean up 
   L_DicomFreeDS(hDS); 
} 

Help Version 19.0.2017.10.27
Products | Support | Contact Us | Copyright Notices
© 1991-2017 LEAD Technologies, Inc. All Rights Reserved.
LEADTOOLS DICOM C API Help