Open lyan2000 opened 4 years ago
I just did a search on cornerstone.loadImage() and cornerstone.loadAndCacheImage() within the cornerstone tools project. It appears that all of these calls are related to stack management and none would allow inclusion of options. I think it might be easier to allow adding scheme to the WADO image loader.
I have commented on
https://github.com/cornerstonejs/cornerstoneWADOImageLoader/issues/165
Can we add an optional property to the stack data model { currentImageIdIndex: number, imageIds: string [], imageLoaderOptions: any[] }; where imageLoaderOptions array is optional, has the same length as imageId that can be used in cornerstone.loadImage() and cornerstone.loadAndCacheImage()?
Prerequisites
Description
I am using corerstoneWADOImageLoader with a custom load request and wish to use the stack tool from cornerstoneTools with this custom load request.
The current API call looks like const imageId = 'wadouri:my.custom.resource.identifier'; const myloader = imageId => { return myPromiseThatWillResolveWithArrayBuffer; } cornerstone.loadImage(imageId, {loader: myloader})
There does not seem to be an option when I specify the stack, which only contains imageId's and the currentIndex.
Is there a workaround to this within the tool? I can't seem to find one without having to modify the cornerstoneTools source code (requestPoolManager.js and stackPrefetch.js).
Another option is to change cornerstoneWADOImageLoader source code (src/imageLoader/wadouri/loadImage.js) to add a custom scheme to the loader along with the custom load request, in addition to the existing 'dicomweb', 'wadouri', and 'dicomfile'. Then I can avoid supplying an option while issuing the loadImage call.
I can raise a PR for either solution if preferred.
Thank you!