ImageGear for C and C++ on Windows v20.1 - Updated
MED_IP_min_max
API Reference Guide > MD Component API Reference > MD Component Functions Reference > Image Processing Functions > MED_IP_min_max

This function scans an 8- or 16-bit grayscale image and returns the raw minimum and maximum pixel values and the "is signed" flag.

Declaration:

 
Copy Code
AT_ERRCOUNT ACCUAPI MED_IP_min_max(
        const HIGEAR hIGear, 
        const LPAT_RECT lpRect, 
        LPLONG lpMin, 
        LPLONG lpMax, 
        LPBOOL lpSigned
);

Arguments:

Name Type Description
hIGear const HIGEAR The HIGEAR handle of the image to scan.
lpRect const AT_RECT Use this AT_RECT structure to specify the rectangular portion of the image to scan. Please see the ImageGear User's Manual if you are unfamiliar with this structure.
lpMin LPLONG A far pointer to a LONG which returns the value of the minimum pixel value in the region that was "scanned".
lpMax LPLONG A far pointer to a LONG which returns the value of the maximum pixel value in the region that was "scanned".
lpSigned LPBOOL A far pointer to a BOOL which returns the status of the image sign. TRUE means the image is signed.

Return Value:

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

Supported Raster Image Formats:

Grayscale – 8…16 bpp.

Example:

 
Copy Code
HIGEAR hIGear;
AT_ERRCOUNT nErrcount;
AT_RECT rcROI;
LONG lMin, lMax;
BOOL bSigned;
nErrcount = MED_IP_min_max(hIGear, &rcROI, &lMin, &lMax, &bSigned);

Remarks:

If the image is 16-bit signed, then the returned values are also signed.

Note that this function returns the min and max raw pixel values. That is, the returned values are not corrected using the Modality LUT (Rescale Slope/Intercept) values. To apply this correction to the min and max values that you get from MED_IP_min_max() call the function MED_DCM_DS_Rescale_get() which will return you the values of Rescale Slope and Rescale Intercept. Then use the following formulas:

min_corrected = (min_raw * rescale_slope) + rescale_intercept;

max_corrected = (max_raw * rescale_slope) + rescale_intercept;

When a 16-bit grayscale image is "unsigned" it has pixel values between 0 and 65,000. If a 16-bit image is "signed" it has pixel values between -32k and +32k. By the same rule, when an 8-bit grayscale image is "unsigned" it has pixel values between 0-255. If an 8-bit image is "signed", it has pixel values between -128 and +127. Some modalities of DICOM use signed images. So if you know whether the image is signed or unsigned will help you to interpret the minimum and maximum values.

For 17-32 bits per pixel images, please use MED_IP_min_max_64().

Is this page helpful?
Yes No
Thanks for your feedback.