Skip to content

Commit

Permalink
fix(segmentGroups): use DICOM series number to match with image seg f…
Browse files Browse the repository at this point in the history
…iles

Also fix trying to get the image name out of the image store
after deleting the image from the image store.
  • Loading branch information
PaulHax committed Oct 24, 2024
1 parent 2652cfb commit 9fb1d02
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
6 changes: 5 additions & 1 deletion src/actions/loadUserFiles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,11 @@ function filterMatchingNames(
succeeded: Array<PipelineResultSuccess<ImportResult>>,
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)
Expand Down
4 changes: 3 additions & 1 deletion src/store/segmentGroups.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -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,
Expand Down

0 comments on commit 9fb1d02

Please sign in to comment.