ImageGear for C and C++ on Windows v19.1 - Updated
MED_display_contrast_auto
API Reference Guide > MD Component API Reference > MD Component Functions Reference > Display Functions > MED_display_contrast_auto

This function automatically fills the 16x8 LUT of a 16-bit image loaded into ImageGear in order to optimize its displaying.

Declaration:

 
Copy Code
AT_ERRCOUNT ACCUAPI MED_display_contrast_auto(
        const HIGEAR hIGear, 
        const LPAT_RECT lpRect, 
        const DOUBLE rescale_slope, 
        const DOUBLE rescale_intercept,
        const DOUBLE gamma,
        const LONG lReserved_option, 
        LPLONG lpWindow_center, 
        LPLONG lpWindow_width
);

Arguments:

Name Type Description
hIGear const HIGEAR The HIGEAR handle to the image to convert.
lpRect const AT_RECT Use this AT_RECT structure to specify the rectangular portion of the image for which to optimize the contrast on; set to NULL for the whole image. Please see the ImageGear User's Manual if you are unfamiliar with this structure.
rescale_slope const DOUBLE Set to the value of the Data Element, Rescale Slope (0028,1053). You can use MED_DCM_DS_Rescale_get() to obtain this value. If this Data Element is not present in the Data Set, please set this value to 1.0.
rescale_intercept const DOUBLE Set to the value of the Data Element, Rescale Intercept (0028,1054). You can use MED_DCM_DS_Rescale_get() to obtain this value. If this Data Element is not present in the Data Set, please set this value to 0.0.
gamma DOUBLE Gamma correction for 16x8 Lookup Table. Set to 1.0 to turn the correction off.
lReserved_option const LONG Reserved for future use; please set to 0 for now.
lpWindow_center LPLONG A far pointer that returns a LONG for the Window Center; set to NULL if you don't need this information.
lpWindow_width LPLONG A far pointer that returns a LONG for the Window Width; set to NULL if you don't need this information.

Return Value:

Returns the number of ImageGear errors that occurred during the function call.

Supported Raster Image Formats:

Grayscale – 8…32 bpp.

Example:

 
Copy Code
HIGEAR hIGear;
DOUBLE          fRescaleSlope = 1.0;
DOUBLE          fRescaleIntercept = 1.0;
DOUBLE          fGama = 1.0;
LONG            WindowWidth;
LONG            WindowCenter;
MED_display_contrast_auto(hIGear, NULL, fRescaleSlope, 
                        fRescaleIntercept, fGamma, 0, &WindowCenter,  
                                                    &WindowWidth);

Remarks:

The rectangular portion of the image that you specify (or the whole image) is scanned and the maximum and minimum pixel values are determined; the Window Center and Width are calculated from these.

If the Rescale Slope and Intercept of the image are known, you should provide them. If they are not known, pass in a 1.0 and 0.0, respectively.

The Window Center and Width that this function computes are passed back to you in lpWindow_center and lpWindow_width, unless you set these arguments to NULL.

This function does not cause the image to be displayed or repainted. It only fills the 16x8 LUT. To display the results of this function, use IG_dspl_image_draw().

See also MED_display_contrast().

Since this function must scan the pixels for the minimum and maximum values, it takes more time to run than IG_display_contrast().