img2dcm converting JPG/BMP to DCM

All other questions regarding DCMTK

Moderator: Moderator Team

Post Reply
Message
Author
bnoeafk
Posts: 29
Joined: Fri, 2012-10-12, 08:05

img2dcm converting JPG/BMP to DCM

#1 Post by bnoeafk » Sat, 2015-08-01, 01:33

I'm having a hell of a time trying to work out what's wrong with a conversion of a number of jpg (or bmp) files to DICOM.

Code: Select all

img2dcm -df SC.dump -sc t2-00.jpg t2-00.dcm
When I run this, I get

Code: Select all

W: DcmItem: Length of element (230a,2323) is odd
E: DcmElement: Unknown Tag & Data (230a,2323) larger (589505315) than remaining bytes in file
F: Error converting file: I/O suspension or premature end of stream
Perhaps the JPG is corrupt? I can open it up in any other file manipulation program just fine. I've even resorted to using a JPG identity file to check each JPG to ensure that it's valid and not corrupt. exiftool reports back:

Code: Select all

root@dcs:/home/vroot/test# exiftool t2-00.jpg    
ExifTool Version Number         : 9.46
File Name                       : t2-00.jpg
Directory                       : .
File Size                       : 366 kB
File Modification Date/Time     : 2015:07:31 16:44:41-07:00
File Access Date/Time           : 2015:07:31 16:45:59-07:00
File Inode Change Date/Time     : 2015:07:31 16:44:41-07:00
File Permissions                : rw-rw-r--
File Type                       : JPEG
MIME Type                       : image/jpeg
JFIF Version                    : 1.01
Resolution Unit                 : inches
X Resolution                    : 600
Y Resolution                    : 600
Profile CMM Type                : 
Profile Version                 : 2.1.0
Profile Class                   : Display Device Profile
Color Space Data                : RGB
Profile Connection Space        : XYZ
Profile Date Time               : 0000:00:00 00:00:00
Profile File Signature          : acsp
Primary Platform                : Apple Computer Inc.
CMM Flags                       : Not Embedded, Independent
Device Manufacturer             : 
Device Model                    : 
Device Attributes               : Reflective, Glossy, Positive, Color
Rendering Intent                : Perceptual
Connection Space Illuminant     : 0.96419 1 0.82489
Profile Creator                 : 
Profile ID                      : 0
Profile Description             : Artifex Software sRGB ICC Profile
Profile Copyright               : Copyright Artifex Software 2011
Media White Point               : 0.95045 1 1.08905
Media Black Point               : 0 0 0
Red Matrix Column               : 0.43607 0.22249 0.01392
Green Matrix Column             : 0.38515 0.71687 0.09708
Blue Matrix Column              : 0.14307 0.06061 0.7141
Red Tone Reproduction Curve     : (Binary data 2060 bytes, use -b option to extract)
Green Tone Reproduction Curve   : (Binary data 2060 bytes, use -b option to extract)
Blue Tone Reproduction Curve    : (Binary data 2060 bytes, use -b option to extract)
Image Width                     : 5100
Image Height                    : 6600
Encoding Process                : Baseline DCT, Huffman coding
Bits Per Sample                 : 8
Color Components                : 3
Y Cb Cr Sub Sampling            : YCbCr4:2:0 (2 2)
Image Size                      : 5100x6600
The input JPG is 366K in size, but I would find it hard to believe that img2dcm is having an issue with its filesize but in an attempt to be diligent, I converted the files into a smaller size (25K) and I'm getting the exact same issue.

I even tried the VLP.dump just in case it was a secondary capture issue as opposed to visible light, but I'm getting the exact same issue.

I'm running on Ubuntu 14.04.2LTS and installed DCMTK using

Code: Select all

apt-get install dcmtk
which installed the stable release of 3.6.0-15.


Am I doing something wrong here?

J. Riesmeier
DCMTK Developer
Posts: 2023
Joined: Tue, 2011-05-03, 14:38
Location: Oldenburg, Germany
Contact:

Re: img2dcm converting JPG/BMP to DCM

#2 Post by J. Riesmeier » Sat, 2015-08-01, 20:19

I'm having a hell of a time trying to work out what's wrong with a conversion of a number of jpg (or bmp) files to DICOM.
Reading the documentation would certainly help, especially the referenced section on "Input Templates" :-)

bnoeafk
Posts: 29
Joined: Fri, 2012-10-12, 08:05

Re: img2dcm converting JPG/BMP to DCM

#3 Post by bnoeafk » Sun, 2015-08-02, 04:59

Ok, message received and understood (and now using the "converted" SC.dcm file, I'm now getting different issues, but I think I can handle that)...

One thing that I should ask though : in the documentation (which I've been using for a few years now and have printed out into it's own binder) it's a little confusing when 7 examples are shown, but that only one (#4) makes any reference to having to use a template file ... unless of course, you don't have to - which begs the question - when do you need to and when you do not?

Michael Onken
DCMTK Developer
Posts: 1712
Joined: Fri, 2004-11-05, 13:47
Location: Oldenburg, Germany
Contact:

Re: img2dcm converting JPG/BMP to DCM

#4 Post by Michael Onken » Sun, 2015-08-02, 11:10

Hi,

you don't have to use a template file at all. It just makes sense if you have a lot of pre-defined tags that you do not want to add using the -k option.

Even if you use the default call "img2dcm input.jpg out.dcm" with no extra options, you will have a valid DICOM file in the end.

HTH,
Michael

bnoeafk
Posts: 29
Joined: Fri, 2012-10-12, 08:05

Re: img2dcm converting JPG/BMP to DCM

#5 Post by bnoeafk » Mon, 2015-08-03, 06:21

Michael,
It does thank you - I also found your other post about storescu and proposing JPEG8 for SC which helped me immensely.

Thanks again


Dave

bnoeafk
Posts: 29
Joined: Fri, 2012-10-12, 08:05

Re: img2dcm converting JPG/BMP to DCM

#6 Post by bnoeafk » Mon, 2015-08-03, 15:20

Michael / Herr Riesmeier,
A brief follow up on this - is there any way that img2dcm can process multiple (eg) JPGs and store them into a single DICOM file? I understand that the older SC IOD is a single frame, but with the "-nsc" switch I wondered if there's a way of storing a multiframe SC?

I've tried

Code: Select all

img2dcm --data-set from SC.dcm -nsc img1.jpg img2.jpg test.dcm
but no luck :cry:

J. Riesmeier
DCMTK Developer
Posts: 2023
Joined: Tue, 2011-05-03, 14:38
Location: Oldenburg, Germany
Contact:

Re: img2dcm converting JPG/BMP to DCM

#7 Post by J. Riesmeier » Sat, 2015-08-08, 16:59

The short answer is no: img2dcm takes a single input (and a single output) filename.

Post Reply

Who is online

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