I'm trying to create a DICOM viewer on my own, using only JavaScript and HTML5. I'm working on this project for the last few days and now I successfully parse all textual information I need and I can also correctly read and display uncompressed Grayscale and RGB images. Now I'm trying to display the so called "JPEG Lossless, Nonhierarchical, First- Order Prediction" type of image (in the DICOM file, it is enumarated with the Transfer Syntax Unique Identification: 1.2.840.10008.1.2.4.70) but I'm stuck. I want to read the Pixel Data of the image manually and build the image out of it. There is no actual information on how the bits are stored in the DICOM documentation and I really tried to find a good description of this kind of JPEG on the internet but with no success. Can you give me some advice on what exactly I have to read to solve my problem. Thank you all :)
Asked
Active
Viewed 2,392 times
3
-
Also for reference, the [JPEG Recommendation](http://www.w3.org/Graphics/JPEG/itu-t81.pdf) contains a section about lossless, see "Annex H Lossless mode of operation". Note that a JPEG lossless also uses JPEG tags, as does the JPEG lossy. Somewhat analogous to parsing a DICOM file, you can parse the portion JPEG of the PixelData. – Chris O Nov 29 '14 at 03:53
-
1And, DCMTK has a jpeg lossless decoder, you can see this file as a starting point `dcmtk-3.6.0\dcmjpeg\libijg16\jdlossls.c` – Chris O Dec 01 '14 at 13:41
-
2Here is an implementation in JavaScript: https://github.com/rii-mango/JPEGLosslessDecoderJS – martinez314 Jun 23 '15 at 20:07
-
thanks a lot, it's perfect! – mjekov Jun 24 '15 at 07:51
2 Answers
2
Check this document, probably it leads you into the right direction JPEG Lossless Codec
There are also some more links which may help: dclunie jpeg sources

JohnnyQ
- 1,591
- 1
- 16
- 25
-1
FYI, the Orthanc server for medical imaging already provides JPEG Lossless decompression through a REST API, which allows JavaScript/HTML5 applications to very easily display DICOM images in Web browsers. You can for instance have a look at the DWV plugin by Yves Martel.

Tisys
- 938
- 1
- 8
- 18