diff --git a/extensions/cornerstone-dicom-rt/src/loadRTStruct.js b/extensions/cornerstone-dicom-rt/src/loadRTStruct.js index 613c2fb65..253781700 100644 --- a/extensions/cornerstone-dicom-rt/src/loadRTStruct.js +++ b/extensions/cornerstone-dicom-rt/src/loadRTStruct.js @@ -181,12 +181,6 @@ export default async function loadRTStruct( ContourGeometricType, } = ContourSequenceArray[c]; - const sopInstanceUID = ContourImageSequence.ReferencedSOPInstanceUID; - const imageId = _getImageId(imageIdSopInstanceUidPairs, sopInstanceUID); - - if (!imageId) { - continue; - } let isSupported = false; const points = []; diff --git a/extensions/cornerstone/src/services/SegmentationService/SegmentationService.ts b/extensions/cornerstone/src/services/SegmentationService/SegmentationService.ts index 220b188cb..830d0a311 100644 --- a/extensions/cornerstone/src/services/SegmentationService/SegmentationService.ts +++ b/extensions/cornerstone/src/services/SegmentationService/SegmentationService.ts @@ -816,45 +816,54 @@ class SegmentationService extends PubSubService { const segmentsCachedStats = {}; const initializeContour = async rtStructData => { const { data, id, color, segmentIndex, geometryId } = rtStructData; - const geometry = await geometryLoader.createAndCacheGeometry(geometryId, { - geometryData: { - data, - id, - color, - frameOfReferenceUID: structureSet.frameOfReferenceUID, + + // catch error instead of failing to allow loading to continue + try { + const geometry = await geometryLoader.createAndCacheGeometry( + geometryId, + { + geometryData: { + data, + id, + color, + frameOfReferenceUID: structureSet.frameOfReferenceUID, + segmentIndex, + }, + type: csEnums.GeometryType.CONTOUR, + } + ); + + const contourSet = geometry.data; + const centroid = contourSet.getCentroid(); + + segmentsCachedStats[segmentIndex] = { + center: { world: centroid }, + modifiedTime: rtDisplaySet.SeriesDate, // we use the SeriesDate as the modifiedTime since this is the first time we are creating the segmentation + }; + + segmentation.segments[segmentIndex] = { + label: id, segmentIndex, - }, - type: csEnums.GeometryType.CONTOUR, - }); + color, + ...SEGMENT_CONSTANT, + }; - const contourSet = geometry.data; - const centroid = contourSet.getCentroid(); + const numInitialized = Object.keys(segmentsCachedStats).length; - segmentsCachedStats[segmentIndex] = { - center: { world: centroid }, - modifiedTime: rtDisplaySet.SeriesDate, // we use the SeriesDate as the modifiedTime since this is the first time we are creating the segmentation - }; + // Calculate percentage completed + const percentComplete = Math.round( + (numInitialized / allRTStructData.length) * 100 + ); - segmentation.segments[segmentIndex] = { - label: id, - segmentIndex, - color, - ...SEGMENT_CONSTANT, - }; - - const numInitialized = Object.keys(segmentsCachedStats).length; - - // Calculate percentage completed - const percentComplete = Math.round( - (numInitialized / allRTStructData.length) * 100 - ); - - this._broadcastEvent(EVENTS.SEGMENT_LOADING_COMPLETE, { - percentComplete, - // Note: this is not the geometryIds length since there might be - // some missing ROINumbers - numSegments: allRTStructData.length, - }); + this._broadcastEvent(EVENTS.SEGMENT_LOADING_COMPLETE, { + percentComplete, + // Note: this is not the geometryIds length since there might be + // some missing ROINumbers + numSegments: allRTStructData.length, + }); + } catch (e) { + console.warn(e); + } }; const promiseArray = [];