#include "Ltimgcor.h"
L_LTIMGCOR_API L_INT L_ShrinkWrapTool(pBitmap, nThreshold, ptCenter, nRadius, uFlags)
pBITMAPHANDLE pBitmap; |
pointer to the bitmap handle |
L_INT nThreshold; |
segmentation threshold |
POINT ptCenter; |
center of the rectangular or circular search area |
L_INT nRadius; |
radius of the rectangle/circle to be segmented |
L_UINT uFlags; |
flags that specify the shape to be used |
Automatically segments a rectangular or circular area in the specified image using the specified threshold.
Parameter | Description | |
pBitmap | Pointer to the bitmap handle. | |
nThreshold | Threshold used in the segmentation process. Possible grayscale values range from 0 to 255. The default value is 50. | |
ptCenter | Center of the rectangle or circle used to segment the object inside. All points inside the search area will be segmented. | |
nRadius | Radius of the rectangular or circular search area, in pixels. Do not exceed the length of the image diagonal. (If nRadius exceeds the length of the image diagonal, the value is adjusted to fit inside the image.) | |
uFlags | Flags that specify the shape to be used. Possible values are: | |
Value | Meaning | |
SHRINK_CIRCLE | [0x00000008] Start shrinking from a circular-shaped region. | |
SHRINK_RECT | [0x00000010] Start shrinking from a rectangular-shaped region. |
SUCCESS |
The function was successful. |
< 1 |
An error occurred. Refer to Return Codes. |
The result is applied to the image as a region.
This function was designed specifically to segment regions of cancer clusters in CT/MRI images.
The nRadius parameter should not exceed the length of the image diagonal.
This command does not support 32-bit grayscale images.
This command supports signed/unsigned images.
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. |
Win32, x64, Linux.
Functions: |
L_LevelsetBitmapRgn, L_LambdaConnectedness, L_WatershedBitmap, L_KMeansBitmapSegmentation, L_GWireGetMinPath |
Topics: |
|
|
Creating a Bitmap Region |
#define MAKE_IMAGE_PATH(pFileName) TEXT("C:\\Users\\Public\\Documents\\LEADTOOLS Images\\")pFileName
L_INT ShrinkWrapToolExample(L_VOID)
{
L_INT nRet;
BITMAPHANDLE LeadBitmap; /* Bitmap handle to hold the loaded image. */
/* Load the bitmap, keeping the bits per pixel of the file */
nRet = L_LoadBitmap (MAKE_IMAGE_PATH(TEXT("IMAGE3.dcm")), &LeadBitmap, sizeof(BITMAPHANDLE), 0, ORDER_BGR, NULL, NULL);
if(nRet != SUCCESS)
return nRet ;
POINT Center ;
Center.x = 245 ;
Center.y = 230 ;
nRet = L_ShrinkWrapTool(&LeadBitmap, 60, Center, 10, SHRINK_RECT);
if(nRet !=SUCCESS)
return nRet;
nRet = L_SaveBitmap(MAKE_IMAGE_PATH(TEXT("Result.BMP")), &LeadBitmap, FILE_BMP, 24, 0, NULL);
if(nRet !=SUCCESS)
return nRet;
//free bitmap
if(LeadBitmap.Flags.Allocated)
L_FreeBitmap(&LeadBitmap);
return SUCCESS;
}
Raster .NET | C API | C++ Class Library | JavaScript HTML5
Document .NET | C API | C++ Class Library | JavaScript HTML5
Medical .NET | C API | C++ Class Library | JavaScript HTML5
Medical Web Viewer .NET