LBitmap::AutoSegment

#include "ltwrappr.h"

L_INT LBitmap::AutoSegment(pRect, uFlags = 0)

L_RECT* pRect;

/* pointer to rectangle specifying the area */

L_UINT32 uFlags;

/* flags */

Performs automated segmentation of a rectangular area in the class object's bitmap. The result is applied to the image as a region.

Parameter

Description

pRect

Pointer to Windows RECT structure that specifies the part of the bitmap to perform the segmentation on.

uFlags

Reserved for future use. Must be 0.

Returns

SUCCESS

The function was successful.

< 1

An error occurred. Refer to Return Codes.

Comments

This function was designed specifically for CT/MRI images, to segment regions of cancer clusters.

It is preferred that pRect points to a rectangle that includes all needed object to be selected. Failure to do so will result in a partial selection of the object as the function will only segment inside the desired rectangle.

Try to make an informed selection, i.e. do not select more than the object you need to isolate and segment.

The rectangle must not exceed the borders of the image; otherwise the function will return an ERROR_INVALID_PARAMETER error and will not execute.

When the resultant region is no longer needed, it should be freed by calling LBitmapRgn::Free.

Required DLLs and Libraries

LTIMGCOR

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:

LBitmapRgn::HolesRemovalRgn, LBitmapRgn::Free

Topics:

Raster Image Functions: Creating and Using a Region

 

Creating a Bitmap Region

Example

#define MAKE_IMAGE_PATH(pFileName) TEXT("C:\\Users\\Public\\Documents\\LEADTOOLS Images\\")pFileName
L_INT LBitmap__AutoSegmentExample()
{
   L_INT nRet;
   LBitmap LeadBitmap;
   L_RECT pRect;
   nRet = LeadBitmap.Load(MAKE_IMAGE_PATH(TEXT("image2.dcm")), 0,ORDER_BGR);
   if(nRet !=SUCCESS)
      return nRet;
   pRect.left     = 50;
   pRect.top      = 50;
   pRect.right    = 125;
   pRect.bottom   = 65;
   nRet = LeadBitmap.AutoSegment(&pRect, 0);
   if(nRet !=SUCCESS)
      return nRet;
   return SUCCESS;
}