L_SetKaufmannRgnBitmap
#include "l_bitmap.h"
L_INT EXT_FUNCTION L_SetKaufmannRgnBitmap(pBitmap, pKaufmannProcBitmap, nRadius, nMinInput, nMaxInput, nRgnThreshold, ptRgnStart, bRemoveHoles, puPixelsCount, uCombineMode);
pBITMAPHANDLE pBitmap; |
/* pointer to a bitmap handle */ |
pBITMAPHANDLE pKaufmannProcBitmap; |
/* pointer to the processed bitmap handle */ |
L_INT nRadius; |
/* blur radius */ |
L_INT nMinInput; |
/* minimum leveling input */ |
L_INT nMaxInput; |
/* maximum leveling input */ |
L_INT nRgnThreshold; |
/* region threshold */ |
POINT ptRgnStart; |
/* region starting point */ |
L_BOOL bRemoveHoles; |
/* flag that indicates whether to remove holes */ |
/* pointer to a variable to be updated */ | |
L_UINT uCombineMode; |
/* action to take regarding the existing region */ |
Sets a Kaufmann region based on the color value at the specified point. This function is available in the Raster Pro and above toolkits.
Parameter |
Description |
|
pBitmap |
Pointer to the bitmap handle that references the bitmap. |
|
pKaufmannProcBitmap |
Pointer to a bitmap handle to be updated with the bitmap resulting from this function. This bitmap handle must be empty when this function is called. If this bitmap handle is not empty when this function is called, the function will return an error. |
|
nRadius |
Value that indicates the size of the neighborhood used for blurring each pixel of the bitmap. Blurring is performed internally to enhance the resulting image. |
|
nMinInput |
Value that specifies the image’s shadows to be mapped. This value is used internally to enhance the image prior to growing the region. Valid values range from 0 to 255 for 8-bit, 0 to 4095 for 12-bit and 0 to 65535 for 16-bit images. |
|
nMaxInput |
Value that specifies the image’s highlights to be mapped. This value is used internally to enhance the image prior to growing the region. Valid values range from 0 to 255 for 8-bit, 0 to 4095 for 12-bit and 0 to 65535 for 16-bit images. |
|
nRgnThreshold |
Value that specifies the stopping point for the region. Valid values range from 0 to 255 for 8-bit, 0 to 4095 for 12-bit and 0 to 65535 for 16-bit images. |
|
ptRgnStart |
A POINT structure that contains the starting point used to set the region. This function determines the color value of the pixel at this point in the bitmap referenced by pBitmap. Using this color as a starting point and the value specified in nRgnThreshold as a stopping point, the function "grows" a region. |
|
bRemoveHoles |
A flag that indicates whether to remove any holes present in the region that’s created internally. These holes are located inside the region, but are not included in the region. Possible values are: |
|
|
Value |
Meaning |
|
TRUE |
Remove the region holes. |
|
FALSE |
Don’t remove the region holes. |
puPixelsCount |
Pointer to a variable to be updated with the number of pixels in the region created by this function. |
|
uCombineMode |
The action to take regarding the existing bitmap region, if one is defined. For descriptions of the possible values, refer to Creating a Bitmap Region. |
Returns
SUCCESS |
The function was successful. |
< 1 |
An error occurred. Refer to Return Codes. |
Comments
This function gets the color value of the point, specified in ptRgnStart, in the bitmap referenced in pBitmap. Using this color value as a starting point and the value specified in nRgnThreshold as an ending point, this function grows a region. Since noise affects the region growing process, enhancement procedures, such as Gaussian blur, are performed prior to obtaining the color from the specified point and growing the region, to improve the process. When this function returns, the pKaufmannProcBitmap contains the data from pBitmap, enhanced using the internal enhancing procedures, and the resulting region. This region is drawn on the image in pBitmap, but pBitmap itself is not changed. The area of the resulting region can be used to calculate the Kaufmann ratio (size of the corpus callosum / size of the brain sphere).
To calculate the Kaufmann ratio do the following:
1. |
Call this function to create the first region, based on the appropriate area of the image. You will have to manipulate the parameters of the function to get the exact region you want. Save the puPixelCount value for this first region. |
2. |
Call the function once more to create a region for the second area. Save the puPixelCount value for this second region. |
3. |
Now calculate the ratio of the sizes of the two regions. |
For more information on how to calculate the brain ratio refer to the example below.
To update a status bar or detect a user interrupt during execution of this function, refer to L_SetStatusCallback.
This function supports 12 and 16-bit grayscale and 48 and 64-bit color images. Support for 12 and 16-bit grayscale and 48 and 64-bit color images is available only in the Document/Medical toolkits.
This function does not support signed data images. It returns the error code ERROR_SIGNED_DATA_NOT_SUPPORTED if a signed data image is passed to this function.
Required DLLs and Libraries
LTIMG 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
Windows 95 / 98 / Me, Windows 2000 / XP.
See Also
Example
L_VOID KaufmannVolumeAnalysis(HWND hWnd)
{
POINT pt;
L_UINT uFirstPixelCount;
L_UINT uSecondPixelCount;
L_UCHAR szText[20] = "\0";
BITMAPHANDLE Bitmap;
/* Load a bitmap at its own bits per pixel */
L_LoadBitmap("Image3.dic", &Bitmap, sizeof(BITMAPHANDLE), 0, ORDER_BGRORGRAY, NULL, NULL);
pt.x = BITMAPWIDTH(&Bitmap) >> 1;
pt.y = BITMAPHEIGHT(&Bitmap) >> 1;
// Converting the bitmap into 8 bit gray scale bitmap
L_GrayScaleBitmap(&Bitmap, 8);
// apply the function in order to get the pixels count of the first region.
L_SetKaufmannRgnBitmap(&Bitmap, NULL, 21, 54, 110, 13, pt, FALSE, &uFirstPixelCount, L_RGN_SET);
// apply the function once more.
L_SetKaufmannRgnBitmap(&Bitmap, NULL, 29, 51, 229, 207, pt, TRUE, &uSecondPixelCount, L_RGN_SET);
// print the ratio between the first and the second region.
_gcvt(uFirstPixelCount * 1.0 / uSecondPixelCount, 3, szText);
MessageBox(hWnd, szText, "Ratio", MB_OK);
}