From 5807889f799ecafeb5038da1e006a36a079c9928 Mon Sep 17 00:00:00 2001 From: Bill Wallace Date: Fri, 30 Jan 2026 11:16:37 -0500 Subject: [PATCH] Fix/duplicate redundant log measurement mapping (#5760) * Remove all but one log message for mappings. * fix: NPE when no segmentations list returned. --- .../src/utils/CornerstoneViewportDownloadForm.tsx | 2 +- .../src/services/MeasurementService/MeasurementService.ts | 7 ++++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/extensions/cornerstone/src/utils/CornerstoneViewportDownloadForm.tsx b/extensions/cornerstone/src/utils/CornerstoneViewportDownloadForm.tsx index 0d4c72b50..81e70c19f 100644 --- a/extensions/cornerstone/src/utils/CornerstoneViewportDownloadForm.tsx +++ b/extensions/cornerstone/src/utils/CornerstoneViewportDownloadForm.tsx @@ -129,7 +129,7 @@ const CornerstoneViewportDownloadForm = ({ downloadViewport.setVolumes([{ volumeId: volumeIds[0] }]); } - if (segmentationRepresentations.length > 0) { + if (segmentationRepresentations?.length) { segmentationRepresentations.forEach(segRepresentation => { const { segmentationId, colorLUTIndex, type } = segRepresentation; if (type === Enums.SegmentationRepresentations.Labelmap) { diff --git a/platform/core/src/services/MeasurementService/MeasurementService.ts b/platform/core/src/services/MeasurementService/MeasurementService.ts index 97f978181..7bde5c587 100644 --- a/platform/core/src/services/MeasurementService/MeasurementService.ts +++ b/platform/core/src/services/MeasurementService/MeasurementService.ts @@ -102,6 +102,8 @@ enum MeasurementChangeType { export type MeasurementFilter = (measurement) => boolean; +const sourceMissing = new Set(); + /** * MeasurementService class that supports source management and measurement management. * Sources can be any library that can provide "annotations" (e.g. cornerstone-tools, cornerstone, etc.) @@ -497,7 +499,10 @@ class MeasurementService extends PubSubService { mapping => mapping.annotationType === annotationType ); if (!sourceMapping) { - console.log('No source mapping', source.uid, annotationType, source); + if (!sourceMissing.has(source.uid) ) { + console.log('No source mapping', source.uid, annotationType, source); + sourceMissing.add(source.uid); + } this.addUnmappedMeasurement(sourceAnnotationDetail, source); return; }