GetHistogramGray method (ILEADRasterProcess)

Visual Basic example

Visual C++ 5.0 example

Delphi 4 example

C++ Builder example

 

Syntax

short GetHistogramGray (ILEADRaster *pRaster);

Overview

Refer to Using Histograms.

Remarks

(Medical only) This method works only on 12-bit and 16-bit grayscale images. For all other images, use the GetHistogram method.

Intensity levels in a grayscale bitmap can range from 0 to( 216 – 1), depending on whether the image is 12-bit or 16-bit grayscale, and the LowBit and HighBit of the image. The LowBit and HighBit identify which bits in a 12-bit or 16-bit entry are used. The LowBit and HighBit can be obtained by calling the GetMinMaxBits method and then looking at the MinBit and MaxBitproperties.

Specifically, a histogram table for a 12-bit or 16-bit grayscale image will have 2(HighBit – LowBit + 1) entries.

After calling GetHistogramGray(), the HistogramGrayTable property is automatically sized and filled in with grayscale intensities.

For example, suppose you have a 16-bit grayscale image with LowBit = 2 and HighBit = 7. There are 2(7-2+1) = 64 possible grayscale intensities. The histogram table will therefore hold 64 entries. The number of entries in the HistogramGrayTable property can be found by examining the HistogramGrayTableSize property. The HistogramGrayTableSize property and the HistogramGrayTable property both can change after each call to the GetHistogramGray method. The number of grayscale values with bits 2 – 7 set to 0 can be found in HistogramGrayTable(0). The number of grayscale values with bit 2 set to 1 and bits 3 – 7 set to 0 can be found in HistogramGrayTable(1), and so on up to HistogramGrayTable(63). Since the low bit is 2 and the high bit is 7, bits 0, 1, and bits 8 – 15 must all be 0. Therefore, the values set in bits 2 – 7 determine the intensities present in the image. In the table below, the gray columns represent those bits that are always 0 for the image. The columns bit 7 through bit 2 represent possible settings for those bits. The last column gives the location within the HistogramGrayTable property of the number of grayscale values having the corresponding settings. For example, HistogramGrayTable(0) contains the number of grayscale values of intensity 0 (all bits set to 0). HistogramGrayTable(1) contains all the grayscale values with intensity 4 (the 2 bit position set to 1). HistogramGrayTable(2) contains all the grayscale values with intensity 8 (the 3 bit set to 1 and the remaining bits set to 0) and so on.

bits 8 – 15

bit 7

bit 6

bit 5

bit 4

bit 3

bit 2

bit 1

bit 0

count location in HistogramGrayTable

all 0s

0

0

0

0

0

0

0

0

HistogramGrayTable(0)

all 0s

0

0

0

0

0

1

0

0

HistogramGrayTable(1)

all 0s

0

0

0

0

1

0

0

0

HistogramGrayTable(2)

all 0s

0

0

0

0

1

1

0

0

HistogramGrayTable(3)

all 0s

0

0

0

1

0

0

0

0

HistogramGrayTable(4)

 

 

 

 

 

 

and so on

all 0s

1

1

1

1

1

1

0

0

HistogramGrayTable(63)

As another example, suppose you have a 16-bit grayscale image with LowBit = 0 and HighBit = 15. The number of entries in the table will be 216 = 65,536.

See Also

Elements:

HistogramGrayTable property, HistogramGrayTableSize property, GetHistogram method, HistogramTable property

Topics:

Raster Images: Using Histograms

 

Raster Images: Where the Region Preempts the Bitmap

 

Changing Brightness and Contrast