Welcome Guest! To enable all features, please Login or Register.

Notification

Icon
Error

Options
View
Last Go to last post Unread Go to first unread post
#1 Posted : Wednesday, November 10, 2010 4:04:16 AM(UTC)

Amit  
Amit

Groups: Registered
Posts: 101


Hi,
I am using LT 14 with VB6 (NOT .NET)
I have a similler requirement.
I am working with 16 bit grayscale TIFF images only.
I want to get current WL value of tiff image. I am calculating the width and center first time as per your suggestion. I am calculating it based on the bpp to set the width as the maximum width and then deviding that by two in order to get the center.
But if user change the WL and save the image and load the image next time, I want to load the changed WL values.
Please suggest how can I achieve this using lead tools.

Waiting for your reply.
 

Try the latest version of LEADTOOLS for free for 60 days by downloading the evaluation: https://www.leadtools.com/downloads

Wanna join the discussion? Login to your LEADTOOLS Support accountor Register a new forum account.

#2 Posted : Wednesday, November 10, 2010 6:17:03 AM(UTC)

Adam Boulad  
Guest

Groups: Guests
Posts: 3,034

Was thanked: 2 time(s) in 2 post(s)

You already created a new forum thread regarding this issue (link below). Please continue discussing this issue in that thread and don't open more than one forum thread regarding the same issue.
http://support.leadtools.com/SupportPortal/CS/forums/36198/ShowPost.aspx
 
#3 Posted : Wednesday, November 10, 2010 7:48:54 PM(UTC)

Amit  
Amit

Groups: Registered
Posts: 101


Hi Adam,
Actually, these two are different issues.
This post is about READING existing WL values for TIFF image.
The another post is about APPLYING best possible WL values to TIFF images AUTOMATICALLY.
 
#4 Posted : Thursday, November 11, 2010 6:17:30 AM(UTC)

Adam Boulad  
Guest

Groups: Guests
Posts: 3,034

Was thanked: 2 time(s) in 2 post(s)

When you perform window leveling on a 16-bit grayscale image and then save it as 16-bit gray TIFF, the LUT is automatically saved in the file and it gets loaded the next time you load the TIFF file into LEADTOOLS.
If this does not answer your question, please send me the following details:
1. A sample TIFF file that contains WL values.
2. Detailed description of the expected values you want to load from the TIFF file.

Please include your attachments in a ZIP or RAR file. Also, you can either post it here or send it to support@leadtools.com and mention this post.
When attaching to the forums, do not use the "Preview" feature.
 
#5 Posted : Thursday, November 11, 2010 8:13:57 PM(UTC)

Amit  
Amit

Groups: Registered
Posts: 101


Hi,
I think I donot need to attach any image. You can use any 16 bit grayscale tiff image. I am not sure what you mean by "A saple TIFF file that contains WL values."
TIF file donot contain WL Tag or something as that of in DICOM.
I want to get WL values from may be pixel data or histogram or LUT or something.
I donot know exact way how to do it, thats why I posted the question here.

About your second point, I want to get current WL values for this TIF image.
Let me give you an example of DICOM file. We open the dicom file, read the WL values from respective tags and display those values on our GUI or use those in any other way we want.
If user changes the WL values and save the DICOM file, the new values are again saved in tags and loaded next time the image is loaded.

I want to achieve similler thing with TIF file. But I donot want to save the current WL values in database, file or TIF file tags. It will be very good if I am able to calculate those values from image data already available (pixel data, histogram, LUT etc).
 
#6 Posted : Sunday, November 14, 2010 5:47:54 AM(UTC)

Adam Boulad  
Guest

Groups: Guests
Posts: 3,034

Was thanked: 2 time(s) in 2 post(s)

Amit,
When you apply display-only window leveling on a 16-bit grayscale image (without modifying the pixel data), the only thing that changes is the display lookup table (LUT) of that image.
Our toolkit has the ability to save the LUT with the TIFF file, so that when you load the image again, you get the same LUT and therefore the same Window Leveling effect.

You can do this using our Main OCX 14 control as follows:
============================
LEAD1.Load "Grayscale16bit.tif", 0, 1, 1
LEAD1.WindowLevelBitmap = False
'Use all bits
LEAD1.LevelLowBit = 0
LEAD1.LevelHighBit = LEAD1.BitmapBits - 1

LEAD1.GetMinMaxBits
LEAD1.GetMinMaxVal

LEAD1.AutoRepaint = False
'Set LUT so the range is from pure blue to pure red
For i = LEAD1.MinVal To LEAD1.MaxVal
    LEAD1.LevelLUT(i) = RGB(i Mod 256, 0, 256 - i Mod 256)
Next i
LEAD1.Save "Gray16LutModified.tif", FILE_TIF, 16, 0, SAVE_OVERWRITE
============================

This code will apply a blue-red gradient window level to the bitmap's lookup table (LUT) without modifying the grayscale pixel data. It will then save the image as 16-bit grayscale Tiff, which can then be loaded using LEADTOOLS with the LUT automatically applied upon loading.
Of course, you can set any LUT, not just this gradient in the sample.

This means the saved LUT is stored with the TIFF file which represents the 'current window level' values you applied to the image.
 
#7 Posted : Tuesday, November 16, 2010 12:01:57 AM(UTC)

Amit  
Amit

Groups: Registered
Posts: 101


Hi,
Following is the download link for sample project with sample image.
[link deleted per user request]

PLEASE DELETE THIS LINK AFTER YOU DOWNLOAD THIS FILE.

Please follow the steps bellow :-
- Open and run the VB6 project.
- Image will be loaded with default WL values.
- You can see the current WL values (W=16383 AND C=0) in text boxes at bottom.
- Change the WL values in the text boxes at the bottom (W=14000 AND C=1000), and click on Apply button.
- This will apply new WL values to the image and will save the image.
- Now close the application.
- Open the application again.
- The text boxes should show new WL values (W=14000 AND C=1000) instead of old (W=16383 AND C=0).

Please modity the project as needed and post it here for my help.
 
#8 Posted : Thursday, November 18, 2010 1:57:13 AM(UTC)

Amit  
Amit

Groups: Registered
Posts: 101


I am waiting for your reply on this.
 
#9 Posted : Friday, November 19, 2010 1:33:35 PM(UTC)

jigar  
Guest

Groups: Guests
Posts: 3,034

Was thanked: 2 time(s) in 2 post(s)

Sorry for the delay, we are short handed this week so the work load has been high.  We have downloaded the file and we will get back to you asap.

Thank you for your patience.
 
#10 Posted : Sunday, November 21, 2010 6:48:29 AM(UTC)

Adam Boulad  
Guest

Groups: Guests
Posts: 3,034

Was thanked: 2 time(s) in 2 post(s)

Amit,
Your code tries to read a window level and window center values from the TIFF file, which are not stored in the file.
Instead, the TIFF file stores a complete table, so to read it, you must loop from zero to (LEADRasterView1.Raster.LevelLUTLength - 1) and read all the values of the LEADRasterView1.Raster.LevelLUT(index) values.
The index in this case will have a range from 0 to 65535, not just 0 and 1 like your code uses it.

To apply a modified Window Level, you must also modify all values of LEADRasterView1.Raster.LevelLUT(index) for all index values. Also, do not call the LEADRasterView1.WindowLevel method because you only want to change the display, which is done automatically after you fill the LevelLUT() array.
 
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.

Powered by YAF.NET | YAF.NET © 2003-2020, Yet Another Forum.NET
This page was generated in 0.073 seconds.