Open gnoeyp opened 1 year ago
Hey, the caching is done automatically if you have registered image loaders and using cornerstone to load them. If you can't initiate the load from cornerstone, you can look into the cach.putImageLoadObject
If I directly call cornerstone.createAndCacheVolume(volumeId, { imageIds })
before the images are loaded, I got an error that metadata does not exist. I think it's because the volumeLoader executes makeVolumeMetaData
before loading prefetchIds
. Thus I need to call cornerstone.imageLoader.loadAndCacheImage
or cornerstone.imageLoader.loadImage
before creating a volume.
I tried both ways, and only cornerstone.imageLoader.loadImage
worked well.
What I found is, if cached images exist, cornerstone would rescale the image, which was an unexpected behavior in my app's scenario. It results the viewport looks completely white.
I am not sure the dicom files were loaded twice, because chrome network tab shows only one request per file, even though I used cornerstone.imageLoader.loadImage
.
If the images are cached, no problem. Otherwise, it will be perfect if I can pass an argument needToRescale: boolean
to createAndCacheVolume
so that unexpected rescaling would not occur.
I'm trying to load volume using
cornerstoneWADOImageLoader.wadouri.loadImage
rather thanstreaming-wadors
becausewadors
protocol is not available in my server environment.After I loaded images and extracted meta data, I realized that I can't find a function to cache images. So currently my implementation loads images twice (for prefetch and volume generation). I wish there was a function like this:
cornerstone.cacheImage(imageId, image)