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 : Thursday, January 22, 2009 1:19:54 AM(UTC)

tigana  
tigana

Groups: Registered
Posts: 21



Hello,

I'm using  LeadTools 15 C#.
While opening  a Dicom Dataset wa can apply automaticly the Modality LUT, teh VoiLUT.
But is it possible to Get the Presentaion Lut, and apply it to the image ?

Thank you.


 

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 : Sunday, January 25, 2009 4:20:48 AM(UTC)

Adam Boulad  
Guest

Groups: Guests
Posts: 3,022

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

You can request the Print SCP to create a Presentation LUT SOP Instance using the CreatePresentationLut Method.
 
#3 Posted : Thursday, January 29, 2009 5:03:25 AM(UTC)

tigana  
tigana

Groups: Registered
Posts: 21


Hello,
i think my question was not clear.

I'm developping a Print SCP. When i receive a dicom data set from Print SCU containing a presentation LUT :
 - how can i do to get the presentation Lut Data?
 - then how can i do to apply this presentation Lut to a raster image?

thanks.

 
#4 Posted : Sunday, February 1, 2009 5:24:29 AM(UTC)

Adam Boulad  
Guest

Groups: Guests
Posts: 3,022

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

To get the presentation LUT data, you need to:
1. Get the tag for the Presentation LUT Sequence.  Beneath that will be the LUT Data tag (there can be multiple instances of this tag, so that's why he needs to get the sequence first).
Details about the Presentation LUT module can be found in Part 3 section C.11.4 of the DICOM specifications.

2. For setting the LUT, you should create an array of RasterColors according to the rules and data you get from the Dataset and then set it with RasterImage.SetLookupTable method.

 
#5 Posted : Monday, February 2, 2009 6:08:12 AM(UTC)

tigana  
tigana

Groups: Registered
Posts: 21


Hello,

Thanks for your answer.

I tried two manners to apply the Lut Sequence on the image.

- First one, using RasterImage.SetLookupTable

- Second one using RasterImage.WindowLevel(RasterImage.LowBit, RasterImage.HighBit, Lut,
RasterWindowLevelMode.Paint); where Lut is an Array of RasterColor[].

It gives me exactly the same result. But It seems to be wrong.

You will find in the Attachment a Dicom image, with a Dicom file containing the Lut
Sequence and the Jpg result. Can you tell if you obtain the same result?

Here is the Code :

private RasterImage OpenDataset(string file)
{
RasterImage image = null;
DicomElement element = null;
int bitmapCount = 0;

ds.Load(@"C:\HG_49774e3c651ac7c5.dcm", DicomDataSetLoadFlags.None);
element =
ds.FindFirstElement(null, DicomTagType.PixelData, true);
if (element != null)
{

bitmapCount = ds.GetImageCount(element);
if (bitmapCount > 0)
{
if (bitmapCount == 1)
{


if (element != null)

{

image = ds.GetImage(element, 0, 0, RasterByteOrder.Rgb,
DicomGetImageFlags.AutoApplyVoiLut |

DicomGetImageFlags.AutoApplyModalityLut
|

DicomGetImageFlags.AutoLoadOverlays |

DicomGetImageFlags.None);

}
}
}
}


StringCollection LutData = null;
DicomDataSet dsLut = new
DicomDataSet();
dsLut.Load(@"C:\SP_49774e3c651ac7c5.dcm", DicomDataSetLoadFlags.None);
if (dsLut != null)
{
if (Utils.IsTagPresent(dsLut,
DicomTagType.PresentationLutContentSequence))
{
RasterColor[] Lut = null;
if (Utils.IsTagPresent(dsLut,
DicomTagType.PresentationLutSequence))
{

string LutExplanation = Utils.GetStringValue(dsLut, DicomTagType.LutExplanation);

StringCollection LutDescriptor = Utils.GetStringValues(dsLut, DicomTagType.LutDescriptor);

LutData = Utils.GetStringValues(dsLut,
DicomTagType.LutData);

Lut = new RasterColor[LutData.Count
* 3];

for (int
i = 0; i < LutData.Count; i++)

{

Lut.SetValue((object)(new RasterColor(Convert.ToInt32(LutData[i]), Convert.ToInt32(LutData[i]), Convert.ToInt32(LutData[i]))), i);

}
}
if (image != null
&& Lut != null && Lut.Length
> 0)
{

//Methode 1 -------------------------

//image.SetLookupTable(Lut);


//Methode 2 -------------------------

//image.WindowLevel(image.LowBit,
image.HighBit, Lut, RasterWindowLevelMode.Paint);
}
}
}
return
image;
}


thanks.
File Attachment(s):
TestLut.zip (268kb) downloaded 33 time(s).

Edited by moderator Thursday, November 3, 2016 12:48:21 PM(UTC)  | Reason: Not specified

 
#6 Posted : Wednesday, February 4, 2009 7:48:39 AM(UTC)

Adam Boulad  
Guest

Groups: Guests
Posts: 3,022

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

I have noticed two things in your code:
1. You are creating a LUT that is 4096*3. You should change the length to 4096 instead of multiplying it by three.
2. You are not interpolating the values of the LUT into gray values. Windows can only display 256 shades of gray, which is why window leveling was created in the first place.
Since there are more than 256 intensity values in his image, you need to interpolate the values into grayscale values. When you fill the LUT, divide by 16 to convert the values from the range of 12 bit to the 8-bit.
 
#7 Posted : Friday, February 6, 2009 1:20:29 AM(UTC)

tigana  
tigana

Groups: Registered
Posts: 21


Thanks a lot.
It works very well.
Bye
 
#8 Posted : Wednesday, March 11, 2009 3:50:10 AM(UTC)

tigana  
tigana

Groups: Registered
Posts: 21


Hello, I now, can apply the presentation lut to the image.
But I seem to do it not right.
Here I let you a LUT.zip file, with a dicom file, a lut dicom file, and the preview of what result we have when we apply that lut to the image.

Every time we apply the LUT to the dicom image it gives different results.
Can you look at that please, and tell me what I do wrong?

Thank you
PS: the function I use to apply the LUT is "SetLookupTable".
File Attachment(s):
LUT.zip (99kb) downloaded 33 time(s).
 
#9 Posted : Thursday, March 12, 2009 8:29:31 AM(UTC)

Adam Boulad  
Guest

Groups: Guests
Posts: 3,022

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

What is the build number (version info) of the 'Leadtools.dll' and 'Leadtools.Dicom.dll'?
Does this happen with all files or only specific ones (like the one attached)?
Also, are you using the same project and code logic that we were working on the previous posts? If you modified anything, please send me updated code.
 
#10 Posted : Friday, March 13, 2009 12:10:20 AM(UTC)

tigana  
tigana

Groups: Registered
Posts: 21


The version of Leadtools.dll and Leadtools.Dicom.dll is the 15.
The logic is the same, I get the Lut table, if it's one of a size of 4096 I reduce it to a 256 one.
And then "Image.SetLookupTable(Lut);"

So what could be the problem?
 
#11 Posted : Friday, March 13, 2009 12:11:11 AM(UTC)

tigana  
tigana

Groups: Registered
Posts: 21


And it occurs with all the files.
 
#12 Posted : Sunday, March 15, 2009 1:55:29 AM(UTC)

Adam Boulad  
Guest

Groups: Guests
Posts: 3,022

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

I suggest that you first try this issue with the latest patches.
The DLL build number (version history) can be obtained when you right-click the DLL and choose properties (see attached image). If the build number that you have of the Leadtools.Dicom.dll is older than 15.0.1.23, contact support@leadtools.com and provide your serial number to obtain the latest patches.
If this build number you have, let me know.
 
#13 Posted : Sunday, March 15, 2009 7:42:35 AM(UTC)

Adam Boulad  
Guest

Groups: Guests
Posts: 3,022

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

Attached image
Guest attached the following image(s):
DICOM_version.jpg
 
#14 Posted : Monday, March 16, 2009 7:17:33 AM(UTC)

tigana  
tigana

Groups: Registered
Posts: 21


Yes, I have a version number : 15.0.1.7, could it really be the problem?
Thank you.
 
#15 Posted : Tuesday, March 17, 2009 5:08:34 AM(UTC)

Adam Boulad  
Guest

Groups: Guests
Posts: 3,022

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

This issue might be solved using the latest patches, please send your serial number to support@leadtools.com and mention this post to obtain the latest patches.
 
#16 Posted : Wednesday, March 18, 2009 12:46:37 AM(UTC)

tigana  
tigana

Groups: Registered
Posts: 21


That's already done, I have the lastest patches, and there is exactly the same problem.

I don't know what I'm doing wrong...
 
#17 Posted : Thursday, March 19, 2009 1:35:12 AM(UTC)

tigana  
tigana

Groups: Registered
Posts: 21


I have the version 15.0.1.23, and it's the same problem.
 
#18 Posted : Thursday, March 19, 2009 7:21:07 AM(UTC)

Adam Boulad  
Guest

Groups: Guests
Posts: 3,022

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

I have checked this at my side and the line:
Utils.IsTagPresent(dsLut, DicomTagType.PresentationLutContentSequence)
uses incorrect tag. Instead of PresentationLutContentSequence, the item that exists in the data set is actually PresentationLutSequence

Also, the LUT contains 256 entries, which is not a valid LUT for use with 12 or 16-bit grayscale images.

 
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-2024, Yet Another Forum.NET
This page was generated in 0.266 seconds.