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.
Edited by moderator Thursday, November 3, 2016 12:48:21 PM(UTC)
| Reason: Not specified