Available in LEADTOOLS Medical Imaging toolkits. |
Working with DICOM Annotations
LEADTOOLS DICOM C DLL provides basic annotation support for users who just want to load, count, obtain information about and save annotation files. In addition, LEADTOOLS provides more advanced support for users who want to work with the "Graphic Annotation Module" and the "Grayscale Softcopy Presentation State" IOD, which let you display and manipulate graphic and text annotations.
Please note that the MEDICAL capabilities must be unlocked in order to work with DICOM annotations. For more information on unlocking these capabilities, refer to L_UnlockSupport.
Basic
The toolkit gives the user the ability to store LEADTOOLS annotation files as private data elements inside a DICOM dataset. You can store up to 256 single page or multi-page annotation files, either in the LEAD native format or a binary encoded format.
For working with the annotation files, LEAD provides the following:
To load an annotation file from a DICOM data set, use the L_DicomAnnLoad function.
The L_DicomAnnCount retrieves information about the annotation files stored in a DICOM data set. This function provides information on which of the 256 positions within the DICOM data set contain annotation files and, if desired, the appropriate private creator tag.
The L_DicomAnnDelete function can be used to delete a page from an annotation file, delete an entire annotation file, or delete all annotation files stored in a DICOM data set.
To save annotations as private data within a DICOM data set, use the L_DicomAnnSave function.
Advanced
The DICOM standard defines the "Graphic Annotation Module" which describes the attributes of vector graphics and text annotations that shall be made available by a display device to be applied to an image. LEADTOOLS offers a number of functions to manipulate DICOM graphic and text annotations and the related attributes which are part of the "Grayscale Softcopy Presentation State" IOD.
L_DicomGetPresStateInfo and L_DicomSetPresStateInfo can be used to retrieve and update the values of the elements that describe the "Presentation State Module" respectively. The following functions can be used to mange the set of referenced images under the "Referenced Series Sequence" (0008,1115) in the "Presentation State Module":
L_DicomAddPresStateImageRefByFileName
L_DicomAddPresStateImageRefByDS
L_DicomRemovePresStateImageRefBySOPInstance
L_DicomRemoveAllPresStateImageRefs
L_DicomGetPresStateImageRefSOPInstance
L_DicomGetPresStateImageRefCount
L_DicomFindFirstPresStateRefSeriesItem
L_DicomFindNextPresStateRefSeriesItem
L_DicomGetPresStateImageRefBySOPInstance
LEADTOOLS also offers an extensive set of functions to manipulate the "Graphic Layer Module".
This Module defines the characteristics of the layers in which graphic annotations, text annotations, curves and overlays can be rendered. A new layer can be created by calling L_DicomCreateLayer. Once a layer has been created, you can call L_DicomGetLayerInfo and L_DicomSetLayerInfo to retrieve and update the values of the elements that describe the layer attributes respectively. A layer can be removed by calling either L_DicomRemoveLayerByIndex or L_DicomRemoveLayerByName, L_DicomRemoveAllLayers will remove all layers in the dataset. Some of the other functions which can be used to maintain layers are:
L_DicomGetLayerGraphicObjectCount
L_DicomRemoveLayerGraphicObjects
L_DicomGetLayerTextObjectCount
A new graphic annotation object can be created by calling L_DicomCreateGraphicObject. Once a graphic object has been created, you can call L_DicomGetGraphicObjectInfo and L_DicomSetGraphicObjectInfo to retrieve and update the values of the elements that describe the object attributes respectively.
The L_DicomCreateGraphicAnnSQItem function adds a new item under the "Graphic Annotation Sequence" (0070,0001) in the "Graphic Annotation Module".
The L_DicomFindFirstGraphicAnnSQItem function retrieves the first item under the "Graphic Annotation Sequence" (0070,0001) in the "Graphic Annotation Module".
The L_DicomFindNextGraphicAnnSQItem function returns a pointer to the next item under the "Graphic Annotation Sequence" (0070,0001) in the "Graphic Annotation Module".
Some of the other functions which can be used to manipulate graphic objects are:
L_DicomGetGraphicObjPointCount
L_DicomRemoveAllGraphicObjects
A new text annotation object can be created by calling L_DicomCreateTextObject. Once a text object has been created, you can call L_DicomGetTextObjectInfo and L_DicomSetTextObjectInfo to retrieve and update the values of the elements that describe the object attributes respectively. Some of the other functions which can be used to manipulate text objects are:
The "Referenced Image Sequence" (0008,1140) under the "Graphic Annotation Module" is used to define the set of images (SOP instances) to which a group of graphic and text annotations applies. LEADTOOLS offers the following functions to manipulate the items under that sequence:
L_DicomRemoveImageRefFromLayer
L_DicomRemoveAllImageRefsFromLayer
L_DicomRemoveAllImageRefFromAllLayers
L_DicomGetLayerImageRefElement
To bring the DICOM annotation world into the LEADTOOLS annotation world, the toolkit offers a number of functions to convert from DICOM annotations into LEADTOOLS annotations and vise versa. L_DicomConvertLEADAnnObjToDicomAnnObjs can be used to convert a LEADTOOLS annotation object into one or more DICOM annotation objects, and (optionally) add the new DICOM annotation object(s) into the dataset. For each resulting DICOM annotation object the CONVERTLEADANNOBJTODICOMANNPROC callback function will be called by the toolkit.
To convert from DICOM graphic or text annotations into LEADTOOLS annotations use L_DicomConvertDicomAnnObjToLEADAnnObj.