fix(segmentation): Allow for manually added label map and contour segmentations to be used as viewport data overlays. (#5562)

This commit is contained in:
Joe Boccanfuso authored and GitHub committed 2025-11-13 07:12:28 -05:00
1 parent 5c44fe06dc
commit 02f6744dab
4 files changed
+25 -15

No files matched your search

@@ -125,6 +125,7 @@ describe('setUpSegmentationEventHandlers', () => {
it('should create and add display set when segmentation is added and no displaySet exists', () => {
const mockSegmentation = {
label: 'Test Segmentation Label',
cachedStats: {
info: 'Test Segmentation Label',
},
@@ -151,12 +152,12 @@ describe('setUpSegmentationEventHandlers', () => {
displaySetInstanceUID: 'test-segmentation-id',
SOPClassUID: '1.2.840.10008.5.1.4.1.1.66.4',
SOPClassHandlerId: '@ohif/extension-cornerstone-dicom-seg.sopClassHandlerModule.dicom-seg',
SeriesDescription: mockSegmentation.cachedStats.info,
SeriesDescription: mockSegmentation.label,
Modality: 'SEG',
numImageFrames: mockSegmentation.representationData.Labelmap.imageIds.length,
imageIds: mockSegmentation.representationData.Labelmap.imageIds,
isOverlayDisplaySet: true,
label: mockSegmentation.cachedStats.info,
label: mockSegmentation.label,
madeInClient: true,
segmentationId: 'test-segmentation-id',
isDerived: true,
@@ -165,6 +166,7 @@ describe('setUpSegmentationEventHandlers', () => {
it('should handle displaySet undefined when segmentation is added', () => {
const mockSegmentation = {
label: 'Test Segmentation Label',
cachedStats: {
info: 'Test Segmentation Label',
},
@@ -190,12 +192,12 @@ describe('setUpSegmentationEventHandlers', () => {
displaySetInstanceUID: 'test-segmentation-id',
SOPClassUID: '1.2.840.10008.5.1.4.1.1.66.4',
SOPClassHandlerId: '@ohif/extension-cornerstone-dicom-seg.sopClassHandlerModule.dicom-seg',
SeriesDescription: mockSegmentation.cachedStats.info,
SeriesDescription: mockSegmentation.label,
Modality: 'SEG',
numImageFrames: mockSegmentation.representationData.Labelmap.imageIds.length,
imageIds: mockSegmentation.representationData.Labelmap.imageIds,
isOverlayDisplaySet: true,
label: mockSegmentation.cachedStats.info,
label: mockSegmentation.label,
madeInClient: true,
segmentationId: 'test-segmentation-id',
isDerived: true,
@@ -204,6 +206,7 @@ describe('setUpSegmentationEventHandlers', () => {
it('should handle empty imageIds array', () => {
const mockSegmentation = {
label: 'Empty Segmentation',
cachedStats: {
info: 'Empty Segmentation',
},
@@ -228,12 +231,12 @@ describe('setUpSegmentationEventHandlers', () => {
displaySetInstanceUID: 'empty-segmentation-id',
SOPClassUID: '1.2.840.10008.5.1.4.1.1.66.4',
SOPClassHandlerId: '@ohif/extension-cornerstone-dicom-seg.sopClassHandlerModule.dicom-seg',
SeriesDescription: mockSegmentation.cachedStats.info,
SeriesDescription: mockSegmentation.label,
Modality: 'SEG',
numImageFrames: 0,
imageIds: [],
isOverlayDisplaySet: true,
label: mockSegmentation.cachedStats.info,
label: mockSegmentation.label,
madeInClient: true,
segmentationId: 'empty-segmentation-id',
isDerived: true,
@@ -242,6 +245,7 @@ describe('setUpSegmentationEventHandlers', () => {
it('should handle different segmentation label values', () => {
const mockSegmentation = {
label: 'Custom Label Text',
cachedStats: {
info: 'Custom Label Text',
},
@@ -280,6 +284,7 @@ describe('setUpSegmentationEventHandlers', () => {
it('should handle multiple segmentation events', () => {
const mockSegmentation1 = {
label: 'Segmentation 1',
cachedStats: {
info: 'Segmentation 1',
},
@@ -291,6 +296,7 @@ describe('setUpSegmentationEventHandlers', () => {
};
const mockSegmentation2 = {
label: 'Segmentation 2',
cachedStats: {
info: 'Segmentation 2',
},
@@ -318,12 +324,12 @@ describe('setUpSegmentationEventHandlers', () => {
displaySetInstanceUID: 'segmentation-1',
SOPClassUID: '1.2.840.10008.5.1.4.1.1.66.4',
SOPClassHandlerId: '@ohif/extension-cornerstone-dicom-seg.sopClassHandlerModule.dicom-seg',
SeriesDescription: mockSegmentation1.cachedStats.info,
SeriesDescription: mockSegmentation1.label,
Modality: 'SEG',
numImageFrames: 1,
imageIds: mockSegmentation1.representationData.Labelmap.imageIds,
isOverlayDisplaySet: true,
label: mockSegmentation1.cachedStats.info,
label: mockSegmentation1.label,
madeInClient: true,
segmentationId: 'segmentation-1',
isDerived: true,
@@ -332,12 +338,12 @@ describe('setUpSegmentationEventHandlers', () => {
displaySetInstanceUID: 'segmentation-2',
SOPClassUID: '1.2.840.10008.5.1.4.1.1.66.4',
SOPClassHandlerId: '@ohif/extension-cornerstone-dicom-seg.sopClassHandlerModule.dicom-seg',
SeriesDescription: mockSegmentation2.cachedStats.info,
SeriesDescription: mockSegmentation2.label,
Modality: 'SEG',
numImageFrames: 2,
imageIds: mockSegmentation2.representationData.Labelmap.imageIds,
isOverlayDisplaySet: true,
label: mockSegmentation2.cachedStats.info,
label: mockSegmentation2.label,
madeInClient: true,
segmentationId: 'segmentation-2',
isDerived: true,