This topic and its replies were posted before the current version of LEADTOOLS was released and may no longer be applicable.
#1
Posted
:
Friday, March 4, 2011 2:42:58 AM(UTC)
Groups: Registered
Posts: 101
Hi,
I am using LT 14.5 with VB6.
I am applying WL on 16 bit grayscale dicom image.
There are only two colors specified; StartColor and EndColor.
I want to apply a color scheme to the image while applying WL.
The image (Print Screen from another application) is attached herewith.
I want to achieve simillar effect using LT.
Please advice.
#2
Posted
:
Friday, March 4, 2011 2:44:33 AM(UTC)
Groups: Registered
Posts: 101
The image was not attached in previous post.
Attaching the same image in Zip file herewith.
#3
Posted
:
Friday, March 4, 2011 7:37:43 AM(UTC)
Groups: Registered
Posts: 11
This should be simple to do with our toolkit. After you apply the window level (ApplyLinearVOILUT) to an image, bitmap LUT should be populated with RGB triplet having same gray value for each Red, Green and Blue entry. You can remap the gray value with the value in the desired color palette (Hot Iron) for the same palette entry. As for example, replace the RGB (36, 36, 36) gray in the LUT with ColorPalette(36).RGB value.
#4
Posted
:
Friday, March 4, 2011 7:05:47 PM(UTC)
Groups: Registered
Posts: 101
Hi,
Can you please post some sample code for VB6 ?
Thanks in advance.
#5
Posted
:
Sunday, March 6, 2011 6:15:05 AM(UTC)
Groups: Registered, Tech Support
Posts: 1,326
Was thanked: 1 time(s) in 1 post(s)
If you're using the Main OCX 14.5 or the Raster COM objects of the same version, you will need to use the following properties and methods:
1. Set LevelHighBit and LevelLowBit properties to define the lookup table size.
2. Loop through the LevelLUT(index) property, filling each item with the needed remap color.
3. Set the WindowLevelBitmap property to True to make the change permanent to the pixels of the bitmap (convert them from grayscale to color).
4. Call the WindowLevel method.
If you try that and face any problem, please send me the code you tried in a small project (NOT your full application) and also the source image you tried it with (not a screenshot).
Thanks,
Maen Badwan
LEADTOOLS Technical Support
#6
Posted
:
Wednesday, June 29, 2011 3:09:05 AM(UTC)
Groups: Registered
Posts: 101
Hi,
As per your suggestion above, I am trying to apply Blackbody palette.
Sample code I am using is attached herewith.
The effect is not exactly what is expected.
Expected output is included in zip file as a screen shot of other application.
Please suggest any suggestions if any in my code.
#7
Posted
:
Thursday, June 30, 2011 6:19:10 AM(UTC)
Groups: Registered, Tech Support
Posts: 1,326
Was thanked: 1 time(s) in 1 post(s)
Here is the VB6 code that I used for replacing the LUT with corresponding palette to implement W/L with color palette.
The Idea is W/L is not modifying the bitmap but generating different view of the same bitmap base on Window Width and Window Center. Please use the ApplyLinearVOILUT and replace the LUT entries using following logic:
+-------------+
Private Declare Function OleTranslateColor Lib "OLEPRO32.DLL" _
(ByVal OLE_COLOR As Long, ByVal HPALETTE As Long, _
pccolorref As Long) As Long
Private Const CLR_INVALID = -1
Private Function TranslateColor(ByVal oClr As OLE_COLOR, _
Optional hPal As Long = 0) As Long
' Convert Automation color to Windows color
If OleTranslateColor(oClr, hPal, TranslateColor) Then
TranslateColor = CLR_INVALID
End If
End Function
Private Sub ApplyColorLUT()
Dim i As Long
Dim lRGB As Long
If LEADRasterView1.Raster.BitmapBits > 8 And LEADRasterView1.Raster.IsGrayscale Then
i = 0
Do While i < LEADRasterView1.Raster.LevelLUTLength
lRGB = TranslateColor(LEADRasterView1.Raster.LevelLUT(i))
LEADRasterView1.Raster.LevelLUT(i) = lRGB And &HFF ' '_HotIronPalette(lRGB And &HFF)
i = i + 1
Loop
End If
End Sub
+-------------+
Thanks,
Maen Badwan
LEADTOOLS Technical Support
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.