dcmj2pnm - Multiple Errors on Seemingly Good File

All other questions regarding DCMTK

Moderator: Moderator Team

Post Reply
Message
Author
OatsNHoney
Posts: 4
Joined: Tue, 2022-06-07, 09:20
Location: California

dcmj2pnm - Multiple Errors on Seemingly Good File

#1 Post by OatsNHoney »

Hello all,

I am new to the software and not much of a programmer to begin with so please forgive any ignorance. Some background: my friend has a medical condition that required her to get a series of MRIs. She would like to use the images from the MRI for an art project. Unfortunately for her, the MRI files she was given by her provider were in a format she can't use (DICOM). As the "tech person", it is my job to figure out how to convert all these files to .PNG. Through research I found this toolkit. It seems perfect.

My issue: When I went to convert a single file with dcmj2pnm, I got a slew of errors. Posted below.

Code: Select all

C:\Users\me\OneDrive\Documents\Friend Images>dcmj2pnm -v -d -f Raw\MR000000 TEST.PNG
D: $dcmtk: dcmj2pnm v3.6.7 2022-04-22 $
D:
I: reading DICOM file: Raw\MR000000
D: DcmDataset::read() trying to detect transfer syntax of data set (because it is unknown)
D: DcmDataset::read() TransferSyntax="Little Endian Implicit"
W: DcmItem: Element (0000,0000) found twice in one data set or item, ignoring second entry
W: DcmItem: Element (0000,0000) found twice in one data set or item, ignoring second entry
W: DcmItem: Element (0000,0000) found twice in one data set or item, ignoring second entry
W: DcmItem: Element (0000,0000) found twice in one data set or item, ignoring second entry
W: DcmItem: Element (0000,0000) found twice in one data set or item, ignoring second entry
W: DcmItem: Element (0000,0000) found twice in one data set or item, ignoring second entry
W: DcmItem: Element (0000,0000) found twice in one data set or item, ignoring second entry
W: DcmItem: Element (0000,0000) found twice in one data set or item, ignoring second entry
W: DcmItem: Element (0000,0000) found twice in one data set or item, ignoring second entry
W: DcmItem: Element (0000,0000) found twice in one data set or item, ignoring second entry
W: DcmItem: Element (0000,0000) found twice in one data set or item, ignoring second entry
W: DcmItem: Element (0000,0000) found twice in one data set or item, ignoring second entry
W: DcmItem: Element (0000,0000) found twice in one data set or item, ignoring second entry
W: DcmItem: Element (0000,0000) found twice in one data set or item, ignoring second entry
W: DcmItem: Element (0000,0000) found twice in one data set or item, ignoring second entry
E: DcmElement: Unknown Tag & Data (0004,00c2) larger (131072) than remaining bytes in file
W: DcmItem: Dataset not in ascending tag order, at element (0004,00c2)
F: I/O suspension or premature end of stream: reading file: Raw\MR000000
I found this post and ran dcmdump and the file seems to be intact? Does anyone know what I could be doing wrong?

Thank you,

Oats

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

Re: dcmj2pnm - Multiple Errors on Seemingly Good File

#2 Post by J. Riesmeier »

If the file Raw\MR000000 is a valid DICOM file, you should not call the tool with option -f (--read-dataset).
Also the output format has to be specified explicitly, e.g. using option +on for PNG.

Finally, using both -v and -d (in this order) makes no sense since -d (for debug) "wins" (being the rightmost option of these two).

OatsNHoney
Posts: 4
Joined: Tue, 2022-06-07, 09:20
Location: California

Re: dcmj2pnm - Multiple Errors on Seemingly Good File

#3 Post by OatsNHoney »

Thank you for your reply, I have implemented your suggestions. Now I am running:

Code: Select all

C:\Users\me\OneDrive\Documents\Friend Images > dcmj3npm -d +on Raw\MR000000 TEST.PNG
.

This actually runs and outputs a .PNG, which is great news, but the PNG is just a grey square. I have tried 10 or "at random" of the 100s of images here and they all output a grey square. I am very certain that these are valid dicom images, so I'm wondering: what else could I be doing wrong?

Appreciate any input.

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

Re: dcmj2pnm - Multiple Errors on Seemingly Good File

#4 Post by J. Riesmeier »

Does it get better if you add option +Wm?

OatsNHoney
Posts: 4
Joined: Tue, 2022-06-07, 09:20
Location: California

Re: dcmj2pnm - Multiple Errors on Seemingly Good File

#5 Post by OatsNHoney »

Apologies for the long delay. I had more pressing things come up. Yes that worked well. Thank you for the assistance.

OatsNHoney
Posts: 4
Joined: Tue, 2022-06-07, 09:20
Location: California

Re: dcmj2pnm - Multiple Errors on Seemingly Good File

#6 Post by OatsNHoney »

Hello, I am back with an issue I'm having. I am trying to use PowerShell to run dcmj2pnm with the command dcmj2pnm -d +on +Wm [inarg] [outarg] but I get the error "A positional parameter cannot be found that accepts argument '+Wm'.:" However I know that Powershell can run this tool, as it runs when I just run dcmj2pnm, so I'm a bit confused. I tried to run Get-Help dcmj2pnm -Full but PowerShell couldn't find a Help file for the tool. Ultimately what I am trying to do is loop through a folder full of files and convert them all to PNG, but I found PowerShell syntax more friendly than the Windows CommandPrompt. What might I be doing wrong?

Thanks for any assistance.

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

Re: dcmj2pnm - Multiple Errors on Seemingly Good File

#7 Post by J. Riesmeier »

I am not familiar with PowerShell, but the dcmj2pnm manpage (in HTML format) can e.g. be found here: https://support.dcmtk.org/docs/dcmj2pnm.html

Post Reply

Who is online

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