LEADTOOLS DICOM C DLL Help > Function References > L_DicomSaveDS |
#include "Ltdic.h"
L_LTDIC_API L_UINT16 L_DicomSaveDS(hDS, pszName, nFlags)
HDICOMDS hDS; |
/* a DICOM handle */ |
L_TCHAR * pszName; |
/* file name */ |
L_UINT16 nFlags; |
/* flags that indicate file characteristics */ |
Saves the Data Set to 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 file characteristics to use when saving the file. Possible values for Meta-header flags are. |
|
|
Value |
Meaning |
|
0 |
[0x0000] Save the Data Set using the characteristics used when loading the Data Set. This can be used with compressed or uncompressed images. |
|
DS_METAHEADER_PRESENT |
[0x0001] The header is present. This can be used with compressed or uncompressed images. |
|
DS_METAHEADER_ABSENT |
[0x0002] The header is absent. This can be used only with uncompressed images. |
|
Possible values and combinations for the Transfer Syntax flags are: |
|
|
0 |
[0x0000] Save the Data Set using the characteristics used when loading the Data Set. This can be used with compressed or uncompressed images. |
|
DS_LITTLE_ENDIAN |
[0x0004] Byte order is Little Endian. This can be used with compressed or uncompressed images. |
|
DS_BIG_ENDIAN |
[0x0008] Byte order is Big Endian. This can be used only with uncompressed images. |
|
DS_IMPLICIT_VR |
[0x0010] The Value Representation is implicit. This can be used only with uncompressed images. |
|
DS_EXPLICIT_VR |
[0x0020] The Value Representation is explicit. This can be used with compressed or uncompressed images. |
|
The following Transfer Syntax flag combinations can be used only with uncompressed images: |
|
|
DS_LITTLE_ENDIAN | DS_IMPLICIT_VR |
|
|
DS_BIG_ENDIAN | DS_EXPLICIT_VR |
|
|
The following Transfer Syntax flag combination can be used with compressed or uncompressed images: |
|
|
DS_LITTLE_ENDIAN | DS_EXPLICIT_VR |
|
|
Possible values and combinations for other flags are: |
|
|
0 |
[0x0000] Save the Data Set using the characteristics used when loading the Data Set. |
|
DS_GROUP_LENGTHS |
[0x0040] Include an entry in the file for each group with the group number and the number of elements that group has. |
|
DS_LENGTH_EXPLICIT |
[0x0080] The length of a sequence (in bytes) is encoded as a 32-bit integer and no Sequence delimitation item is included at the end of the sequence. |
|
DS_EXCLUDE_METAHEADER_GROUP |
[0x0100] Elements with the tag number 0x0002xxxx will not be saved in the file. |
|
DS_GROUP_LENGTHS | DS_LENGTH_EXPLICIT |
Any of the available Meta-header flags options above may be combined with any of the available options for the Transfer Syntax flags and other flags given above, based on whether the images are compressed or uncompressed. For example, you may combine DS_METAHEADER_ABSENT with DS_LITTLE_ENDIAN | DS_IMPLICIT_VR and DS_GROUP_LENGTHS | DS_LENGTH_EXPLICIT when using uncompressed images, or you may combine DS_METAHEADER_PRESENT with DS_LITTLE_ENDIAN | DS_EXPLICIT_VR and DS_GROUP_LENGTHS | DS_LENGTH_EXPLICIT when using compressed images.
Returns
DICOM_SUCCESS |
The function was successful. |
>0 |
An error occurred. Refer to Return Codes. |
Comments
If the Data Set was loaded from a file, the file characteristics were included from the file. If you wish to use these same characteristics, save the Data Set with nFlags set to 0.
If you wish to specify the file characteristics for saving the file, set the characteristics using the possible values listed above for nFlags.
Required DLLs and Libraries
For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application |
Win32, x64, Linux.
See Also
Functions: |
|
Topics: |
|
|
How to Disable the Automatic Loading of the default DICOM IOD Table |
Example
This example initializes the Data Set and save it in a file
#define MAKE_IMAGE_PATH(pFileName) TEXT("C:\\Users\\Public\\Documents\\LEADTOOLS Images\\")pFileName L_INT DicomSaveDSExample(L_VOID) { HDICOMDS hDS; L_UINT16 nRet; hDS = L_DicomCreateDS(NULL); L_DicomInitDS(hDS, CLASS_CT_IMAGE_STORAGE, 0); nRet = L_DicomSaveDS(hDS, MAKE_IMAGE_PATH(TEXT("Result.dcm")), 0); L_DicomFreeDS(hDS); return nRet; }