L_MultiScaleEnhancementBitmap

#include "l_bitmap.h"

L_INT EXT_FUNCTION L_MultiScaleEnhancementBitmap (pBitmap, uContrast, uEdgeLevels, uEdgeCoeff, uLatitudeLevels, uLatitudeCoeff, uFlags)

pBITMAPHANDLE pBitmap;

/* pointer to the bitmap handle */

L_UINT uContrast;

/* amount of contrast enhancement */

L_UINT uEdgeLevels;

/* number of levels used in edge enhancement */

L_UINT uEdgeCoeff;

/* degree of edge enhancement */

L_UINT uLatitudeLevels;

/* number of levels used in latitude reduction */

L_UINT uLatitudeCoeff;

/* degree of latitude reduction */

L_UINT uFlags;

/* flags that determine function behavior */

Enhances an image’s contrast, edges, and density range for use in Computed Radiography (CR), in a way that all relevant image features are rendered with an appropriate level of visibility. This function is available in the Medical toolkits.

Parameter

Description

pBitmap

Pointer to the bitmap handle on which the enhancements will be applied.

uContrast

Fraction of contrast enhancement applied to the image. Valid values range from 0 – 10000, which are interpreted as 0% - 100%. This value is internally divided by 10000. Greater values will produce stronger contrast.

uEdgeLevels

The number of levels that will be used for edge enhancement. Valid values are from 1 to the maximum number of levels of the image. MSE_DEFAULT will use the default number of levels (which is 3). This option will take effect only if the MSE_EDGEENH is set in the uFlags. Passing zero will return an error code.

uEdgeCoeff

The edge enhancement coefficient. This value will be internally divided by 100. Pass MSE_DEFAULT to use the default values (which is 170 interpreted as 1.7). This option will be used only if the MSE_EDGEENH is set in the uFlags. Any value (>= 0) is valid. A value of 100 will be interpreted as 1.0 and will keep the bitmap’s edges un-enhanced. Larger values will produce more visible edges. Smaller values will produce less visible edges. Practically, the enhancement levels out at 200000 (interpreted as 2000.0) – values bigger than that will not enhance the bitmap’s edges any more.

uLatitudeLevels

The number of levels that will be used for Latitude reduction. Valid values are from 1 to maximum number of levels of the image. You can also pass MSE_DEFAULT to use the default level value (which is 5). This option will be used only if the MSE_LATRED is set in uFlags. Passing zero will return an error code.

uLatitudeCoeff

The latitude reduction coefficient. This value will be internally divided by 100. Pass MSE_DEFAULT to use the default values (which is 140 interpreted as 1.4). This option will be used only if the MSE_LATRED is set in uFlags. Any value (>= 0) is valid. A value of 100 will be interpreted as 1.0 and will keep the bitmap’s latitude un-enhanced. Decreasing latitude makes the bitmap brighter, increasing latitude makes the bitmap dimmer. Practically, the enhancement levels out at 200000 (interpreted as 2000,0) – values bigger than that will not decrease the bitmap’s latitude any more.

uFlags

Flags that determine function behavior. You can specify none, one or both of the following values:

 

Value

Meaning

 

MSE_EDGEENH

[0x0010] Add edge enhancement option to the function. When this flag is set, the uEdgeLevels and uEdgeCoeff parameters will be used.

 

MSE_LATRED

[0x0020] Add latitude reduction option to the function. When this flag is set, uLatitudeLevel and uLatitudeCoeff will be used.

 

You must also specify one of the following values:

 

Value

Meaning

 

MSE_GAUSSIAN

[0x0000] Use Gaussian filter.

 

MSE_RESAMPLE

[0x0001] Use resample filter.

 

MSE_BICUBIC

[0x0002] Use bicubic filter.

 

MSE_NORMAL

[0x0003] Use normal filter.

Returns

SUCCESS

The function was successful.

< 1

An error occurred. Refer to Return Codes.

Comments

The function wraps techniques of image enhancements, such as contrast enhancement, edge enhancement and latitude reduction, for Computed Radiography (CR).

In multi scale enhancement, the image is decomposed into components or levels. Those components or levels that contain details will be enhanced separately from other components or levels.

This will improve the visualization for the subtle image features without the risk of losing information of other features.

To find the number of levels in any image follow this equation:

uMaxLevels = ceil( log( max(pBitmap->Width, pBitmap->Height)) / log(2));

The function will consider values larger than 10000 for uContrast as if they were 10000. If the user passed 0 then image contrast will not be improved.

Best results are obtained if uContrast is in the range of 15% ~ 30%. The larger the value the stronger the enhancement will be. Any stronger enhancement than 30% will reveal noise and no new enhancement will be noticed.

User can further enhance the image with:

edge enhancements (use MSE_EDGEENH) and/or

latitude reduction (use MSE_LATRED)

uEdgeLevels, uEdgeCoeff, uLatitudeLevels and uLatitudeCoeff are available for advanced users. Using MSE_DEFAULT would give the maximum enhancements. MSE_DEFAULT is defined as (L_UINT)–1

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.

It also can process the whole image or a region of the image. If a bitmap has a region, the effect is applied only to the region.

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

Functions:

L_ChangeBitmapContrast, L_ChangeBitmapIntensity, L_GammaCorrectBitmap, L_StretchBitmapIntensity, L_RemapBitmapIntensity, L_InvertBitmap, L_ChangeBitmapHue, L_ChangeBitmapSaturation, L_HistoEqualizeBitmap, L_FillBitmap, L_GetPixelColor, L_PutPixelColor, L_GetBitmapHistogram, L_WindowLevel, L_HistoContrastBitmap, L_AddWeightedBitmaps, L_MultiplyBitmap, L_SelectiveColorBitmap, L_AllocFTArray, L_ChangeHueSatIntBitmap, L_ColorReplaceBitmap, L_ColorThresholdBitmap, L_DirectionEdgeStatisticalBitmap, L_FFTBitmap, L_FreeFTArray, L_FTDisplayBitmap, L_FrqFilterBitmap, L_FrqFilterMaskBitmap, L_MathFunctionBitmap, L_SubtractBackgroundBitmap, L_UserFilterBitmap, L_AdaptiveContrastBitmap, L_ApplyMathLogicBitmap, L_ColorIntensityBalance, L_ColorizeGrayBitmap, L_ContBrightIntBitmap, L_DigitalSubtractBitmap, L_DynamicBinaryBitmap, L_EdgeDetectEffectBitmap, L_FunctionalLightBitmap, L_SelectBitmapData, L_ShiftBitmapData

Topics:

Raster Image Functions: Modifying Intensity Values

 

Removing Noise

Example

/* This example loads a bitmap and applies multiscale enhancement. */
BITMAPHANDLE LeadBitmap;   /* Bitmap handle to hold the loaded image. */

/* Load the bitmap, keeping the bits per pixel of the file */
L_LoadBitmap
 (TEXT("IMAGE1.CMP"), &LeadBitmap, sizeof(BITMAPHANDLE), 0, ORDER_BGRORGRAY, NULL, NULL); 

// Apply multiscale enhancement
L_MultiScaleEnhancementBitmap
(&LeadBitmap, 2000, 4, MSE_DEFAULT , 00, MSE_GAUSSIAN | MSE_EDGEENH);