使用基石工具,加载图像后,我开始绘制一些注释,如角度、矩形、箭头。
我想知道一种清除所有注释的方法。我尝试下一个,但没有看
removeAll(element) {
cornerstoneTools.state.tools.forEach(function (tool) {
const toolState = cornerstoneTools.getToolState(element, tool.name)
if (toolState) {
// Modifying in a foreach? Probably not ideal
cornerstoneTools.toolState.data.forEach(function (data) {
cornerstoneTools.removeToolState(element, tool.name, data)
})
}
})
cornerstone.updateImage(element)
},
要解决此问题,可以使用clearToolState
函数。你有几个关于这个问题的例子和问题,你可以遵循。然而,在您的情况下使用clearToolState
函数似乎是一个不错的选择。clearToolState
函数将从状态管理器中删除与该工具的名称和元素相对应的所有状态。
事实上,文档将clearToolState
功能描述为:
从对应于
toolName
和元素的toolStateManager
中删除所有toolState
。
了解[1,2]cornerstoneTool
如何存储其值也很重要。此外,在使用新工具或功能时,您也可以遵循类似的答案。
参考文献
[1] Francisco Maria Calisto、Carlos Santiago、Nuno Nunes和Jacinto C.Nascimento。2021.引入以人为中心的人工智能助手,帮助放射科医生进行多模式乳腺图像分类。国际人机研究杂志150102607。https://doi.org/10.1016/j.ijhcs.2021.102607
[2] Francisco Maria Calisto、Nuno Nunes和Jacinto C.Nascimento。2020.乳房筛查。高级视觉界面国际会议论文集。https://doi.org/10.1145/3399715.3399744