RenderImage and LUT

169 views
Skip to first unread message

Sander Dekker

unread,
Feb 15, 2017, 4:32:08 AM2/15/17
to Fellow Oak DICOM
I have a DICOM image that I need to save as bitmap for image analysis. I am using fo DICOM 3.0.0.0 and VB.net 4.5.2. Before, I used to use OFFIS DCMTK dcmj2pnm to convert DICOM to bitmap. When I save bitmaps using dcmj2pnm, the background has pixel value 0 according to ImageJ. When I use RenderImage as bitmap and then analyse the output bmp with ImageJ, the background has pixel value 1. The renderoptions are default: 

RescaleIntercept: 0
RescaleSlope: 1
VOILUTFunction: LINEAR

The colorMap tells me that it is completely linear (0 = 0, 1 = 1, etc). 

Please see the attached DICOM image. This is my code:

Dim dcmImported As New DicomImage(e.Argument.ToString)
Dim bmpSlice As Bitmap = dcmImported.RenderImage(0).As(Of Bitmap)()

bmpSlice.Save("C:\Users\sdekker\Documents\IQ\Samples\fodicom\dcm.bmp")


Why does it produce a bitmap image with a different output than dcmj2pnm?

Thanks for your input!
EXP0018

Anders Gustafsson Cureos AB

unread,
Feb 15, 2017, 6:01:14 AM2/15/17
to fo-d...@googlegroups.com
I have looked at this image, and the problem is how the LUT is calculated based on the image data. According to the image specifications, the Window Center is set to 127 and width 256. The LUT is then calculated 128 components before 127, and 128 components starting at 127, which will effectively mean that the data range [-1,254] is assigned greyscale colors [0,255], i.e. a color shift of 1. If the center is changed to 128 in the DICOM image, colors will be correctly assigned.

I would like some more input from the community whether fo-dicom should interpret Window Center differently to ensure that colors are assigned as expected in cases like these. To facilitate the discussion, please feel free to report this problem on the repository's Issues page, here.

Best regards,
Anders @ Cureos

Anders Gustafsson Cureos AB

unread,
Feb 15, 2017, 7:25:57 AM2/15/17
to Fellow Oak DICOM
I have created a Github issue based on this post here. Please continue this discussion on Github.
Reply all
Reply to author
Forward
0 new messages