diff --git a/src/components/ImageDataBrowser.vue b/src/components/ImageDataBrowser.vue index 48b2c82d8..cbe5fe0de 100644 --- a/src/components/ImageDataBrowser.vue +++ b/src/components/ImageDataBrowser.vue @@ -4,6 +4,7 @@ import ItemGroup from '@/src/components/ItemGroup.vue'; import GroupableItem from '@/src/components/GroupableItem.vue'; import ImageListCard from '@/src/components/ImageListCard.vue'; import { createVTKImageThumbnailer } from '@/src/core/thumbnailers/vtk-image'; +import { useSegmentGroupStore } from '@/src/store/segmentGroups'; import { useImageStore } from '../store/datasets-images'; import { useDICOMStore } from '../store/datasets-dicom'; import { @@ -30,6 +31,7 @@ export default defineComponent({ const dicomStore = useDICOMStore(); const dataStore = useDatasetStore(); const layersStore = useLayersStore(); + const segmentGroupStore = useSegmentGroupStore(); const primarySelection = computed(() => dataStore.primarySelection); @@ -62,7 +64,8 @@ export default defineComponent({ const isLayer = layerImageIDs.includes(id); const layerLoaded = loadedLayerImageIDs.includes(id); const layerLoading = isLayer && !layerLoaded; - const layerable = id !== selectedImageID && primarySelection.value; + const layerable = + id !== selectedImageID && primarySelection.value != null; return { id, cacheKey: imageCacheKey(id), @@ -132,6 +135,15 @@ export default defineComponent({ selected.value = []; } + function convertToLabelMap(key: string) { + if (primarySelection.value) { + segmentGroupStore.convertImageToLabelmap( + { type: 'image', dataID: key }, + primarySelection.value + ); + } + } + function removeData(id: string) { imageStore.deleteData(id); } @@ -143,6 +155,7 @@ export default defineComponent({ toggleSelectAll, removeSelection, removeData, + convertToLabelMap, images, thumbnails, primarySelection, @@ -244,6 +257,24 @@ export default defineComponent({ Add as layer + + mdi-alert + Convert to Segment Group + + Must load a background image before converting + + Delete diff --git a/src/components/SegmentGroupControls.vue b/src/components/SegmentGroupControls.vue index cfeebec56..56e77597b 100644 --- a/src/components/SegmentGroupControls.vue +++ b/src/components/SegmentGroupControls.vue @@ -1,6 +1,9 @@