LDicomDS::CreateTextObject

#include "Ltdic.h"

L_UINT16 LDicomDS::CreateTextObject(pGraphicAnnSQItem, pTextObject, bCheckLayer=FALSE)

pDICOMELEMENT pGraphicAnnSQItem;

/* pointer to a DICOMELEMENT structure */

pDICOMTEXTOBJECT pTextObject;

/* pointer to the text object attributes structure */

L_BOOL bCheckLayer;

/* flag */

Creates a new text annotation object.

Parameter

Description

pGraphicAnnSQItem

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

pTextObject

Pointer to the text object attributes structure.

bCheckLayer

Flag that indicates whether to verify that the layer (to which the text 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 existed, then return an error.

 

FALSE

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

Returns

0

SUCCESS

>0

An error occurred. Refer to Return Codes.

Comments

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

When the parameter bCheckLayer is set to TRUE, then the 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

See Also

Functions:

LDicomDS::FindFirstGraphicAnnSQItem, LDicomDS::CreateGraphicAnnSQItem, LDicomDS::RemoveTextObject, LDicomDS::GetTextObjectInfo, LDicomDS::SetTextObjectInfo, LDicomDS::GetTextObjectCount, LDicomDS::RemoveAllTextObjects, LDicomDS::GetTextObjElement, LDicomDS::ConvertLEADAnnObjToDicomAnnObjs, LDicomDS::ConvertLEADAnnObjToDicomAnnObjs, LDicomDS::ConvertDicomAnnObjToLEADAnnObj, Class Members

Topics:

Working with DICOM Annotations

Example

L_VOID CreateNewTextObject(LDicomDS& PresStateDS)
{
   DICOMTEXTOBJECT TextObject; 
 
  pDICOMELEMENT pGraphicAnnSQItem = PresStateDS.FindFirstGraphicAnnSQItem();
 memset(&TextObject, 0, sizeof(DICOMTEXTOBJECT)); 
 L_FLOAT pAnchorPoint[2]; 
 L_FLOAT pBRHCorner[2]; 
 L_FLOAT pTLHCorner[2]; 
 
 pAnchorPoint[0] = (L_FLOAT)1.1; 
 pAnchorPoint[1] = (L_FLOAT)1.1; 
 
 pBRHCorner[0] = (L_FLOAT)521.251343; 
 pBRHCorner[1] = (L_FLOAT)328.190216; 
 
 pTLHCorner[0] = (L_FLOAT)466.642242; 
 pTLHCorner[1] = (L_FLOAT)300.443268; 

 TextObject.bAnchorPointVisible = FALSE; 
 TextObject.pAnchorPoint = NULL; 
 TextObject.pBRHCorner = pBRHCorner; 
 TextObject.pszTextValue = "Text Value 1";
 TextObject.pTLHCorner = pTLHCorner; 
 TextObject.uAnchorPointUnits = DICANN_UNIT_PIXEL; 
 TextObject.uBoundingBoxUnits = DICANN_UNIT_PIXEL; 
 TextObject.pszLayerName = "First Layer";
 TextObject.uTextJustification = DICANN_TEXT_LEFT; 
 TextObject.uStructSize = sizeof(DICOMTEXTOBJECT); 

 L_UINT16 nRet = PresStateDS.CreateTextObject(pGraphicAnnSQItem, &TextObject); 
 if (nRet == DICOM_SUCCESS) 
 {
      MessageBox( NULL, 
                  "Object has been successfully created.", 
                  "Note", 
                  MB_OK); 
 }
}