Dealing with corrupted file

All other questions regarding DCMTK

Moderator: Moderator Team

Post Reply
Message
Author
LuxB2000
Posts: 2
Joined: Fri, 2013-02-08, 09:56

Dealing with corrupted file

#1 Post by LuxB2000 »

Hello,
I'm new in dcmtk world, please excuse my misunderstandings and approximations.

For some reasons I'm dealing with a server system on which DICOM files are sent before transmission to PACS system. I try to develop a robust solution to manage all documents in different situations. One of these situation involves corrupted files. Since the PACS service doesn't accept these particular files I try to detect them. For now I'm working on Unix script solution and detect them with the command dcmdump dicom_file. According to readings (on forum etc.) it seems to be the most accurate way to do that (and dcmftest passes).

This correctly sends me information about the problem:

Code: Select all

$ dcmdump dicom_file
E: DcmElement: PixelData (7fe0,0010) larger (17039360) than remaining bytes in file
E: dcmdump: I/O suspension or premature end of stream: reading file: dicom_file
Unfortunately I have some troubles with this command in that particular case. Indeed I'm not able to redirect the outputs of the error into a file nor to a grep command (or similar).

Code: Select all

$ dcmdump dicom_file > .log
$ dcmdump dicom_file | grep 'E:'
The file is empty (or grep doesn't catch ouputs) and the error explanations are still plot into the terminal. What is the most curious is that I'm able to redirect the outputs when the DICOM file is not corrupted.

My questions are: why is it not possible to perform the redictions of the outputs in such situation? Is dcmdump really the most appropriate solution ? (If not, what is the solution according to you).

Thanks a lot.

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

Re: Dealing with corrupted file

#2 Post by J. Riesmeier »

Depending on the shell you're using, the redirection of stderr (this is where the log output is usally written) differs. What about using a log file (without redirection of stderr)? See this HOWTO.

LuxB2000
Posts: 2
Joined: Fri, 2013-02-08, 09:56

Re: Dealing with corrupted file

#3 Post by LuxB2000 »

Damn ... I did not think twice before writing ! Of course you're right and stderr may be easily useded with 2> (in my current terminal).
I already had a look on the logger and it will require a lot of changes in my current solution but I keep it in mind.
Thanks a lot for the prompt answer !

Post Reply

Who is online

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