LevelLUT example for Access 2.0

This is also the example for MinVal property and MaxVal property.

The following example sets LevelLowBit and LevelHighBit to use all bits, gets the minimum and maximum bits and intensity values for the image, and then sets the LUT so that pixels with values in the minimum range are mapped to the color RED, while pixels with values in the maximum range are mapped to BLUE.

    Me![LEAD1].Object.AutoRepaint = False
    'use all bits
    Me![LEAD1].Object.LevelLowBit = 0
    Me![LEAD1].Object.LevelHighBit = Me![LEAD1].Object.BitmapBits - 1
    

    Me![LEAD1].Object.GetMinMaxBits
    Me![LEAD1].Object.GetMinMaxVal
    max = Me![LEAD1].Object.MaxVal
    min = Me![LEAD1].Object.MinVal

    'set LUT so that min range maps to RED and max range maps to BLUE
    For i = min To min + 100
     Me![LEAD1].Object.LevelLUT(i) = RGB(255, 0, 0)
    Next
    For i = max - 100 To max
     Me![LEAD1].Object.LevelLUT(i) = RGB(0, 0, 255)
    Next
    Me![LEAD1].Object.AutoRepaint = True