LDicomDS::GetGraphicObjectInfo

#include "Ltdic.h"

L_UINT16 LDicomDS::GetGraphicObjectInfo(pGraphicAnnSQItem, uGraphicObjectIndex, pGraphicObject, uStructSize)

Gets the attributes of the specified graphic annotation object.

Parameters

pDICOMELEMENT pGraphicAnnSQItem

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

L_UINT uGraphicObjectIndex

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

pDICOMGRAPHICOBJECT pGraphicObject

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

L_UINT uStructSize

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

Returns

Value Meaning
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 LDicomDS::GetGraphicObjPointsCount in order to get the "Number of Graphic Points" (0070,0021) in this object and allocate pGraphicObject->pAnnPoints accordingly.

Required DLLs and Libraries

Platforms

Win32, x64

See Also

Functions

Topics

Example

L_INT LDicomDS_GetGraphicObjectInfoExample(LDicomDS& PresStateDS)   
{ 
   L_INT                nRet; 
   L_TCHAR              szText[256] = TEXT(""); 
   L_TCHAR*             pszType = NULL;  
   DICOMGRAPHICOBJECT   AnnGraphic;  
   L_UINT               uPointsCount;  
   L_UINT               uObjCount;  
   pDICOMANNPOINT       pPoints = NULL;  
   pDICOMELEMENT        pGraphicAnnSQItem = PresStateDS.FindFirstGraphicAnnSQItem(); 
 
   nRet = PresStateDS.GetLayerGraphicObjectCount(pGraphicAnnSQItem, &uObjCount);  
   if (nRet != DICOM_SUCCESS)  
      return nRet;  
   if (uObjCount > 0)  
   { 
      for (L_UINT i = 0; i < uObjCount; i++) 
      { 
         memset(&AnnGraphic, 0, sizeof(DICOMGRAPHICOBJECT));  
         nRet = PresStateDS.GetGraphicObjPointCount(pGraphicAnnSQItem,i, & uPointsCount);  
         if (nRet != DICOM_SUCCESS)  
            return nRet;  
 
         if (uPointsCount > 0)  
         { 
            pPoints = new DICOMANNPOINT[uPointsCount];  
            if (!pPoints)  
            { 
               return -1;  
            } 
            AnnGraphic.pAnnPoints = pPoints;  
            AnnGraphic.nPointCount = (L_UINT16)uPointsCount;  
            nRet = PresStateDS.GetGraphicObjectInfo(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)  
               { 
                  delete [] pPoints;  
               } 
            } 
            else 
               return nRet; 
         } 
      } 
   } 
   return DICOM_SUCCESS; 
} 
Help Version 21.0.2021.4.7
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2021 LEAD Technologies, Inc. All Rights Reserved.

LEADTOOLS DICOM C++ Class Library Help