Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to process RLE images #74

Open
psarnow opened this issue Sep 14, 2018 · 4 comments
Open

Unable to process RLE images #74

psarnow opened this issue Sep 14, 2018 · 4 comments

Comments

@psarnow
Copy link

psarnow commented Sep 14, 2018

Trying to get the RLE images from a dicom export. Here is a sample .dcm that was sent through and saved via DServer.
image_2814918156667436.dcm.zip

Can't figure out how to get anything but the thumbnail image (3x3 image grid).
sample

Maybe this method needs to do something different?

Here is my dcm.summary
System Properties:
Ruby DICOM version: 0.9.8
Byte Order (CPU): Little Endian

DICOM Object Properties:
Source: File (successfully read): tmp/image_2814918156667436.dcm
Modality: Ultrasound Image Storage
Meta Header: Yes
Value Representation: Explicit
Byte Order (File): Little Endian
Pixel Data: Yes
Image Size: 1024768
Number of frames: 1
Photometry: RGB
Compression: RLE Lossless
Bits per Pixel: 8
=> ["Source: File (successfully read): tmp/image_2814918156667436.dcm", "Modality: Ultrasound Image Storage", "Meta Header: Yes", "Value Representation: Explicit", "Byte Order (File): Little Endian", "Pixel Data: Yes", "Image Size: 1024
768", "Number of frames: 1", "Photometry: RGB", "Compression: RLE Lossless", "Bits per Pixel: 8"]

@dicom
Copy link
Owner

dicom commented Sep 15, 2018 via email

@psarnow
Copy link
Author

psarnow commented Sep 18, 2018

Great Chris. Really hoping we can get this to function properly. Please let me know if I can provide any more information.

@dicom
Copy link
Owner

dicom commented Sep 20, 2018

Sorry for the somewhat late reply (I've been on a trip lately).

I have looked into it and indeed there seems to be something "funny" going on here. I'll investigate it further and hope to find a fix for it.

Best regards,
Chris

@dicom
Copy link
Owner

dicom commented Sep 21, 2018

Ok, so I've looked into this issue a little bit more.

The method which is at fault here is actually the decode_rle() method in image_item.rb:
https://github.com/dicom/ruby-dicom/blob/master/lib/dicom/image_item.rb#L491

What separates your particular RLE file from the two samples I have already in the repository (and which decodes just fine), is that those images come up with one image segments in that method, where as your sample has 3 image segments.

There is probably a flaw in the way that method decodes the pixel data. However, it is not quite clear to me what exactly goes wrong. For some reason the image seems to be composed as 9 low-resolution "thumbnails", as opposed to one single high resolution image.

Unfortunately I didnt write that original RLE code and Im not really that familiar with. Furthermore I dont deal with RLE files in my work either, so Im somewhat unsure if I should spend the time to try to crack this one.

I found some resource on RLE decoding here:
http://dicom.nema.org/DICOM/2013/output/chtml/part05/sect_G.3.html

There might be other better resources as well.

Let me know if you think you are able to have a go with this issue? If not I might try to ask in the ruby-dicom forum if anyone is willing and able to check it out.

Best regards,
Chris

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants