我正在尝试使用cornerstonejs/ tools实现一个加载了多个图像的视图(假设一个元素中有4*4个图像)。除了第一个图像之外,我不需要保存所有这些图像的状态。对于这个图像,我已经有了一个状态管理器和一个基石元素。
据我所知,基石工具中没有能够在同一画布上显示多个图像的工具。未来实现这一点的正确方法是什么?我的想法是为不同的图像加载不同的基石对象,从而为每个图像使用不同的画布,如here中的这个示例所示。
<script>
// image enable the elements
const mr1 = document.getElementById('mr1');
cornerstone.enable(mr1);
const mr2 = document.getElementById('mr2');
cornerstone.enable(mr2);
const ct1 = document.getElementById('ct1');
cornerstone.enable(ct1);
// load and display the images
cornerstone.loadAndCacheImage('example://1').then(function(image) {
cornerstone.displayImage(mr1, image);
});
cornerstone.loadAndCacheImage('example://2').then(function(image) {
cornerstone.displayImage(mr2, image);
});
cornerstone.loadAndCacheImage('ctexample://1').then(function(image) {
cornerstone.displayImage(ct1, image);
});
</script>
有没有更好的方式来实现这一点,我不必为每个图像创建基石对象,但具有独立的基本功能(缩放,平移等不需要保存的图像)。
发布于 2019-04-11 10:39:38
最好的方法是按照您的建议,为每个视区/图像/图像堆栈创建一个单独的启用基石的元素。Cornerstone在内部使用启用的元素来跟踪各种事情,如事件、图像缩放/窗口/级别,以及基于canvas元素调整图像大小,因此尝试强制在同一元素中显示多个图像将非常混乱。
https://stackoverflow.com/questions/55105025
复制相似问题