Loads the DICOM Directory Data Set from the specified file.


#include "Ltdic.h"

L_UINT16 LDicomDir::LoadDS(pszName, nFlags)


L_TCHAR* pszName

Character string that contains the name of the DICOMDIR File.

L_UINT16 nFlags

Meta-header flags and Transfer Syntax flags that indicate the file characteristics to use when loading the file. Possible values for the Meta-header flags are:

Value Meaning
0 [0x0000] LEADTOOLS will automatically determine the presence or absence of the Meta-header.
DS_METAHEADER_PRESENT [0x0001] The header is present.
DS_METAHEADER_ABSENT [0x0002] The header is absent.

Possible values and combinations for the Transfer Syntax flags are:

Value Meaning
0 [0x0000] LEADTOOLS will automatically determine the Transfer Syntax.
DS_LITTLE_ENDIAN [0x0004] Byte order is Little Endian.
DS_BIG_ENDIAN [0x0008] Byte order is Big Endian.
DS_IMPLICIT_VR [0x0010] The Value Representation is implicit.
DS_EXPLICIT_VR [0x0020] The Value Representation is explicit.
DS_LITTLE_ENDIAN | DS_IMPLICIT_VR Little Endian Byte Order/Implicit Value Representation
DS_LITTLE_ENDIAN | DS_EXPLICIT_VR Little Endian Byte Order/Explicit Value Representation
DS_BIG_ENDIAN | DS_EXPLICIT_VR Big Endian Byte Order/Explicit Value Representation
DS_LOAD_CLOSE [0x0200] The complete dataset will be loaded into memory and the file handle closed.

Any of the available Meta-header flags given above may be combined with any of the available values or combinations of values for the Transfer Syntax flags given above. For example, you may combine DS_METAHEADER_ABSENT with DS_EXPLICIT_VR, or you may combine DS_METAHEADER_PRESENT with DS_LITTLE_ENDIAN | DS_EXPLICIT_VR, etc.


Value Meaning
0 The function was successful.
> 0 An error occurred. Refer to Return Codes.


In addition to loading the DICOM Directory Data Set, the function also sets the destination folder to the folder in which the specified DICOMDIR File resides. Additional DICOM files in this folder (and subfolders) can be added to the loaded Directory.

If DS_LOAD_CLOSE is used, for large images, this may slow performance, however, the file handle will be released. If set to None, large images will load quickly, and image traverse can begin immediately. However, until the file handle is released, nothing can be done to the image.

If DS_LOAD_CLOSE is not specified, the file will remain open until one of the following functions is called: LDicomDir::ResetDicomDir, LDicomDir::LoadDS (again), LDicomDS::ResetDS, LDicomDS::InitDS, or LDicomDS::LoadDS.

For more information, refer to the overridden function LDicomDS::LoadDS.

Required DLLs and Libraries


Win32, x64

See Also




L_INT LDicomDir_LoadDSExample() 
   L_INT       nRet; 
   LDicomDir   DicomDir; 
   // Load a DICOMDIR File. Note: It is necessary to specify 
   // DS_LOAD_CLOSE so that we can save the Directory later. 
   nRet = DicomDir.LoadDS(MAKE_IMAGE_PATH(TEXT("Image1.dcm")), DS_LOAD_CLOSE); 
   if(nRet != DICOM_SUCCESS) 
      return nRet; 
   // Add some additional DICOM files to the loaded Directory 
   nRet = DicomDir.InsertDicomFile(MAKE_IMAGE_PATH(TEXT("image2.dcm"))); 
   if(nRet != DICOM_SUCCESS) 
      return nRet; 
   nRet = DicomDir.InsertDicomFile(MAKE_IMAGE_PATH(TEXT("image3.dcm"))); 
   if(nRet != DICOM_SUCCESS) 
      return nRet; 
   // Save the DICOMDIR File 
   nRet = DicomDir.SaveDicomDir(); 
   if(nRet != DICOM_SUCCESS) 
      return nRet; 
   return DICOM_SUCCESS; 
Help Version 23.0.2024.2.29
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2024 LEAD Technologies, Inc. All Rights Reserved.

LEADTOOLS DICOM C++ Class Library Help

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