cornerstone icon indicating copy to clipboard operation
cornerstone copied to clipboard

Loading DICOM Images from IIS 7.5

Open RaNa2009 opened this issue 10 years ago • 12 comments

Hi! I have a large amount of DICOM data on a server, accessible via HTTP - i.e. the *.dcm files are located in subfolders reachable by the webserver (IIS 7.5). My web application does a whole lot of other things, but it also knows about the DICOM data for certain records in the app.

So here's my question: How can I use cornerstone to load and display these images via HTTP? The URLs for one record would look like this:

http://server/application/data/DICOM/datasetX/0001.dcm http://server/application/data/DICOM/datasetX/0002.dcm ... and so forth. (a )

I did not had success with the WADOImageLoader nor the WebImageLoader (which only reads pure JPEG, as I understand). Any ideas?

If I need WADO - what would be needed to let my application act as a WADO server?

Thanks in advance, RaNa2009

RaNa2009 avatar Feb 21 '16 23:02 RaNa2009

This is exactly what the cornerstoneWADOImageLoader is for - loading DICOM P10 via HTTP. Most likely you are running into a CORS issue - try searching the cornerstone google group for info about that

chafey avatar Feb 22 '16 03:02 chafey

Problem solved, it wasn't a CORS issue, it has been much simpler. I tripped over the cornerstoneDemo application, which I used to test with my data (adding a new stuy.json). In the demo's JavaScript, the string "dicomweb://cornerstonetech.org/images/ClearCanvas/" is added to the image Id's if the URLs do not start with "http", which leads to using the WADOImageLoader. The pure "http://..." URLs in my ImageIds lead to using the WebImageLoader, which naturally fails. So I added "wadouri:" to my URLs and made a small change to the demo source...

This is great, so now I can add a client side DICOM viewer to my application using cornerstone!

Thank's - fantastic library, will recommend :-)

RaNa2009 avatar Feb 23 '16 13:02 RaNa2009

Great news - can you please close the issue?

chafey avatar Feb 23 '16 15:02 chafey

Hi ! I am trying to load DICOM images in an ASP.NET application using IIS server but I am failed .. I am using WADOImageLoader and WebWorker. Previously, I successfully loaded images in a Node.js application. But now it seems like there is an error in the imageId as the server returns a "404 not found" error.. I tried the following different URLs for imageId but none works.. (Here the "ISeeImageTestApplication" is the name of my ASP.NET application)

dicomweb://localhost/ISeeImageTestApplication/Resources/Images/image1.dcm, wadouri://localhost/ISeeImageTestApplication/Resources/Images/image1.dcm, dicomweb:/localhost/ISeeImageTestApplication/Resources/Images/image1.dcm, wadouri:/localhost/ISeeImageTestApplication/Resources/Images/image1.dcm, http://localhost/ISeeImageTestApplication/Resources/Images/image1.dcm, dicomweb:/http://localhost/ISeeImageTestApplication/Resources/Images/image1.dcm, dicomweb:http://localhost/ISeeImageTestApplication/Resources/Images/image1.dcm, wadouri:http://localhost/ISeeImageTestApplication/Resources/Images/image1.dcm ... and many others

And here is my JS code which loads the image:

`$(document).ready(function () { var config = { maxWebWorkers: 1, startWebWorkersOnDemand: true, webWorkerPath: '/cornerstoneWADOImageLoader/cornerstoneWADOImageLoaderWebWorker.js', taskConfiguration: { 'decodeTask': { loadCodecsOnStartup: false, initializeCodecsOnStartup: false, codecsPath: '/cornerstoneWADOImageLoader/cornerstoneWADOImageLoaderCodecs.js', usePDFJS: false }, 'sleepTask': { sleepTime: 3000 } } }; cornerstoneWADOImageLoader.webWorkerManager.initialize(config);

var element = document.getElementById('imageViewer');
var imageId = "dicomweb://localhost/ISeeImageTestApplication/Resources/Images/image1.dcm";

cornerstone.enable(element);

cornerstone.loadImage(imageId).then(function (image) {
    var viewport = cornerstone.getDefaultViewportForImage(element, image);
    cornerstone.displayImage(element, image, viewport);
});

});`

Any help would be highly appreciated. Thanks

Hasan

hasanmansor avatar Oct 06 '17 09:10 hasanmansor

Hi ! Please try with codecsPath: 'cornerstoneWADOImageLoaderCodecs.js'

adreyfus avatar Oct 06 '17 09:10 adreyfus

Thanks for the response .. Actually, I put this file in the cornerstoneWADOImageLoader folder in my solution thats why I referenced it like this .. I brought it out and then changed the path but it still doesn't work .. this is how my project looks like: image

hasanmansor avatar Oct 06 '17 10:10 hasanmansor

I found the solution. Actually the IIS wasn't configured to serve .dcm files, I added the following lines to my Web.config file of my application and it worked.

<staticContent> <mimeMap fileExtension=".dcm" mimeType="application/DICOM" /> </staticContent>

Thanks

hasanmansor avatar Oct 06 '17 14:10 hasanmansor

hasanmansor Can i get your ISeeImageTestApplication so i can also implement cornerstonejs for DICOM if Possible Plz.

yadavvirus avatar May 02 '18 07:05 yadavvirus

@yadavvirus there shouldn't be anything too tricky here. His .NET Solution looks like it serves up the static files, and... That's it. The only "gotcha" was configuring IIS to see the .dcm extension as static content.

dannyrb avatar May 02 '18 09:05 dannyrb

hasanmansor:

I've been trying to do just a very simple thing: loading dicom images from within IIS site. I could view the pdf or jpq images/files within the same folder, but it fails on dicom images. .DCM mime type is there. Access right is there and it keeps giving me 404 error.

Can you share your test project please?

Thanks in advance.

tbui2020 avatar Sep 21 '20 15:09 tbui2020

hasanmansor:

I've been trying to do just a very simple thing: loading dicom images from within IIS site. I could view the pdf or jpq images/files within the same folder, but it fails on dicom images. .DCM mime type is there. Access right is there and it keeps giving me 404 error.

Can you share your test project please?

Thanks in advance.

Sorry man, I don't have that anymore and I don't remember properly but I think you need to put the following line in your project's config and also configure your IIS to serve Dicom files. <staticContent> <mimeMap fileExtension=".dcm" mimeType="application/DICOM" /> </staticContent>

hasanmansor avatar Sep 22 '20 11:09 hasanmansor

Thanks Hasanmansor. I was able to get it work by restarting my webhost box. Not sure why.

tbui2020 avatar Sep 25 '20 16:09 tbui2020