+
+
+ {{ imageName }}
+
+
+
- {{ volume.info.SeriesDescription || '(no description)' }}
+ {{ volume.name }}
diff --git a/src/store/datasets-dicom.ts b/src/store/datasets-dicom.ts
index 45fbdf831..ef9b7f98a 100644
--- a/src/store/datasets-dicom.ts
+++ b/src/store/datasets-dicom.ts
@@ -101,6 +101,22 @@ const readDicomTags = (dicomIO: DICOMIO, file: File) =>
{ name: 'WindowWidth', tag: '0028|1051' },
]);
+/**
+ * Trims and collapses multiple spaces into one.
+ * @param name
+ * @returns string
+ */
+const cleanupName = (name: string) => {
+ return name.trim().replace(/\s+/g, ' ');
+};
+
+export const getDisplayName = (info: VolumeInfo) => {
+ return (
+ cleanupName(info.SeriesDescription || info.SeriesNumber) ||
+ info.SeriesInstanceUID
+ );
+};
+
export const useDICOMStore = defineStore('dicom', {
state: (): State => ({
sliceData: {},
diff --git a/src/store/datasets.ts b/src/store/datasets.ts
index 32d4c8788..103377fa2 100644
--- a/src/store/datasets.ts
+++ b/src/store/datasets.ts
@@ -34,8 +34,10 @@ export type DataSelection = DICOMSelection | ImageSelection;
export const getImageID = (selection: DataSelection) => {
if (selection.type === 'image') return selection.dataID;
- if (selection.type === 'dicom')
- return useDICOMStore().volumeToImageID[selection.volumeKey]; // volume selected, but image may not have been made yet
+ if (selection.type === 'dicom') {
+ // possibly undefined because image may not have been made yet
+ return useDICOMStore().volumeToImageID[selection.volumeKey];
+ }
const _exhaustiveCheck: never = selection;
throw new Error(`invalid selection type ${_exhaustiveCheck}`);