ApplyModalityLUT Example for Visual Basic

Function TestModalityLUT(ByVal bLinear As Boolean)
    Dim i As Long
    Dim RasVar As New LEADRasterVariant
    Dim RasterProc As New LEADRasterProcess
    Dim LUT(65536) As Long
   
    If (blinear) Then
       RasterProc.ApplyLinearModalityLUT LEADRasterView1.Raster, 0, 0.5, 0
    Else
       For i = 0 To 65535
          LUT(i) = i / 2
       Next I
   
       RasVar.Type = VALUE_ARRAY_LONG
       RasVar.ItemCount = 65535
      For i = 0 To RasVar.ItemCount -1
          RasVar.LongItemValue(i) = LUT(i)
       Next I
      
       RasterProc.ApplyModalityLUT LEADRasterView1.Raster, RasVar, 0, 0
    End If
End Function