ImageLoader for local DICOM file

1,659 views
Skip to first unread message

Dany Vaz

unread,
Nov 27, 2014, 9:51:33 AM11/27/14
to cornerston...@googlegroups.com

Hi Mr Hafey,

Currently we are looking for solution for viewing DICOM images located in a local directory directly via our web interface.
I find  your project cornerstone, who seems to be the perfect solution for our needs.

After carefully studying your script I found myself faced with a problem I cannot solve.
I understood that it was the ImageLoader which was sent data to cornerstone for display the image.

However, despite going through the different ImageLoader you put online: cornerstoneWADOImageLoader, cornerstoneWebImageLoader, etc.
I fail to understand or find a way to create my ImageLoader for DICOM file on a local directory.

I think I need to try to modify the cornerstoneWADOImageLoader and change the part with the XMLHttpRequest() and get here my local DICOM, but I can't find the way by myself...

Can you give me some food for thought and especially explain me ( if possible) what  kind of struture or object ImageLoader must provide to Conerstone.

Thank you in advance for your reply and especially for your work on this library.

Best regards

 Dany VAZ

 

Chris Hafey

unread,
Nov 27, 2014, 10:04:14 AM11/27/14
to cornerston...@googlegroups.com
Hi Dany,

Due to security concerns, web browsers do not allow javascript applications to access the local file system directly.  The only standard web ways I know of to allow javascript running in a web browser to access local files is:
1) Drag and drop the files onto the web app
2) Use the file open mechanism.

Neither of these work very well for DICOM files because there can be hundreds or thousands of DICOM files per study and these mechanisms don't work very well with so many files.

A few alternatives:
1) Use a browser specific mechanism to allow javascript to access files.  You may be able to configure some browsers to allow direct file access. 
2) Use a browser plugin.  You could use java, silverlight or flash for this.  You could also write your own browser specific plugin
3) Deploy your web application as a desktop application using something like node-webkit
4) Find a way to move the DICOM files to a server so they can be accessed via HTTP

Here is an article with more information

Chris

Dany Vaz

unread,
Nov 27, 2014, 11:44:43 AM11/27/14
to cornerston...@googlegroups.com
thanks for your help

I saw in an example of ImageLoader you use Base64 to encode an image.
Maybe I could make an Ajax request that should call to a PHP script that would encode my DICOM file in base64 and would return this value at cornerstone.

I'm not sure on my solution because I have not really understood what type of data must be send by ImageLoader to  cornerstone.

Dany

Chris Hafey

unread,
Nov 27, 2014, 11:53:55 AM11/27/14
to cornerston...@googlegroups.com
Hi Dany,

If your web server has access to the DICOM files, you should create an HTTP Get handler to return the DICOM file as a part 10 byte stream and use the cornerstoneWADOImageLoader to load/read it.  The base64encoded loader exists just to make the examples self contained in web pages without requiring a corresponding server.

Chris

Cody H

unread,
May 17, 2016, 5:27:01 PM5/17/16
to cornerstone platform
Any tips on how to return a "Part 10" byte stream via PHP of the file? Can't seem to find a single mention of it other than via documentation surrounding cornerstone

Chris Hafey

unread,
May 18, 2016, 10:46:27 AM5/18/16
to cornerstone platform
Hi Cody,

Assuming you have DICOM P10 files on disk somewhere, you just need to create a HTTP GET Handler that reads the file and returns it in the HTTP response body.  Maybe google for "PHP return binary file via HTTP GET" and do that.  I don't know PHP so can't help with the specifics.

Chris
Reply all
Reply to author
Forward
0 new messages