From f5e0653c3799e2b2b8c4f8246d18215901b2e1f7 Mon Sep 17 00:00:00 2001 From: Andre Almeida Date: Fri, 6 Sep 2024 22:41:14 -0400 Subject: [PATCH] Fixing ContourSegmentationBaseTool filter validation --- .../tools/src/tools/base/ContourSegmentationBaseTool.ts | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/packages/tools/src/tools/base/ContourSegmentationBaseTool.ts b/packages/tools/src/tools/base/ContourSegmentationBaseTool.ts index 733e416da3..b6778d4988 100644 --- a/packages/tools/src/tools/base/ContourSegmentationBaseTool.ts +++ b/packages/tools/src/tools/base/ContourSegmentationBaseTool.ts @@ -294,13 +294,16 @@ abstract class ContourSegmentationBaseTool extends ContourBaseTool { private _getSegmentationRepresentation(segmentationId) { const segmentationRepresentations = - segmentationState.getSegmentationRepresentations(this.toolGroupId); + segmentationState.getSegmentationRepresentations(this.toolGroupId) || []; const validSegmentationRepresentations = segmentationRepresentations.filter( (representation) => representation.segmentationId === segmentationId ); - if (!validSegmentationRepresentations) { + if ( + !validSegmentationRepresentations || + validSegmentationRepresentations.length === 0 + ) { console.warn( `No segmentation representation found for toolGroupId: ${this.toolGroupId}` );