LDicomDS::SetOverlayAttributes

#include "ltdic.h"

L_UINT16 LDicomDS::SetOverlayAttributes (uOverlayIndex,pOverlayAttributes,uFlags)

L_UINT uOverlayIndex;

index

pOVERLAYATTRIBUTES pOverlayAttributes;

pointer to a structure

L_UINT uFlags;

flags

Sets overlay attributes for a certain index.

Parameter Description
uOverlayIndex The index of the overlay for which to set the attributes. This index is zero-based.
pOverlayAttributes Pointer to a structure containing the overlay attributes to set.
uFlags Binary flags that determine the behavior of the function. Possible values are:
  Value Meaning
  SET_OVERLAY_ATTRIB_NO_OVERRIDE Set this flag if you don't want to update an overlay that already exists in the dataset.

Returns

0

The function was successful.

> 0

An error occurred. Refer to Return Codes.

Comments

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

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:

LDicomDS::GetOverlayCount, LDicomDS::GetOverlayAttributes, LDicomDS::GetOverlayActivationLayer, LDicomDS::GetOverlayBitmap, LDicomDS::GetOverlayBitmapList, LDicomDS::SetOverlayBitmap, LDicomDS::SetOverlayBitmapList, LDicomDS::DeleteOverlay

Topics:

Overlays Overview

 

Overlays

 

How to Disable the Automatic Loading of the default DICOM IOD Table

Example

// This function will delete all overlays in a dataset. 
L_UINT16 DeleteAllOverlays(LDicomDS &InDS) 
{ 
   L_UINT16 nRet; 
   L_UINT   uOverlayCount = 0; 
   L_UINT16 uOverlayIndex; 
   nRet  = InDS.GetOverlayCount (&uOverlayCount); 
   if(DICOM_SUCCESS != nRet) 
   { 
      return nRet; 
   } 
   for(uOverlayIndex = 0 ; uOverlayIndex < uOverlayCount ; uOverlayIndex++) 
   { 
      nRet = InDS.DeleteOverlay (uOverlayIndex,0); 
      if(DICOM_SUCCESS != nRet) 
      { 
         return nRet; 
      } 
   } 
   return DICOM_SUCCESS; 
} 
// This function will store the overlays associated 
// with a bitmap handle inside the DICOM dataset 
L_INT LDicomDS_SetOverlayAttributesExample(LDicomDS &InDS, pBITMAPHANDLE pBitmap) 
{ 
   OVERLAYATTRIBUTES OverlayAttributes; 
   BITMAPHANDLE      OverlayBitmap; 
   L_UINT            uOverlayCount; 
   L_UINT            uOverlayIndex; 
   L_INT             nLEADRet; 
   L_UINT16          uDICOMRet; 
   //(1)Sanity Check ! 
   if(NULL == pBitmap) 
   { 
      return DICOM_ERROR_NULL_PTR; 
   } 
   //(2)Do we have any overlays at all ? 
   nLEADRet = L_GetOverlayCount( pBitmap, &uOverlayCount, 0); 
   if(SUCCESS != nLEADRet) 
   { 
      return DICOM_ERROR_PARAMETER; 
   } 
   // If no overlays just return 
   if(0 == uOverlayCount) 
   { 
      return DICOM_SUCCESS; 
   } 
   //(3)Blow away all the overlays in the file 
   uDICOMRet = DeleteAllOverlays(InDS); 
   if(DICOM_SUCCESS != uDICOMRet) 
   { 
      return uDICOMRet; 
   } 
   //(4) Loop through the overlays and add them into the DICOM file 
   for(uOverlayIndex = 0 ; uOverlayIndex < uOverlayCount ; uOverlayIndex++) 
   { 
      memset(&OverlayAttributes    , 0 , sizeof(OVERLAYATTRIBUTES)); 
      memset(&OverlayBitmap        , 0 , sizeof(BITMAPHANDLE)); 
      // Get overlay attributes 
      nLEADRet = L_GetOverlayAttributes(  pBitmap, 
      uOverlayIndex, 
      &OverlayAttributes, 
      sizeof(OverlayAttributes), 
      OVERLAYATTRIBUTES_ORIGIN      | 
      OVERLAYATTRIBUTES_FLAGS       | 
      OVERLAYATTRIBUTES_BITINDEX    | 
      OVERLAYATTRIBUTES_DICOM); 
      if(SUCCESS != nLEADRet) 
      { 
         return DICOM_ERROR_PARAMETER; 
      } 
      // Set overlay attributes inside DICOM 
      uDICOMRet = InDS.SetOverlayAttributes (uOverlayIndex,&OverlayAttributes,0); 
      if(DICOM_SUCCESS != uDICOMRet) 
      { 
         return uDICOMRet; 
      } 
      // burn overlays which need to be part of the image 
      if(OverlayAttributes.uFlags &OVERLAY_USEBITPLANE) 
      { 
         nLEADRet = L_UpdateBitmapOverlayBits(  pBitmap, 
         uOverlayIndex, 
         SETOVERLAYBITS_FROMOVERLAY); 
         if(SUCCESS != nLEADRet) 
         { 
            return DICOM_ERROR_PARAMETER; 
         } 
      } 
      // Get the overlay data (if it's not part of the image) 
      nLEADRet = L_GetOverlayBitmap (  pBitmap, 
      uOverlayIndex, 
      &OverlayBitmap, 
      sizeof(BITMAPHANDLE), 
      OVERLAY_NOCOPY); 
      if(SUCCESS != nLEADRet) 
      { 
         return DICOM_ERROR_PARAMETER; 
      } 
      // Set overlay data into DICOM 
      uDICOMRet = InDS.SetOverlayBitmap (uOverlayIndex,&OverlayBitmap,0); 
      if(DICOM_SUCCESS != uDICOMRet) 
      { 
         return uDICOMRet; 
      } 
   } 
   return DICOM_SUCCESS; 
} 

Help Version 19.0.2017.10.27
Products | Support | Contact Us | Copyright Notices
© 1991-2017 LEAD Technologies, Inc. All Rights Reserved.
LEADTOOLS DICOM C++ Class Library Help