Using dcmj2pnm to window & level VOI LUT

All other questions regarding DCMTK

Moderator: Moderator Team

Post Reply
Message
Author
Nylith
Posts: 2
Joined: Tue, 2007-10-30, 21:43

Using dcmj2pnm to window & level VOI LUT

#1 Post by Nylith »

I'm using dcmj2pnm as a back end to a web viewer that I'm writing. The php script shells out to the dcmj2pnm executable with arguments designed to do things like zoom/pan/window & level. I'm having trouble determining what the proper way to handle some images.

Some dicom images don't have VOI LUT information; instead they specify a window width and window center in the dicom header. If this is the case, I use those numbers as the starting point, and then adjust them when the user drags his mouse over the image. dcmj2pnm gladly takes the new window values with the +Ww argument. Everything works smoothly.

The problem comes when the images have VOI LUT information, but no default window width/center. I can generate an initial image just fine, using +Wn for example. However, if I the user wants to window & level the image, I have no base width/center to adjust and pass to dcmj2pnm via the +Ww argument.

My workaround at the moment is to just assume some arbitrary window width and center if one is not specified in the header. I can use that as a starting point for the user to adjust. However, the starting image is never going to look correct (like how +Wn might have it look), because it is obviously not the correct initial width & center.

Am I missing some obvious way to adjust "brightness & contrast" on an image with VOI LUT data? Is dcmj2pnm (or any of the dcmtk tools) able to do this, or would I need to employ some sort of image manipulation library after I've created the initial jpg? Is there a way to extract/calculate an equivalent window width/center to what +Wn generates in an output image?

Thanks for the help.

Marco Eichelberg
OFFIS DICOM Team
OFFIS DICOM Team
Posts: 1462
Joined: Tue, 2004-11-02, 17:22
Location: Oldenburg, Germany
Contact:

#2 Post by Marco Eichelberg »

You have simply stumbled over a limitation of the DICOM VOI LUT construct: LUTs are static, and there is no easy way to combine a VOI LUT with window center/width. You use either, but not both. You could, of course, determine lowest and the largest LUT value and compute a corresponding window center/width, but the only point of a VOI LUT is a non-linear function that cannot be emulated with window center/width. The application of a VOI LUT followed by window center/width is not defined behaviour in DICOM.

Nylith
Posts: 2
Joined: Tue, 2007-10-30, 21:43

#3 Post by Nylith »

Thanks for the response. My next question falls outside the realm of dcmtk, but maybe someone could help me.

How standalone dicom viewers (for example KPacs) treat this situation. They clearly load the information based on the LUT data, but then the program allows "window/level" manipulation. Are they computing some sort of center/width as you suggested, and then manipulating from there?

Per
Posts: 99
Joined: Mon, 2007-09-03, 10:53
Location: Trondheim, Norway
Contact:

#4 Post by Per »

I know one viewer applies the VOI LUT information from the DICOM file first (be it an actual table or just window settings), then applies its own window settings afterwards as a second operation. Though, I guess how you want to do this depends on the specific needs of your application.

Post Reply

Who is online

Users browsing this forum: Bing [Bot] and 1 guest