To create and load a Data Set from an existing DICOM file, you must begin by allocating the memory required for the Data Set. This is accomplished by calling L_DicomCreateDS. This function returns a DICOM handle to the Data Set, which is required for most of the functions included in this toolkit.
With the memory allocated, you can now load a Data Set of a DICOM file by calling L_DicomLoadDS. For example code showing these first two calls, refer to the example under L_DicomLoadDS.
At this point, you are ready to get information about the Data Set, traverse the Data Set, search for specific modules or elements, get/set data values, add modules or elements or delete modules or elements.
Once you have finished with the Data Set, you must free the memory that was allocated for the Data Set by calling L_DicomFreeDS.
As a short example, the code shown below does the following:
Creates a Data Set.
Loads a Data Set from a DICOM file.
Finds the first module on Level 0 of the Data Set tree structure.
Finds the first element of the module.
Prints information about the number of modules present, the number of the first module, and information about the first element in the module.
Frees the memory.
By comparing the printed values for the module number, data element tag, and value representation to their respective default tables, you can determine which module, element and value representation are present.
HDICOMDS hDS;
L_UINT32 nCount;
L_CHAR cs[256];
pDICOMELEMENT pElement;
pDICOMMODULE pModule;
/* Create the data set */
hDS = L_DicomCreateDS(NULL);
/* Load the data set from a DICOM file */
L_DicomLoadDS(hDS, "D:\\LTWIN13x\\images\\test2.dic", 0);
/* determine the number of modules in the data set. */
nCount = L_DicomGetCountModule(hDS);
/* Find the first module on Level 0 of the Data Set tree. */
pModule = L_DicomFindIndexModule(hDS, 0);
if (pModule != NULL)
{
/* Get the first element in the module */
pElement = pModule->pElement[0];
/* print the information */
wsprintf (cs,"There are %d modules in this data set.\nThe first module has number %Xh.\n"
"The first module has %d elements.\nThe first element of the first module has:\n"
"Tag number: %Xh\nVR: %Xh\nLength:%d\n",
nCount, pModule->nModule, pModule->nCount, pElement->nTag, pElement->nVR,
pElement->nLength);
MessageBox(NULL, cs, "Notice", MB_OK);
}
/* Free the memory. */
L_DicomFreeDS(hDS);
Help Collections
Raster .NET | C API | C++ Class Library | HTML5 JavaScript
Document .NET | C API | C++ Class Library | HTML5 JavaScript
Medical .NET | C API | C++ Class Library | HTML5 JavaScript
Medical Web Viewer .NET
Multimedia
Direct Show .NET | C API | Filters
Media Foundation .NET | C API | Transforms
Supported Platforms
.NET, Java, Android, and iOS/macOS Assemblies
Imaging, Medical, and Document
C API/C++ Class Libraries
Imaging, Medical, and Document
HTML5 JavaScript Libraries
Imaging, Medical, and Document