L_DicomCreateGraphicObject

#include "l_bitmap.h"

L_LTDIC_API L_UINT16 L_DicomCreateGraphicObject(hDS, pGraphicAnnSQItem, pGraphicObject, bCheckLayer)

HDICOMDS hDS;

/* a DICOM handle */

pDICOMELEMENT pGraphicAnnSQItem;

/* pointer to a DICOMELEMENT structure */

pDICOMGRAPHICOBJECT pGraphicObject;

/* pointer to the graphic object attributes structure */

L_BOOL bCheckLayer;

/* flag that indicates whether to verify that the layer (to which the graphic object will be added) exists or not */

Creates a new graphic annotation object.

Parameter

Description

hDS

A DICOM handle.

pGraphicAnnSQItem

Pointer to an item element under the "Graphic Annotation Sequence" (0070,0001) in the "Graphic Annotation Module".

pGraphicObject

Pointer to the graphic object attributes structure.

bCheckLayer

Flag that indicates whether to verify that the layer (to which the graphic object will be added) exists or not. Possible values are:

 

Value

Meaning

 

TRUE

Check if the layer exists before adding the object. If it does not exist, then return an error.

 

FALSE

Add the new object without checking the existence of the layer.

Returns

DICOM_SUCCESS

The function was successful.

>0

An error occurred. Refer to Return Codes.

Comments

Before calling this function, initialize pDICOMGRAPHICOBJECT->uStructSize to be sizeof(DICOMGRAPHICOBJECT) and initialize all the structure members.

When the parameter bCheckLayer is set to TRUE, then this function checks if the layer specified in the member variable pszLayerName exists or not. If it does not exist, an error will be returned.

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_DicomFindFirstGraphicAnnSQItem, L_DicomCreateGraphicAnnSQItem, L_DicomRemoveGraphicObject, L_DicomGetGraphicObjectInfo, L_DicomSetGraphicObjectInfo, L_DicomGetGraphicObjectCount, L_DicomRemoveAllGraphicObjects, L_DicomGetGraphicObjPointCount, L_DicomGetGraphicObjElement, L_DicomConvertLEADAnnObjToDicomAnnObjs, L_DicomConvertDicomAnnObjToLEADAnnObj

Topics:

Working with DICOM Annotations

 

Dicom Annotations: Graphic Objects

Example

L_INT DicomCreateGraphicObjectExample(HDICOMDS hPresStateDS)
{
   DICOMGRAPHICOBJECT GraphicObject = {0};
   L_UINT   nCount = 5;
   L_UINT16 nRet;
   memset(&GraphicObject, 0, sizeof(DICOMGRAPHICOBJECT));
   GraphicObject.pAnnPoints = (pDICOMANNPOINT) malloc(sizeof(DICOMANNPOINT) * nCount);  
   if(GraphicObject.pAnnPoints == NULL)
      return ERROR_NOT_ENOUGH_MEMORY;
   GraphicObject.pAnnPoints [0].fX = (L_FLOAT)480.00;
   GraphicObject.pAnnPoints [0].fY = (L_FLOAT)226.00;
   GraphicObject.pAnnPoints [1].fX = (L_FLOAT)480.00;
   GraphicObject.pAnnPoints [1].fY = (L_FLOAT)418.00;
   GraphicObject.pAnnPoints [2].fX = (L_FLOAT)488.00;
   GraphicObject.pAnnPoints [2].fY = (L_FLOAT)418.00;
   GraphicObject.pAnnPoints [3].fX = (L_FLOAT)488.00;
   GraphicObject.pAnnPoints [3].fY = (L_FLOAT)226.00; 
   GraphicObject.pAnnPoints [4].fX = (L_FLOAT)480.00;
   GraphicObject.pAnnPoints [4].fY = (L_FLOAT)226.00; 
   GraphicObject.bFilled = TRUE;
   GraphicObject.uType = DICANN_TYPE_POLYLINE;
   GraphicObject.pszLayerName = TEXT("First Layer");
   GraphicObject.nPointCount  = (L_UINT16)nCount;
   GraphicObject.uUnits = DICANN_UNIT_PIXEL;   
   GraphicObject.uStructSize = sizeof(DICOMGRAPHICOBJECT);
   nRet = L_DicomCreateGraphicObject(  hPresStateDS,
                                       L_DicomFindFirstGraphicAnnSQItem(hPresStateDS), 
                                       &GraphicObject,
                                       FALSE);
   if (nRet == DICOM_SUCCESS)
   {
      MessageBox( NULL,
                  TEXT("Object has been successfully created."),
                  TEXT("Note"),
                  MB_OK);
   }
   if (GraphicObject.pAnnPoints)
      free(GraphicObject.pAnnPoints);
   return nRet;
}