L_DicomGetGraphicObjectInfo

#include "l_bitmap.h"

L_LTDIC_API L_UINT16 L_DicomGetGraphicObjectInfo(hDS, pGraphicAnnSQItem, uGraphicObjectIndex, pGraphicObject, uStructSize)

HDICOMDS hDS;

/* a DICOM handle */

pDICOMELEMENT pGraphicAnnSQItem;

/* pointer to a DICOMELEMENTstructure */

L_UINT uGraphicObjectIndex;

/* graphic annotation object index */

pDICOMGRAPHICOBJECT pGraphicObject;

/* pointer to the graphic annotation object attributes structure to be updated */

L_UINT uStructSize;

/* the size of the DICOMGRAPHICOBJECT structure - pass sizeof(DICOMGRAPHICOBJECT) */

Gets the attributes of the specified 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".

uGraphicObjectIndex

The index of the graphic annotation object whose attributes we want to retrieve.

pGraphicObject

Pointer to a structure which will be filled with the graphic annotation object attributes.

uStructSize

Size of the DICOMGRAPHICOBJECT structure. Pass sizeof(DICOMGRAPHICOBJECT).

Returns

0

SUCCESS

>0

An error occurred. Refer to Return Codes.

Comments

This function will retrieve the attributes of the specified graphic object and store their values in the structure pointed to by pGraphicObject.

pGraphicObject->uStructSize will be set to the value of the parameter uStructSize.

Before calling this function you can call L_DicomGetGraphicObjPointsCount in order to get the "Number of Graphic Points" (0070,0021) in this object and allocate pGraphicObject->pAnnPoints accordingly.

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

See Also

Functions:

L_DicomFindFirstGraphicAnnSQItem, L_DicomCreateGraphicAnnSQItem, L_DicomCreateGraphicObject, L_DicomRemoveGraphicObject, 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 DicomGetGraphicObjectInfoExample(HDICOMDS hPresStateDS)
{
   L_TCHAR szText[256] = TEXT("\0");
   L_UINT16 nRet;
   L_TCHAR* pszType = NULL;
   DICOMGRAPHICOBJECT AnnGraphic;
   L_UINT uPointsCount;
   L_UINT uObjCount;
   pDICOMANNPOINT pPoints = NULL;
   L_UINT i;

   pDICOMELEMENT pGraphicAnnSQItem = L_DicomFindFirstGraphicAnnSQItem(hPresStateDS);

   nRet = L_DicomGetLayerGraphicObjectCount(hPresStateDS,pGraphicAnnSQItem, &uObjCount);
   if (nRet != DICOM_SUCCESS)
      return nRet;

   if (uObjCount > 0)
   {
      for (i = 0; i < uObjCount; i++)
      {
         memset(&AnnGraphic, 0, sizeof(DICOMGRAPHICOBJECT));
         nRet = L_DicomGetGraphicObjPointCount(hPresStateDS,pGraphicAnnSQItem, i, & uPointsCount);
         if (nRet != DICOM_SUCCESS)
            return nRet;

         if (uPointsCount > 0)
         {
            pPoints = (DICOMANNPOINT *)malloc(sizeof(DICOMANNPOINT) * uPointsCount);
            if (!pPoints)
               return ERROR_NOT_ENOUGH_MEMORY;

            AnnGraphic.pAnnPoints = pPoints;
            AnnGraphic.nPointCount = (L_UINT16)uPointsCount;

            nRet = L_DicomGetGraphicObjectInfo( hPresStateDS,
               pGraphicAnnSQItem,
               i,
               &AnnGraphic,
               sizeof(DICOMGRAPHICOBJECT));

            if (nRet == DICOM_SUCCESS)
            {
               switch (AnnGraphic.uType)
               {
               case DICANN_TYPE_POINT:
                  pszType = TEXT("Point Annotation");
                  break;
               case DICANN_TYPE_POLYLINE:
                  pszType = TEXT("Polyline Annotation");
                  break;
               case DICANN_TYPE_INTERPOLATED:
                  pszType = TEXT("Interpolated Line Annotation");
                  break;
               case DICANN_TYPE_CIRCLE:
                  pszType = TEXT("Circle Annotation");
                  break;
               case DICANN_TYPE_ELLIPSE:
                  pszType = TEXT("Ellipse Annotation");
                  break;
               }

               if (pszType)
               {
                  wsprintf(szText, TEXT("Annotation type is: %s"), pszType);
                  MessageBox( NULL, szText, TEXT("Note"), MB_OK);
               }

               // Do something with the points
               if (pPoints)
                  free(pPoints);
            }
         }
      }
   }

   return DICOM_SUCCESS;
}