cornerstoneTools
cornerstoneTools copied to clipboard
Freehand Scissor Tool error
Prerequisites
- Version: 5.1.3
- Reporting to correct repo
Description
Trying to use the freehand scissors tool and getting error saying:
"Consumers must define stack in their application if using segmentations in cornerstoneTools"
Steps to Reproduce the issue
- When I copied code from cornerstone tools examples to set up the freehand scissors tool
- Then I get the error that "Consumers must define stack in their application if using segmentations in cornerstoneTools"
We expect the scissor tool to work over an image we uploaded but it errored instead.
Thank you for any help!
Hi @ghanemja,
if you want to use segmentation module, you have to add a stack manager that contains the list of the cornerstone imageIds and the current active image on which you are using the tool. This should work:
let stack = { currentImageIdIndex: currentImageIndex, imageIds: imageIds };
cornerstoneTools.addStackStateManager(element, ["stack"]);
cornerstoneTools.addToolState(element, "stack", stack);
Or maybe you could try to use Larvitar, it's an open source library we build on top of cornerstone and cornerstone tools. It comes with docs and ready-to-use examples!