Setting palette color LUT data and attributes Example for Visual Basic
'This example will set the attributes and the data for a
'Palette Color Lookup Table
Dim lLUTIndex As Long
Dim iRet As Integer
Dim RedLUTData() As Long
Dim GreenLUTData() As Long
Dim BlueLUTData() As Long
Dim PaletteColorLUTAttributes As LPaletteColorLUTAttributes
Set PaletteColorLUTAttributes = LEADDICOM1.PaletteColorLUTAttributes
' Initialize Red Palette Color Lookup Table Descriptor (0028,1101)
PaletteColorLUTAttributes.RedLUTDescriptorFirstMapped = 0
PaletteColorLUTAttributes.RedLUTDescriptorEntryBits = 16
PaletteColorLUTAttributes.RedLUTDescriptorNumberOfEntries = &H10000
' Initialize Green Palette Color Lookup Table Descriptor (0028,1102)
PaletteColorLUTAttributes.GreenLUTDescriptorFirstMapped= 0
PaletteColorLUTAttributes.GreenLUTDescriptorEntryBits= 16
PaletteColorLUTAttributes.GreenLUTDescriptorNumberOfEntries= &H10000
' Initialize Blue Palette Color Lookup Table Descriptor (0028,1103)
PaletteColorLUTAttributes.BlueLUTDescriptorFirstMapped= 0
PaletteColorLUTAttributes.BlueLUTDescriptorEntryBits= 16
PaletteColorLUTAttributes.BlueLUTDescriptorNumberOfEntries= &H10000
ReDim RedLUTData(PaletteColorLUTAttributes.RedLUTDescriptorNumberOfEntries)
ReDim GreenLUTData(PaletteColorLUTAttributes.GreenLUTDescriptorNumberOfEntries)
ReDim BlueLUTData(PaletteColorLUTAttributes.BlueLUTDescriptorNumberOfEntries)
For lLUTIndex = 0 To (PaletteColorLUTAttributes.BlueLUTDescriptorNumberOfEntries - 1)
RedLUTData(lLUTIndex) = lLUTIndex
GreenLUTData(lLUTIndex) = lLUTIndex / 2
BlueLUTData(lLUTIndex) = lLUTIndex / 4
Next
' Delete all the elements that describe the "Palette Color Lookup Table".
iRet = LEADDICOM1.DeletePaletteColorLUT(0)
If (iRet <> 0) Then
MsgBox ("error")
Exit Sub
End If
' Set the new "Palette Color Lookup Table" attributes
iRet = LEADDICOM1.SetPaletteColorLUTAttributes (0)
If (iRet <> 0) Then
MsgBox ("error")
Exit Sub
End If
' Set Red Palette Color Lookup Table Data
iRet = LEADDICOM1.SetPaletteColorLUTData (RedLUTData, DICOM_PALETTE_COLOR_LUT_TYPE_RED, 0)
If (iRet <> 0) Then
MsgBox ("error")
Exit Sub
End If
' Set Green Palette Color Lookup Table Data
iRet = LEADDICOM1.SetPaletteColorLUTData (GreenLUTData, DICOM_PALETTE_COLOR_LUT_TYPE_GREEN, 0)
If (iRet <> 0) Then
MsgBox ("error")
Exit Sub
End If
' Set Blue Palette Color Lookup Table Data
iRet = LEADDICOM1.SetPaletteColorLUTData (BlueLUTData, DICOM_PALETTE_COLOR_LUT_TYPE_BLUE, 0)
If (iRet <> 0) Then
MsgBox ("error")
Exit Sub
End If