LDicomDir::LoadDS

#include "Ltdic.h"

L_UINT16 LDicomDir::LoadDS(pszName, nFlags)

L_TCHAR* pszName;

/* DICOMDIR filename */

L_UINT16 nFlags;

/* flags that indicate the file characteristics */

Loads the DICOM Directory Data Set from the specified file.

Parameter

Description

pszName

Character string that contains the name of the DICOMDIR File.

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:

 

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

 

 

DS_LITTLE_ENDIAN | DS_EXPLICIT_VR

 

 

DS_BIG_ENDIAN | DS_EXPLICIT_VR

 

 

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.

Returns

0

The function was successful.

> 0

An error occurred. Refer to Return Codes.

Comments

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

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:

LDicomDir::SaveDicomDir, Class Members

Topics:

Creating DICOM Directories

Example

#define MAKE_IMAGE_PATH(pFileName) TEXT("C:\\Users\\Public\\Documents\\LEADTOOLS Images\\")pFileName
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;
}