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.
'Multiple segmentation representations detected for this tool group. The first one will be used.' is logged when it shouldn't be.
In the function below, which is in ContourSegmentationBaseTool.ts, segmentationState.getSegmentationRepresentations(this.toolGroupId).length > 1 should be validSegmentationRepresentations.length > 1
private _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 multiple segmentation representations to a single toolgroup id.
The current behavior
Despite having different segmentation ids, adding multiple segmentation representations causes the above warning to be logged repeatedly.
The expected behavior
The warning should only be logged if there are more than one segmentation representation with the same segmentation id.
Describe the Bug
'Multiple segmentation representations detected for this tool group. The first one will be used.' is logged when it shouldn't be.
In the function below, which is in ContourSegmentationBaseTool.ts,
segmentationState.getSegmentationRepresentations(this.toolGroupId).length > 1
should bevalidSegmentationRepresentations.length > 1
Steps to Reproduce
The current behavior
Despite having different segmentation ids, adding multiple segmentation representations causes the above warning to be logged repeatedly.
The expected behavior
The warning should only be logged if there are more than one segmentation representation with the same segmentation id.
OS
macOS 15.0.1
Node version
v16.14.0
Browser
Version 129.0.6668.103