L_DicomLoadDS

#include "Ltdic.h"

L_LTDIC_API L_UINT16 L_DicomLoadDS(hDS, pszName, nFlags)

HDICOMDS hDS;

/* a DICOM handle */

L_TCHAR* pszName;

/* file name */

L_UINT16 nFlags;

/* flags that indicate file characteristics */

Loads the Data Set from the specified file.

Parameter

Description

hDS

A DICOM handle.

pszName

Character string that contains the name of the file.

nFlags

Meta-header flags, Transfer Syntax flags and other 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

 

 

Other flags include:

 

 

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_BIG_ENDIAN | DS_EXPLICIT_VR, etc.

Returns

0

SUCCESS

>0

An error occurred. Refer to Return Codes.

Comments

You must call L_DicomCreateDS to allocate memory for the Data Set, prior to calling this function.

If you know certain characteristics of the file, you can set those in nFlags. Any characteristic that you dont set will be automatically determined. For example, if you know that the metaheader is present, but you do not know the byte order, or whether the Value Representation is implicit or explicit, you can set only DS_METAHEADER_PRESENT in nFlags. During loading LEADTOOLS will determine the byte order and whether the byte order is implicit or explicit.

If you do not know any of the characteristics of the file, set nFlags to 0 and LEADTOOLS will automatically determine all the file characteristics and load the file accordingly.

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 included in nFlags, the file will remain open until one of the following functions is called: L_DicomFreeDS, L_DicomResetDS, L_DicomInitDS, or L_DicomLoadDS (again).

To load a data set from memory, call L_DicomLoadDSMemory.

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:

L_DicomSaveDS, L_DicomLoadDSMemory, L_DicomCreateDS, L_DicomFreeDS, L_DicomResetDS, L_DicomInitDS

Topics:

Working with Data Sets

 

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

Example

This example loads the Data Set from a file

L_INT DicomLoadDSExample(L_VOID)
{
   HDICOMDS hDS;
   L_INT nRet;

   hDS = L_DicomCreateDS(NULL);
   nRet = L_DicomLoadDS(hDS, TEXT("%UserProfile%\\My Documents\\LEADTOOLS Images\\Image1.dcm"), 0);
   if (nRet != DICOM_SUCCESS)
   {
      L_DicomFreeDS(hDS);
      return nRet;
   }

   L_DicomFreeDS(hDS);

   return DICOM_SUCCESS;
}