LevelLUT example for C++ 5.0 and later

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

The following example sets LevelLowBit and LevelHighBit to use all bits. It then gets the minimum and maximum bits and intensity values for the image, and 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.

    long min;
    long max;
    long i;

    m_LEADRasterView1.SetAutoRepaint(FALSE);
    //use all bits
    m_LEADRasterView1.GetRaster().SetLevelLowBit(0);
    m_LEADRasterView1.GetRaster().SetLevelHighBit(m_LEADRasterView1.GetRaster().GetBitmapBits() - 1);

    m_LEADRasterView1.GetRaster().GetMinMaxBits();
    m_LEADRasterView1.GetRaster().GetMinMaxVal();
    max = m_LEADRasterView1.GetRaster().GetMaxVal();
    min = m_LEADRasterView1.GetRaster().GetMinVal();

    //set LUT so that min range maps to RED and max range maps to BLUE
    for( i=min; i<min+100; i++ )
        m_LEADRasterView1.GetRaster().SetLevelLUT(i, RGB(255, 0, 0));
    for( i=max-100; i<max; i++ )
        m_LEADRasterView1.GetRaster().SetLevelLUT(i, RGB(0, 0, 255));

    m_LEADRasterView1.SetAutoRepaint(TRUE);