L_DicomCreateLayer

#include "l_bitmap.h"

L_UINT16 EXT_FUNCTION L_DicomCreateLayer(hDS, pGraphicLayer, pLayerIndex)

HDICOMDS hDS;

/* a DICOM handle */

pDICOMGRAPHICLAYER pGraphicLayer;

/* pointer to a Graphic Layer attributes structure */

L_UINT * pLayerIndex;

/* pointer to a variable, which will be updated with the index of the newly created layer.*/

Adds a new item under the "Graphic Layer Sequence" (0070,0060) in the Graphic Layer Module".

Parameter

Description

hDS

A DICOM handle.

pGraphicLayer

Pointer to a Graphic Layer attributes structure, which holds the attributes of the layer to be created.

pLayerIndex

Pointer to a variable, which will be updated with the index of the newly created layer.

Returns

0

SUCCESS

>0

An error occurred. Refer to Return Codes.

Comments

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

If for example there are already 2 items under the "Graphic Layer Sequence" (0070,0060) and we call this function, then the index of the new layer will be 2.

This function will fail and return DICOM_ERROR_PARAMETER if a layer with the same name as the new layer already exists in the dataset.

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_DicomGetLayerInfo, L_DicomSetLayerInfo, L_DicomRemoveLayerByIndex, L_DicomRemoveLayerByName, L_DicomRemoveAllLayers, L_DicomGetLayerCount, L_DicomGetLayerIndex, L_DicomGetLayerGraphicObjectCount, L_DicomRemoveLayerGraphicObjects, L_DicomGetLayerTextObjectCount, L_DicomRemoveLayerTextObjects, L_DicomGetLayerElementByIndex, L_DicomGetLayerElementByName

Topics:

Working with DICOM Annotations

 

Dicom Annotations: Layers

Example

L_VOID CreateNewLayer(HDICOMDS hPresStateDS)
{
 DICOMGRAPHICLAYER Layer;
 L_CHAR   szText[256] = "\0";
 L_INT16  RGBColors[3];
 L_INT16  pGrayScle[1]; 
 L_UINT   uLayerIndex;
 L_UINT16 nRet;
 
 memset(&Layer, 0, sizeof(DICOMGRAPHICLAYER));
   
 pGrayScle[0] = 32767;

 RGBColors[0] = 255;
 RGBColors[1] = 255;
 RGBColors[2] = 255;

 Layer.nLayerOrder = 1;
 Layer.pszLayerDescription = "First Layer";
 Layer.pszLayerName      = "LAYER0";
 Layer.puGrayscale       = pGrayScle;
 Layer.pRGBLayerColors   = RGBColors;
 Layer.uStructSize = sizeof(DICOMGRAPHICLAYER);
 nRet = L_DicomCreateLayer( hPresStateDS,
                              &Layer, 
                              &uLayerIndex);
   if (nRet == DICOM_SUCCESS)
   {
  wsprintf(szText, "Index of the new layer is: %u ", uLayerIndex);
      MessageBox( NULL, 
                  szText, 
                  "Note", 
                  MB_OK);  
   }
}