#include "ltivw.h"

L_LTIVW_API L_INT L_DispContainerAnnToRgn(hCellWnd, nSubCellIndex, uCombineMode, bDeleteAnn, uFlags)

L_HWND hCellWnd;

handle to the cell window

L_INT nSubCellIndex;

index into the image list attached to the cell

L_UINT uCombineMode;

action to apply on the existing region

L_BOOL bDeleteAnn;


L_UINT uFlags;

reserved for future use

Converts a selected annotation object inside a specific cell or sub-cell into a region, this region will be either set or combined with another existing region.

Parameter Description
hCellWnd A handle to the window that represents the cell on which the function's effect will be applied.
nSubCellIndex A zero-based index into the image list attached to the cell specified in nCellIndex. This image contains the annotation object that the user chooses to convert into region. Pass -1 to apply this effect on all sub-cells. Pass -2 to apply this effect on the selected sub-cell.
uCombineMode Value that specifies the action to apply on the existing bitmap region, if one is defined. For descriptions of the possible values, refer to Creating a Bitmap Region Inside the Image Viewer.
bDeleteAnn Flag that indicates whether to delete the annotation object after converting it to a region. Possible values are:
  Value Meaning
  TRUE Delete the annotation object after completing the process.
  FALSE Do not delete the annotation object after completing the process.
uFlags Reserved for future use. Pass 0.



The function was successful.

< 1

An error occurred. Refer to Return Codes.


The chosen sub-cell or cell must have a selected annotation in order to convert it into a region. If there is no selected annotation, the function will return ERROR_INV_PARAMETER.

This function works only on the closed shape annotation objects, such as rectangle, ellipse and Hilite.

If you have a cell with one image, you must set nSubCellIndex to zero.

Required DLLs and Libraries


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


L_DispContainerCreate, L_DispContainerDestroy, L_DispContainerSetAction, L_DispContainerAddAction, L_DispContainerGetSelectedAnnotationAttributes


Working with Annotations

Image Viewer Functions: Working with Annotations


This function inverts a region inside the bitmap, we assumed that we have one cell, and there is a selected rectanglur or elliptical annotation on it.

L_INT DispContainerAnnToRgnExample(HDISPCONTAINER hCon) 
   L_INT        nRet; 
   L_INT nCellIndex = 0; 
   HWND hCellWnd = L_DispContainerGetCellWindowHandle(hCon, nCellIndex, 0); 
   nRet = L_DispContainerAnnToRgn(hCellWnd, -2, L_RGN_SET, TRUE, 0); 
   if (nRet != SUCCESS) 
      return nRet; 
   // Just apply the effect on the active sub-cell. 
   // this is done by setting the nSubCell parameter to -2. 
   nRet = L_DispContainerGetBitmapHandle(hCellWnd, -2, &Bitmap, 0); 
   if (nRet != SUCCESS) 
      return nRet; 
   nRet = L_InvertBitmap(&Bitmap, 0); 
   if (nRet != SUCCESS) 
      return nRet; 
   nRet = L_DispContainerSetBitmapHandle(hCellWnd, -2, &Bitmap, FALSE, 0); 
   if (nRet != SUCCESS) 
      return nRet; 
   // Repaint the cell after the user is done with the changes. 
   nRet = L_DispContainerRepaintCell(hCellWnd, 0); 
   if (nRet != SUCCESS) 
      return nRet; 
   return SUCCESS; 

Help Version 19.0.2017.10.18
Products | Support | Contact Us | Copyright Notices
© 1991-2017 LEAD Technologies, Inc. All Rights Reserved.
LEADTOOLS Medical Image Viewer C API Help