comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Reading DICOM images
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
Reading DICOM images [message #47102] Wed, 25 January 2006 03:40 Go to next message
holgi0251 is currently offline  holgi0251
Messages: 4
Registered: June 2004
Junior Member
Hi,

I am trying to process DICOM-images of human lung tissue from a Siemens
Multidetector CT-scanner. The gray-levels should range from -1000 HU to
something like +2000. When I read the image slices ("im =
read_dicom(filename, image_index=1) the grey levels are compressed to
the range 0 ... 255. The situation slightly improves, when I predefine
the variable by "im = fltarr(512,512)". But I still don´t get negative
graylevels.

Who can help?
Re: Reading DICOM images [message #47190 is a reply to message #47102] Wed, 25 January 2006 05:01 Go to previous messageGo to next message
Peter Clinch is currently offline  Peter Clinch
Messages: 98
Registered: April 1996
Member
holgi0251@lycos.de wrote:

> I am trying to process DICOM-images of human lung tissue from a Siemens
> Multidetector CT-scanner. The gray-levels should range from -1000 HU to
> something like +2000. When I read the image slices ("im =
> read_dicom(filename, image_index=1) the grey levels are compressed to
> the range 0 ... 255. The situation slightly improves, when I predefine
> the variable by "im = fltarr(512,512)". But I still don´t get negative
> graylevels.

There are a few possible Gotchas in there. First up, there's actually
no such thing as a "DICOM file": what DICOM specifies is what will come
over a network connection when you ask for an image. Most people,
understandably, store files as what would come over a connection in the
same order, but there's no need to.

You need to know what the file description says is specified. CT data
is often pulled in from the basic hardware as 12 bit unsigned integers
which gives you a 4K range but will obviously /not/ allow for negative
numbers. Because the data is inherently digital it's quite unlikely to
be in a floating point representation, and it is entirely likely the
actual stored value is an unsigned or always positive integer that
you'll need to window to get the right HU value.

You may need to do a little hacking to see what the data representation
really is. It's not /too/ hard to work through a DICOM header and look
around, but that does assume you're happy doing a bit of low level byte
to byte parsing.

Pete.
--
Peter Clinch Medical Physics IT Officer
Tel 44 1382 660111 ext. 33637 Univ. of Dundee, Ninewells Hospital
Fax 44 1382 640177 Dundee DD1 9SY Scotland UK
net p.j.clinch@dundee.ac.uk http://www.dundee.ac.uk/~pjclinch/
Re: Reading DICOM images [message #47191 is a reply to message #47102] Wed, 25 January 2006 12:27 Go to previous message
Mike[2] is currently offline  Mike[2]
Messages: 99
Registered: December 2005
Member
DICOM image data is stored as integers. To scale them to the
appropriate units, you can use the following function. (This will work
for any DICOM image)

function rescaled_dicom_image, filename
;; rescaled_dicom_image: load a single dicom image slice from filename
;; and rescale it with rescale slope and intercept.
dcm = obj_new('IDLffDICOM')
dcm->Reset
var = dcm->Read(filename)
rescale_slope = *(dcm->GetValue('0028'x,'1053'x))[0]
rescale_intercept = *(dcm->GetValue('0028'x,'1052'x))[0]
img = float(*(dcm->GetValue('7fe0'x,'0010'x))[0]) * rescale_slope +
rescale_intercept
obj_destroy, dcm
return, img
end

This will give you a properly scaled image for for almost all DICOM
data. I think that this is always in HU for CT image data, but YMMV on
that. For some modalities, you can find the units of the image values
as well. For example, for PET data, you can learn the units from the
NMI Units (0054,1001).
Re: Reading DICOM images [message #47197 is a reply to message #47102] Wed, 25 January 2006 06:37 Go to previous message
Jeff N. is currently offline  Jeff N.
Messages: 120
Registered: April 2005
Senior Member
See if this page tells you want you want:
http://www.dfanning.com/fileio_tips/hounsfield.html



holgi0251@lycos.de wrote:
> Hi,
>
> I am trying to process DICOM-images of human lung tissue from a Siemens
> Multidetector CT-scanner. The gray-levels should range from -1000 HU to
> something like +2000. When I read the image slices ("im =
> read_dicom(filename, image_index=1) the grey levels are compressed to
> the range 0 ... 255. The situation slightly improves, when I predefine
> the variable by "im = fltarr(512,512)". But I still don´t get negative
> graylevels.
>
> Who can help?
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Re: MODE in IDL?
Next Topic: 2D density plot *** hist_2d *** LARGE ARRAYS

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Wed Oct 08 13:06:59 PDT 2025

Total time taken to generate the page: 0.00392 seconds