Sets a Kaufmann region based on the color value at the specified point.
#include "ltwrappr.h"
L_INT LBitmap::SetKaufmannRgn (pProcessedBitmap,nRadius,nMinInput,nMaxInput, nRgnThreshold, ptRgnStart,bRemoveHoles, puPixelsCount, uCombineMode, uFlags = 0)
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.
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.
Value that specifies the images shadows to be mapped. This value is used internally to enhance the image prior to growing the region. Valid values ranges are:
Value that specifies the images highlights to be mapped. This value is used internally to enhance the image prior to growing the region. Valid values ranges are:
Value that specifies the stopping point for the region. Valid values ranges are:
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.
A flag that indicates whether to remove any holes present in the region thats 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 | Do not remove the region holes. |
Pointer to a variable to be updated with the number of pixels in the region created by this function.
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.
Reserved for future use. Must be 0.
Value | Meaning |
---|---|
SUCCESS | The function was successful. |
< 1 | An error occurred. Refer to Return Codes. |
This function gets the color value of the point, specified in ptRgnStart, in the bitmap referenced by this object. 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 pProcessedBitmap contains the data from this object's bitmap, enhanced using the internal enhancing procedures, and the resulting region. This region is drawn on the image in this object's bitmap, but the bitmap in this object 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:
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 puPixelsCount value for this first region.
Call the function once more to create a region for the second area. Save the puPixelsCount value for this second region.
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 LBase::EnableStatusCallback.
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 32-bit grayscale images. It returns the error code ERROR_GRAY32_UNSUPPORTED if a 32-bit grayscale image is passed to this function.
Brain Analysis Function - Before
Brain Analysis Function - After
View additional platform support for this Brain Analysis function.
Win32, x64.
L_INT LBitmap__SetKaufmannRgnExample()
{
POINT pt;
L_UINT uFirstPixelCount;
L_UINT uSecondPixelCount;
L_UCHAR szText[20] = "\0";
LBitmap Bitmap;
L_INT nRet = 0 ;
/* Load a bitmap at its own bits per pixel */
nRet = Bitmap.Load(MAKE_IMAGE_PATH(TEXT("Image3.dcm")),0,ORDER_BGRORGRAY,NULL,NULL) ;
if (nRet != SUCCESS)
{
MessageBox(NULL,TEXT("Failed to load image!"), TEXT("Load Failure"), MB_OK | MB_ICONERROR);
return nRet;
}
/* get the center of the bitmap */
pt.x = BITMAPWIDTH(Bitmap.GetHandle()) >> 1;
pt.y = BITMAPHEIGHT(Bitmap.GetHandle()) >> 1;
// Converting the bitmap into 8 bit gray scale bitmap
nRet =Bitmap.GrayScale() ;
if(nRet !=SUCCESS)
return nRet;
// apply the function in order to get the pixels count of the first region.
nRet =Bitmap.SetKaufmannRgn(NULL, 21, 54, 110, 13, pt, FALSE, (L_SIZE_T*)&uFirstPixelCount, L_RGN_SET) ;
if(nRet !=SUCCESS)
return nRet;
// apply the function once more.
nRet =Bitmap.SetKaufmannRgn(NULL, 29, 51, 229, 207, pt, TRUE, (L_SIZE_T*)&uSecondPixelCount, L_RGN_SET);
if(nRet !=SUCCESS)
return nRet;
// print the ratio between the first and the second region.
_gcvt_s((char*)szText,_CVTBUFSIZE,uFirstPixelCount * 1.0 / uSecondPixelCount, 3);
MessageBox(NULL,(TCHAR *)szText, TEXT("Ratio"), MB_OK | MB_ICONINFORMATION);
return 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