cornerstone系列 - 加载多帧dicom(multi-frame)

cornerstoneWADOImageLoader是支持multi-frame的,官方有提供example:
https://github.com/cornerstonejs/cornerstoneWADOImageLoader/blob/master/examples/wadourimultiframe/index.html

用法写的很明白,主要是通过在wado url后加上frame参数来切分,实际用的时候有问题想补充一下。

下面官方例子中的代码中要注意unload这个一定要加,要释放cache,不然loadAndCacheImage的时候就会报"frame exceeds size of pixelData"错误。除了unload,如果你的业务场景不方便用这个方法来指定清楚这个url对应的cache的话,也可以使用 cornerstoneWADOImageLoader.wadouri.dataSetCacheManager.purge()

我用下来多帧图像的首次加载是需要一张一张加载的,每加载一张清一次cache,才不会报错(不知道是不是有cachesize之类,或者是我用法不对,有知道的小伙伴麻烦评论告诉我,感谢)。所以比如scroll的场景,和预加载的场景,都需要注意单张加载且及时清理。

 cornerstone.loadAndCacheImage(imageIds[0]).then(function(image) {
                // now that we have an image frame in the cornerstone cache, we can decrement
                // the reference count added by load() above when we loaded the metadata.  This way
                // cornerstone will free all memory once all imageId's are removed from the cache
                cornerstoneWADOImageLoader.wadouri.dataSetCacheManager.unload(url);
                    
                cornerstone.displayImage(element, image);
              .....
            }, function(err) {
                alert(err);
            });
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容