Sets overlay attributes for a certain index.
#include "ltdic.h"
L_UINT16 LDicomDS::SetOverlayAttributes (uOverlayIndex,pOverlayAttributes,uFlags)
The index of the overlay for which to set the attributes. This index is zero-based.
Pointer to a structure containing the overlay attributes to set.
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. |
| Value | Meaning |
|---|---|
| 0 | The function was successful. |
| > 0 | An error occurred. Refer to Return Codes. |
Before calling this function, initialize pOverlayAttributes->uStructSize to be sizeof(OVERLAYATTRIBUTES) and initialize all the OVERLAYATTRIBUTES structure members.
Win32, x64
// 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 datasetL_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 returnif(0 == uOverlayCount){return DICOM_SUCCESS;}//(3)Blow away all the overlays in the fileuDICOMRet = DeleteAllOverlays(InDS);if(DICOM_SUCCESS != uDICOMRet){return uDICOMRet;}//(4) Loop through the overlays and add them into the DICOM filefor(uOverlayIndex = 0 ; uOverlayIndex < uOverlayCount ; uOverlayIndex++){memset(&OverlayAttributes , 0 , sizeof(OVERLAYATTRIBUTES));memset(&OverlayBitmap , 0 , sizeof(BITMAPHANDLE));// Get overlay attributesnLEADRet = 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 DICOMuDICOMRet = InDS.SetOverlayAttributes (uOverlayIndex,&OverlayAttributes,0);if(DICOM_SUCCESS != uDICOMRet){return uDICOMRet;}// burn overlays which need to be part of the imageif(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 DICOMuDICOMRet = InDS.SetOverlayBitmap (uOverlayIndex,&OverlayBitmap,0);if(DICOM_SUCCESS != uDICOMRet){return uDICOMRet;}}return DICOM_SUCCESS;}
Help Collections
Raster .NET | C API | C++ Class Library | HTML5 JavaScript
Document .NET | C API | C++ Class Library | HTML5 JavaScript
Medical .NET | C API | C++ Class Library | HTML5 JavaScript
Medical Web Viewer .NET
Multimedia
Direct Show .NET | C API | Filters
Media Foundation .NET | C API | Transforms
Supported Platforms
.NET, Java, Android, and iOS/macOS Assemblies
Imaging, Medical, and Document
C API/C++ Class Libraries
Imaging, Medical, and Document
HTML5 JavaScript Libraries
Imaging, Medical, and Document
