LDicomDS::SetOverlayAttributes

#include "ltdic.h"

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

Sets overlay attributes for a certain index.

Parameters

L_UINT uOverlayIndex

The index of the overlay for which to set the attributes. This index is zero-based.

pOVERLAYATTRIBUTES pOverlayAttributes

Pointer to a structure containing the overlay attributes to set.

L_UINT 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

Value Meaning
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

Platforms

Win32, x64

See Also

Functions

Topics

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 21.0.2021.7.2
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2021 LEAD Technologies, Inc. All Rights Reserved.

LEADTOOLS DICOM C++ Class Library Help
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2021 LEAD Technologies, Inc. All Rights Reserved.