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++ Class Library Help

LDicomDS::GetElementOffset

Show in webframe

#include "Ltdic.h"

L_UINT32 LDicomDS::GetElementOffset(pElement)

pDICOMELEMENT pElement;

/* pointer to a DICOMELEMENT structure */

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

Parameter

Description

pElement

Pointer to a DICOMELEMENT structure within the Data Set.

Returns

0

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, LDicomDS::GetElementOffset 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

See Also

Functions:

LDicomDS::LoadDS, LDicomDS::FindFirstElement, LDicomDS::FindNextElement

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_INT LDicomDS_GetElementOffsetExample() 
{
   L_INT nRet = -1;
   LDicomDS *ds = new LDicomDS();
   if (ds == NULL)
      return nRet;
   L_TCHAR *pszFile = MAKE_IMAGE_PATH(TEXT("image2.dcm"));
   nRet = ds->LoadDS(pszFile, DS_LOAD_STORE_OFFSETS);
   if(nRet != DICOM_SUCCESS)
      return nRet;
   pDICOMELEMENT pElement = ds->FindFirstElement(NULL, TAG_PATIENT_ID, TRUE);
   if (pElement == NULL)
      return -1;
   // uOffset will contain the file offset of the TAG_PATIENT_ID element
   L_UINT32 uOffset = ds->GetElementOffset(pElement);
   CString csMsg;
   csMsg.Format(TEXT("The offset of the TAG_PATIENT_ID in file '%s' is: 0x%x"), pszFile, uOffset);
   OutputDebugString(csMsg);
   // Clean up
   delete ds;
   return nRet;
}
Products | Support | Contact Us | Copyright Notices
© 2006-2014 All Rights Reserved. LEAD Technologies, Inc.