From 9fb1d029e13d6128d8c6bb332de80c7f5fb33303 Mon Sep 17 00:00:00 2001 From: Paul Elliott Date: Thu, 24 Oct 2024 19:47:56 -0400 Subject: [PATCH] fix(segmentGroups): use DICOM series number to match with image seg files Also fix trying to get the image name out of the image store after deleting the image from the image store. --- src/actions/loadUserFiles.ts | 6 +++++- src/store/segmentGroups.ts | 4 +++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/actions/loadUserFiles.ts b/src/actions/loadUserFiles.ts index 351b1447..abfb1339 100644 --- a/src/actions/loadUserFiles.ts +++ b/src/actions/loadUserFiles.ts @@ -112,7 +112,11 @@ function filterMatchingNames( succeeded: Array>, extension: string ) { - const primaryName = getDataSourceName(primaryDataSource.dataSource); + const dicomStore = useDICOMStore(); + const primaryName = + primaryDataSource.dataType === 'dicom' + ? dicomStore.volumeInfo[primaryDataSource.dataID].SeriesNumber + : getDataSourceName(primaryDataSource.dataSource); if (!primaryName) return []; const primaryNamePrefix = primaryName.split('.').slice(0, 1).join(); return filterLoadableDataSources(succeeded) diff --git a/src/store/segmentGroups.ts b/src/store/segmentGroups.ts index 726511d1..282ad706 100644 --- a/src/store/segmentGroups.ts +++ b/src/store/segmentGroups.ts @@ -304,6 +304,9 @@ export const useSegmentGroupStore = defineStore('segmentGroup', () => { ); } + // cache name before deleting + const baseName = imageStore.metadata[imageID].name; + // Don't remove image if DICOM. User may have selected segment group image as primary selection by now const deleteImage = isRegularImage(imageID); if (deleteImage) { @@ -318,7 +321,6 @@ export const useSegmentGroupStore = defineStore('segmentGroup', () => { const images = componentCount === 1 ? [childImage] : extractEachComponent(childImage); - const baseName = imageStore.metadata[imageID].name; images.forEach(async (image, component) => { const matchingParentSpace = await ensureSameSpace( parentImage,