Cornerstone + Orthanc instance frames

Greetings again,

I got a nice viewer going with Cornerstone and Orthanc, however one thing puzzles me that is potentially a problem. There are instances which contain multiple frames, in the cornerstoneDemo project the PACS server is ClearCanvas and it has an option to render/retrieve? data per frame, however in Orthanc there are cases where /instances/{id}/frames/{frameNum}/preview cannot return a valid image (unsupported).

I don’t know if this is more of a cornerstone question or orthanc, but any suggestions what to do in this case?

The cornerstoneDemo multi-frame instances are read using the cornerstoneWADOImageLoader which loads the full DICOM P10. The orthanc preview endpoint returns a rendered image (JPEG or PNG?) which cornerstoneWADOImageLoader will not understand. Note that the cornerstoneWADOImageLoader strips the ?frame=X parameter from the imageId before making the XHR request (the frame parameter is used by cornerstoneWADOImageLoader to extract the right frame once the multi-frame instance is loaded and cached in the browsers memory). You might find the following example helpful:

http://rawgit.com/chafey/cornerstoneWADOImageLoader/master/examples/wadourimultiframe/index.html

Chris

PS - If you really want to use rendered images, you can use the cornerstoneWebImageLoader, but you will lose out on some functionality which depends on the full DICOM P10 instance

So the ?frame is actually for the WADO loader and not for ClearCanvas? If so it makes perfect sense now. I was concerned that I couldn’t specify which frame to load FROM the .dcm file but now it makes sense.

Yes, ?frame is a cornerstoneWADOImageLoader specific feature. The imageId format is cornerstone image loader specific so the image loader can completely control what happens. In this case, it uses the ?frame query parameter to allow frame level access (which is not something WADO-URI supports).

On a related note, is there any chance to get the frames count in an instance in /study/{id}/instances

Hello,

I got a nice viewer going with Cornerstone and Orthanc, however one thing puzzles me that is potentially a problem. There are instances which contain multiple frames, in the cornerstoneDemo project the PACS server is ClearCanvas and it has an option to render/retrieve? data per frame, however in Orthanc there are cases where /instances/{id}/frames/{frameNum}/preview cannot return a valid image (unsupported).

I think that Chris has already answered about Cornerstone. On the Orthanc side of things, if you receive an “unsupported image”, this most probably means that your image is encoded as JPEG2k.

If you want the “/instances/{id}/frames/{frameNum}/preview” call work even for JPEG2k, you will have to install the Web viewer plugin. This plugin will replace the built-in DICOM of Orthanc by that of GDCM, that happens to support JPEG2k:
http://www.orthanc-server.com/static.php?page=web-viewer

On a related note, is there any chance to get the frames count in an instance in /study/{id}/instances

This is already the case: You can get the number of frames in one instance by counting the number of items that are returned by a call to “/instances/{id}/frames”.

HTH,
Sébastien-

I wanted to avoid the call to /instances/{id}/frames as it can get quite expensive if there are lots of instances,

If you are dealing with 3D or 2D+t images, you could call “/series/{id}/ordered-slices” to speed up things.

Just a question over your question. I am developing a prototype using both Orthanc and Cornerstone. Each time I want to put an image I need to create and link to a JSON file related to the patient ID. So manually I need to insert this information.

Is any way to do this automatically? How are you doing this?

Not sure to understand what you exactly mean. You probably want to use the attachment feature: http://book.orthanc-server.com/faq/features.html#metadata-attachments

Sorry, still not clear. Which JSON file do you need to write into ?