Decode 16 bit JPEG 2000 image data from DICOM to canvas in Javascript

1,743 views
Skip to first unread message

Ganesh S

unread,
May 30, 2015, 10:13:56 AM5/30/15
to cornerston...@googlegroups.com
I am a medical professional & a hobbyist coder.
I recently wrote a very simple DICOM viewer in pure javascript / HTML5, which works entirely on javascript

I want to parse a DICOM file with pixelData in 16 bit JPEG 2000 format.
I managed to get the pixelData into arraybuffer. Now want to convert the data into raw RGB (typed array) .

I tried your sources from https://github.com/OHIF/image-JPEG2000. But it is not working as written in the readme file.

Can you help? { parse pixeldata in 16 bit JPEG 2000 format as arraybuffer - In very simple codes}

Jean-Francois Pambrun

unread,
May 30, 2015, 1:17:54 PM5/30/15
to cornerston...@googlegroups.com
You can look at these implementations for inspiration:

https://github.com/jpambrun/dcmj2k-streaming-viewer

The decoder output is a Int16 array, you will need to implement a value of interest transformation to obtain Uint8 RGB typed array.

JF

Ganesh S

unread,
May 31, 2015, 2:34:12 AM5/31/15
to cornerston...@googlegroups.com
Dear Mr Pambrun,
I am a Radiology postgraduate student from India.
I am extremely glad that you spend some of your valuable time to respond.
My programming knowledge is limited. So I am finding it difficult for me to go through the codes you mentioned.
I wanted to try some algorithms with the images. My institutions provides DICOMs with images in JPEG 2000 format.
I coded a DICOM viewer which can display raw DICOM images. It is very simple, using array buffer, dataview and typedarrays and can display local dcm files(raw 16 bit monochrome) ( using Chrome 43). It is only aroud 400 lines of code.

From the DICOM file with JPEG 2000 ( 16 bit) format, I can extract the pixeldata as array buffer ( or typed array or dataview). Now I want to convert it to raw monochrome data.

I want a code something similar to
var monoRGB16 = decodeJPG(arraybuffer);

It will be helpful if you can help
Regards
Ganesh.

Chris Hafey

unread,
May 31, 2015, 6:26:57 AM5/31/15
to cornerston...@googlegroups.com, drsgane...@gmail.com
Here is a link to the extractJPEG2000Pixels() function:

https://github.com/chafey/cornerstoneWADOImageLoader/blob/master/src/makeGrayscaleImage.js#L21

Since you are limited on both time and programming skill, you should consider replacing your 400 likes of code with cornerstone so you can focus on your image processing algorithm instead of the complexities of DICOM and image display.  If you need an example of how to create your own image processing algorithms with cornerstone, I would be happy to create an example for you.

Chris

Ganesh S

unread,
Jun 9, 2015, 9:09:24 AM6/9/15
to cornerston...@googlegroups.com
Sure. Thank you for the efforts.
I want an example which runs locally.

Chris Hafey

unread,
Jun 9, 2015, 11:06:44 AM6/9/15
to cornerston...@googlegroups.com
I am not sure what you mean by running locally?  I will integrate this into trunk at some point, just backed up on some other stuff currently

On Tue, Jun 9, 2015 at 8:09 AM, Ganesh S <drsgane...@gmail.com> wrote:
Sure. Thank you for the efforts.
I want an example which runs locally.

--
You received this message because you are subscribed to the Google Groups "cornerstone platform" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cornerstone-plat...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/cornerstone-platform/48cd4459-4259-4e3a-a6c4-86c91329600c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Ganesh S

unread,
Jun 10, 2015, 7:35:26 AM6/10/15
to cornerston...@googlegroups.com
Running locally ~ in the PC without the need of a server, just with the browser.
Kindly send the example.

Chris Hafey

unread,
Jun 10, 2015, 9:24:19 AM6/10/15
to cornerston...@googlegroups.com, drsgane...@gmail.com
OK, I'll try to get to that this weekend.  

Ganesh S

unread,
Jun 11, 2015, 7:23:18 AM6/11/15
to cornerston...@googlegroups.com
Thanks in advance

Ganesh S

unread,
Jul 3, 2015, 1:10:42 PM7/3/15
to cornerston...@googlegroups.com
I am still waiting

Chris Hafey

unread,
Jul 6, 2015, 9:00:32 AM7/6/15
to cornerston...@googlegroups.com, drsgane...@gmail.com
Hi Ganesh,

Unfortunately things have been busier than I expected and I haven't had time to work on this yet.  Hopefully things clear up in a few more weeks, thanks for patience and understanding.  Anyone else out there want to put together this example?

Chris

On Friday, July 3, 2015 at 12:10:42 PM UTC-5, Ganesh S wrote:
I am still waiting

Ganesh S

unread,
Jul 26, 2015, 4:33:51 AM7/26/15
to cornerstone platform, cha...@gmail.com
OK
Reply all
Reply to author
Forward
0 new messages