How to Convert DICOM Image file to PNG file for display in a Webpage

All other questions regarding DCMTK

Moderator: Moderator Team

Post Reply
Message
Author
dave
Posts: 67
Joined: Fri, 2004-11-05, 18:20
Location: Houston, Texas, USA

How to Convert DICOM Image file to PNG file for display in a Webpage

#1 Post by dave »

Hello Everyone,

I downloaded the windows binary version of dcmtk and have been trying to convert a DICOM Image file into a PNG file for display on a webpage using the dcm2pnm.exe executable.

C:\>dcm2pnm.exe +Wm image13.dcm test.png

Although ImageMagic can display test.png, when I try to use it in a webpage, nothing gets displayed. For example, using the basic <img src=path/to/test.png> in an <html> document gives a small box with an x in it. Using the same code with a known good PNG image correctly displays the image.

The background for my question is that I am using PHP to build an intranet DICOM Structured Report and image converter and display application, which involves uploading files to the server, converting them using the binaries in the windows /bin directory of dcmtk, and then displaying. The SR part is finished but the image conversion part has me stumped.

If anyone has an idea, I would be much obliged.

dave :|

Jörg Riesmeier
ICSMED DICOM Services
ICSMED DICOM Services
Posts: 2217
Joined: Fri, 2004-10-29, 21:38
Location: Oldenburg, Germany

Re: How to Convert DICOM Image file to PNG file for display in a Webpage

#2 Post by Jörg Riesmeier »

Dave,
dave wrote:C:\>dcm2pnm.exe +Wm image13.dcm test.png
my first guess: did you simply forget to set option --write-png (+on)?

Joerg

dave
Posts: 67
Joined: Fri, 2004-11-05, 18:20
Location: Houston, Texas, USA

#3 Post by dave »

OOPS!!

Let me try that now.

Thanks for the quick response.

dave

dave
Posts: 67
Joined: Fri, 2004-11-05, 18:20
Location: Houston, Texas, USA

#4 Post by dave »

Yup. That did it. :oops:

Thank you very much, Jörg.

Post Reply

Who is online

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