I installed dcmtk just fine. I am able to use img2dcm on any random jpg image and convert to a dcm file. But when I use dcmj2pnm to convert a dcm image into jpeg, then try to convert that image back to jpeg, I get this error message - F: Error converting file: Not a JPEG file
The jpeg image I converted is perfectly fine. I am able to open it up using Mac preview. I also tried the +on2 option to make the jpeg 16 bit, but the same result.
is there some option I have to specify?
img2dcm says F: Error converting file: Not a JPEG file
Moderator: Moderator Team
Re: img2dcm says F: Error converting file: Not a JPEG file
--write-jpeg option seems to do the trick. However, this converts the image into 8 bits and the pixel depth is lost.
I can add the +on2 option and get a 16 bit jpeg image, however, I can find no way to convert the jpeg back to dicom. It always says F: Error converting file: Not a JPEG file.
Does any one know how to achieve this?
I can add the +on2 option and get a 16 bit jpeg image, however, I can find no way to convert the jpeg back to dicom. It always says F: Error converting file: Not a JPEG file.
Does any one know how to achieve this?
-
- DCMTK Developer
- Posts: 1962
- Joined: Fri, 2004-11-05, 13:47
- Location: Oldenburg, Germany
- Contact:
Re: img2dcm says F: Error converting file: Not a JPEG file
Hi,
dcmj2pnm cannot write 16 bit JPEG (I think), option +on2 is short for --write-16-bit-png i.e. it will write PNG files.
Best regards,
Michael
dcmj2pnm cannot write 16 bit JPEG (I think), option +on2 is short for --write-16-bit-png i.e. it will write PNG files.
Best regards,
Michael
-
- DCMTK Developer
- Posts: 2421
- Joined: Tue, 2011-05-03, 14:38
- Location: Oldenburg, Germany
- Contact:
Re: img2dcm says F: Error converting file: Not a JPEG file
No, +on2 creates a PNG image with 16 bits per sample. Here's the relevant excerpt from the dcmj2pnm manpage:I can add the +on2 option and get a 16 bit jpeg image
Code: Select all
image format:
+op --write-raw-pnm write 8-bit binary PGM/PPM (default for files)
+opb --write-8-bit-pnm write 8-bit ASCII PGM/PPM (default for stdout)
+opw --write-16-bit-pnm write 16-bit ASCII PGM/PPM
+opn --write-n-bit-pnm [n]umber: integer
write n-bit ASCII PGM/PPM (1..32)
+ob --write-bmp write 8-bit (monochrome) or 24-bit (color) BMP
+obp --write-8-bit-bmp write 8-bit palette BMP (monochrome only)
+obt --write-24-bit-bmp write 24-bit truecolor BMP
+obr --write-32-bit-bmp write 32-bit truecolor BMP
+ot --write-tiff write 8-bit (monochrome) or 24-bit (color) TIFF
+on --write-png write 8-bit (monochrome) or 24-bit (color) PNG
+on2 --write-16-bit-png write 16-bit (monochrome) or 48-bit (color) PNG
+oj --write-jpeg write 8-bit lossy JPEG (baseline)
-
- OFFIS DICOM Team
- Posts: 1379
- Joined: Tue, 2004-11-02, 17:22
- Location: Oldenburg, Germany
- Contact:
Re: img2dcm says F: Error converting file: Not a JPEG file
To add to what my colleagues already said, there is no such thing as a "16 bit JPEG", unless you consider the lossless JPEG encoding that nobody outside the medical world supports.
img2dcm expects an image using the Baseline lossy JPEG format (i.e. the JPEG format your camera or smart phone produces).
img2dcm expects an image using the Baseline lossy JPEG format (i.e. the JPEG format your camera or smart phone produces).
Who is online
Users browsing this forum: No registered users and 1 guest