Cornerstone is a set of JavaScript libraries that can be used to build web-based medical imaging applications. It provides a framework to build radiology applications such as the OHIF Viewer.
// This is Line 1978
const segReprUIDs = await cornerstone3DTools.segmentation.addSegmentationRepresentations(toolGroupIdContours, [
{segmentationId:segmentationIdParam, type: segType, }, // options: { polySeg: { enabled: true, }, },
]);
Error 2
If I scroll through the contours, I then get the same error, but pointing to internal cornerstone3D code
// This is line 152
_getSegmentationRepresentation(segmentationId) {
const segmentationRepresentations = segmentationState.getSegmentationRepresentations(this.toolGroupId);
const validSegmentationRepresentations = segmentationRepresentations.filter((representation) => representation.segmentationId === segmentationId);
if (!validSegmentationRepresentations) {
console.warn(`No segmentation representation found for toolGroupId: ${this.toolGroupId}`);
return;
}
if (segmentationState.getSegmentationRepresentations(this.toolGroupId)
.length > 1) {
console.warn('Multiple segmentation representations detected for this tool group. The first one will be used.');
}
return validSegmentationRepresentations[0];
}
Steps to Reproduce
Add two cornerstone3DTools.Enums.SegmentationRepresentations.Contour by using cornerstone3DTools.segmentation.addSegmentationRepresentations()
The current behavior
Throws an error: Multiple segmentation representations detected for this tool group. The first one will be used.
However, when I have two cornerstone3DTools.Enums.SegmentationRepresentations.Labelmap along with another cornerstone3DTools.Enums.SegmentationRepresentations.Contour, I do not face any such errors.
Describe the Bug
Error context
I add two CONTOURS to my segmentations.
Error 1
And then I get an error pointing to my script.
Error 2
If I scroll through the contours, I then get the same error, but pointing to internal cornerstone3D code
Steps to Reproduce
cornerstone3DTools.Enums.SegmentationRepresentations.Contour
by usingcornerstone3DTools.segmentation.addSegmentationRepresentations()
The current behavior
Throws an error:
Multiple segmentation representations detected for this tool group. The first one will be used.
However, when I have twocornerstone3DTools.Enums.SegmentationRepresentations.Labelmap
along with anothercornerstone3DTools.Enums.SegmentationRepresentations.Contour
, I do not face any such errors.The expected behavior
There should be no error thrown
OS
MacOS v14.2 (Sonoma)
Node version
20.8.0
Browser
Brave (Version 1.66.118)