DICOM @ OFFIS

Discussion Forum for OFFIS DICOM Tools - For registration, send email with desired user name to the OFFIS DICOM team
It is currently Fri, 2018-08-17, 08:16

All times are UTC + 1 hour




Post new topic Reply to topic  [ 7 posts ] 
Author Message
PostPosted: Sat, 2018-02-17, 17:01 
Offline

Joined: Thu, 2015-09-03, 09:36
Posts: 30
Hello,

a DICOM file coming directly from a Siemens Acuson Sequoia 512 gives the following errors, here with loglevel trace:

Using DCMTK 3.6.2.

Code:
[ ... ]
T: DcmDataset::read() returns error = Normal
I: preparing pixel data
D: transfer syntax of DICOM dataset: RLE Lossless (1.2.840.10008.1.2.5)
T: DcmItem::searchSubFromHere() Element (7fe0,0010) found
T: DcmItem::searchSubFromHere() Element (0028,0002) found
T: DcmItem::searchSubFromHere() Element (0028,0010) found
T: DcmItem::searchSubFromHere() Element (0028,0011) found
T: DcmItem::searchSubFromHere() Element (0028,0100) found
T: DcmItem::searchSubFromHere() Element (0028,0006) found
D: RLE decoder processes frame 0
D: RLE decoder processes pixel item 1
E: RLE decoder is finished but has produced insufficient data for this stripe
E: can't change to unencapsulated representation for pixel data
T: DcmItem::searchSubFromHere() Element (0028,0004) found
T: DcmItem::searchSubFromHere() Element (0008,0016) found
T: DcmItem::searchSubFromHere() Element (0028,0010) found
T: DcmItem::searchSubFromHere() Element (0028,0011) found
T: DcmItem::searchSubFromHere() Element (0028,0100) found
T: DcmItem::searchSubFromHere() Element (0028,0101) found
T: DcmItem::searchSubFromHere() Element (0028,0102) found
T: DcmItem::searchSubFromHere() Element (0028,0103) found
T: Pixel Data VR: OW, Compressed (RLELossless)
T: First frame: 0, Number of frames: 1, Total number of frames: 1
T: Columns: 768, Rows: 576, Samples per Pixel: 3, Photometric Interpretation: YBR_FULL
T: Bits Allocated: 8, Bits Stored: 8, High Bit: 7, Unsigned integer
D: reading uncompressed pixel data completely into memory
D: setting number of pixels to be processed (PixelCount) to: 0
E: can't convert input pixel data, probably unsupported compression
D: detach pixel data
F: Invalid DICOM image


I found this old thread - but it seems the suggested patch has never found its way into the official code:

viewtopic.php?f=1&t=301

Osirix and Showcase can read the file without any problems.

Is there any workaround?


Thanks for any hint,

Jens


Top
 Profile  
 
PostPosted: Sat, 2018-02-17, 17:54 
Offline
DCMTK Developer

Joined: Tue, 2011-05-03, 14:38
Posts: 1963
Location: Oldenburg, Germany
Actually, the patch has been committed some years ago: http://git.dcmtk.org/?p=dcmtk.git;a=com ... 83625e5fef

Could you please send the faulty DICOM image to bugs/at/dcmtk/dot/org for further analysis?

Fixed typo in email address :shock:


Last edited by J. Riesmeier on Sat, 2018-02-17, 18:01, edited 1 time in total.

Top
 Profile  
 
PostPosted: Sat, 2018-02-17, 18:00 
Offline

Joined: Thu, 2015-09-03, 09:36
Posts: 30
File has been sent to bugs ....

Thanks,

Jens


Top
 Profile  
 
PostPosted: Sun, 2018-02-18, 12:19 
Offline
OFFIS DICOM Team
OFFIS DICOM Team

Joined: Tue, 2004-11-02, 17:22
Posts: 1215
Location: Oldenburg, Germany
Thanks for the sample image. The patch you refer is indeed in the code, but does not help here. The workaround to fill in the last missing pixels with the value of the last pixel only works at the very end of the pixel data element, i.e. if the pixel data element is for some reason truncated. In this case, however, the RLE decoder gets insufficient output already when processing the first of three "stripes" of the RLE data.

For the given image dimensions, each stripe in the compressed RLE data (essentially the red, green and blue components) should yield 768x576 = 442368 bytes. In this image, however, the red components only decompress to 441874 bytes. At this point the codec will bail out, because this a major error, and there is no option in the toolkit to make it continue nevertheless. Unfortunately, the dataset is really broken and not just truncated. This really needs to be fixed by the vendor of the Ultrasound machine.

You can actually successfully decompress the image when you remove the check for incomplete data and re-compile:
Code:
diff --git a/dcmdata/libsrc/dcrleccd.cc b/dcmdata/libsrc/dcrleccd.cc
index f1b0c3e..d5ad7ce 100644
--- a/dcmdata/libsrc/dcrleccd.cc
+++ b/dcmdata/libsrc/dcrleccd.cc
@@ -313,7 +313,7 @@ OFCondition DcmRLECodecDecoder::decode(
                 if (result.good() && (rledecoder.size() != bytesPerStripe))
                 {
                     DCMDATA_ERROR("RLE decoder is finished but has produced insufficient data for this stripe");
-                    result = EC_CannotChangeRepresentation;
+                //    result = EC_CannotChangeRepresentation;
                 }

                 // distribute decompressed bytes into output image array

However, the check for invalid RLE data is in the code for good reasons.


Top
 Profile  
 
PostPosted: Sun, 2018-02-18, 18:18 
Offline

Joined: Thu, 2015-09-03, 09:36
Posts: 30
Marco,

Thank you for your investigation. I modified the code as suggested and it works as aspected. You are right, this is not the appropriate solution. But the machine is out of service since years, the vendor is by far not responsible for such requests ... We have to accept this behavior - but could this file be damaged while burning a DICOM-DVD from the Ultrasound machine?

Thanks,

Jens


Top
 Profile  
 
PostPosted: Mon, 2018-02-19, 15:52 
Offline
OFFIS DICOM Team
OFFIS DICOM Team

Joined: Tue, 2004-11-02, 17:22
Posts: 1215
Location: Oldenburg, Germany
No, I don't think so. The error is somewhere in the middle of the RLE bytestream, and I cannot imagine any network receiver or CD/DVD burning tool to mess with this at this low level. My best guess is that the invalid RLE bytestream comes directly from the modality. The easiest way of avoiding that would be, of course, to disable support for RLE.


Top
 Profile  
 
PostPosted: Tue, 2018-02-20, 19:29 
Offline

Joined: Thu, 2015-09-03, 09:36
Posts: 30
Many thanks for your support, Marco and Joerg!

Jens


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 7 posts ] 

All times are UTC + 1 hour


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group