Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Converting dicom imge from 16 bit to 8 bit

1,582 views
Skip to first unread message

Mahesh

unread,
Jan 5, 2009, 4:53:22 AM1/5/09
to
Dear all;
I want to convert 16 bit gray scale dicom file to 8
bit. Is there any tool available which will carry out this task. Or
any clue how to do this. I am googling for this problem from last five
days but didnt get any clue.

Thanks in advance

Regards
Mahesh

Marco Eichelberg

unread,
Jan 5, 2009, 7:03:41 AM1/5/09
to Mahesh
Mahesh wrote:
> I want to convert 16 bit gray scale dicom file to 8
> bit. Is there any tool available which will carry out this task. Or
> any clue how to do this. I am googling for this problem from last five
> days but didnt get any clue.

if you want DICOM as output format, you could use DCMTK's dcmcjpeg and dcmdjpeg
tools - use dcmcjpeg to apply lossless JPEG compression while forcing the output
bit depth to 8 (dcmcjpeg --bits-force-8) and decompress the result using dcmdjpeg.
This certainly is a "kludge" but should do the job. The dcmcjpeg tool also provides
various command line options that control the conversion process (i.e., application
of a window level/width or VOI transformation prior to downscaling).

If you want JPEG, TIFF, PNM, PNG or the like, use DCMTK' dcmj2pnm tool, which
is intended exactly for that purpose and also provides a wealth of command line
options to control the conversion process.

Best regards,
Marco Eichelberg
OFFIS

Mahesh

unread,
Jan 5, 2009, 9:12:01 AM1/5/09
to
On Jan 5, 5:03 pm, Marco Eichelberg <eichelberg_nos...@offis.de>
wrote:


Thanks replying;
I had try dcmcjpeg and dcmdjpeg but the
resultant picture was not clear. Actually my requirement is I have to
convert dicom image to J2k (without dicom tag) I am accomplishing this
task by compressing image in jpeg lossy format and extracting pixel
data from it. For 8 bit image and color image it is working fine
(because no ww and wc is applicable). but for 16 bit image the viewer
is showing incorect image (because window width and window center
information is lost)

Please help me

Marco Eichelberg

unread,
Jan 5, 2009, 12:18:01 PM1/5/09
to

> Actually my requirement is I have to
> convert dicom image to J2k (without dicom tag)

Then I would suggest you use dcmj2pnm, export to a lossless format such as
TIFF, BMP or PNG and convert to JPEG 2000 from there, using JasPer for example.

> For 8 bit image and color image it is working fine
> (because no ww and wc is applicable). but for 16 bit image the viewer
> is showing incorect image (because window width and window center
> information is lost)

For 16 bit images, you have to select the wc/ww range **before** converting
to 8 bit - dcmj2pnm has a couple of command line options for this purpose:

VOI LUT transformation:
-W --no-windowing no VOI windowing (default)
+Wi --use-window [n]umber : integer
use the n-th VOI window from image file
+Wl --use-voi-lut [n]umber : integer
use the n-th VOI look up table from image file
+Wm --min-max-window compute VOI window using min-max algorithm
+Wn --min-max-window-n compute VOI window using min-max algorithm,
ignoring extreme values
+Wr --roi-min-max-window [l]eft [t]op [w]idth [h]eight : integer
compute ROI window using min-max algorithm,
region of interest is specified by l,t,w,h
+Wh --histogram-window [n]umber : integer
compute VOI window using Histogram algorithm,
ignoring n percent
+Ww --set-window [c]enter [w]idth : float
compute VOI window using center c and width w

Which option with which parameters of course depends on the image type,
body part etc. To get started, --min-max-window or --histogram-window 5
are not so bad in many cases.

Best regards,
Marco Eichelberg

Mathieu Malaterre

unread,
Jan 5, 2009, 8:27:51 PM1/5/09
to
On Jan 5, 3:12 pm, Mahesh <mdube...@gmail.com> wrote:
> On Jan 5, 5:03 pm, Marco Eichelberg <eichelberg_nos...@offis.de>
> wrote:
>
>
>
> > Mahesh wrote:
> > >                I want to convert 16 bit gray scale dicom file to 8
> > > bit. Is there any tool available which will carry out this task. Or
> > > any clue how to do this. I am googling for this problem from last five
> > > days but didnt get any clue.
>
> > if you want DICOM as output format, you could use DCMTK's dcmcjpeg and dcmdjpeg
> > tools - use dcmcjpeg to apply lossless JPEG compression while forcing the output
> > bit depth to 8 (dcmcjpeg --bits-force-8) and decompress the result using dcmdjpeg.
> > This certainly is a "kludge" but should do the job. The dcmcjpeg tool also provides
> > various command line options that control the conversion process (i.e., application
> > of a window level/width or VOI transformation prior to downscaling).
>
> > If you want JPEG, TIFF, PNM, PNG or the like, use DCMTK' dcmj2pnm tool, which
> > is intended exactly for that purpose and also provides a wealth of command line
> > options to control the conversion process.
>
> > Best regards,
> > Marco Eichelberg
> > OFFIS
>
> Thanks replying;
>                       I had try dcmcjpeg  and dcmdjpeg but the
> resultant picture was not clear. Actually my requirement is I have to
> convert dicom image to J2k (without dicom tag) I am accomplishing this

gdcmconv --j2k input.dcm output.dcm

You can then extract the pixel data using gdcmraw.

Ref:
http://apps.sourceforge.net/mediawiki/gdcm/index.php?title=Gdcmconv

HTH

Mahesh

unread,
Jan 6, 2009, 6:31:36 AM1/6/09
to
On Jan 6, 6:27 am, Mathieu Malaterre <mathieu.malate...@gmail.com>
wrote:
> HTH- Hide quoted text -
>
> - Show quoted text -

Thank you all for your precious guideline
I had successfully solve the problem

Regards
Mahesh

0 new messages