Skip to content

Commit

Permalink
Fixing ContourSegmentationBaseTool filter validation
Browse files Browse the repository at this point in the history
  • Loading branch information
andrebot committed Sep 7, 2024
1 parent 7aadb83 commit f5e0653
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions packages/tools/src/tools/base/ContourSegmentationBaseTool.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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}`
);
Expand Down

0 comments on commit f5e0653

Please sign in to comment.