How to use dcmcjpeg to convert DICOM to JPEG?

0

The dcmcjpeg tool from the dcmtk package (sudo apt-get install dcmtk) is supposed to convert DICOM image files to JPEG.

But I suspect it still wraps the image in a DICOM container, because when I try, I get this:

> file 000010.*
000010.dcm: DICOM medical imaging data

> md5sum 000010.*
a64dee7fa9c9fb383c9aec833006f161  000010.dcm

> dcmcjpeg --verbose --encode-extended --quality 75 --huffman-optimize --bits-force-8 --monochrome 000010.dcm 000010.jpg
I: reading input file 000010.dcm
I: Convert DICOM file to compressed transfer syntax
I: Output transfer syntax JPEG Extended, Process 2+4 can be written
I: creating output file 000010.jpg
I: conversion successful

> file 000010.*
000010.dcm: DICOM medical imaging data
000010.jpg: DICOM medical imaging data

> md5sum 000010.*
a64dee7fa9c9fb383c9aec833006f161  000010.dcm
c3019b54640179805ab3912414b97936  000010.jpg

How can I fully extract the image from a DICOM file and convert it to a common format such as JPEG or PNG?

Stéphane

Posted 2019-10-30T07:49:51.250

Reputation: 201

I've also asked a similar question about converting from DICOM to PNG. If the questions are too similar, then this one can be closed as I'd prefer to know how to convert to PNG versus JPG. https://superuser.com/questions/1497370/how-to-convert-dicom-images-to-png

– Stéphane – 2019-10-30T09:39:23.917

Answers

0

Please use the tool dcmj2pnm:

This tool converts DICOM images to PGM/PPM, PNG, TIFF, JPEG or BMP

Here is a usage sample: dcmj2pnm --write-jpeg --min-max-window ST1-SE1.dcm foot-xray.jpg

Use the option " --min-max-window" for calculating the VOI window using min-max algorithm

HTH

Karuthedan

Posted 2019-10-30T07:49:51.250

Reputation: 33

I tried the dcmj2pnm tool. Similar results to the other tools discussed in that other linked question. It doesn't seem to correctly convert the image, though the --min-max-window parameter does improve things. – Stéphane – 2019-11-05T22:02:55.643