Skip to content

Commit c45511a

Browse files
committed
fix(cine): disable segment group actions
1 parent 1d34f3a commit c45511a

2 files changed

Lines changed: 14 additions & 1 deletion

File tree

src/components/SegmentGroupControls.vue

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,14 @@ import { usePaintToolStore } from '@/src/store/tools/paint';
1616
import { Maybe } from '@/src/types';
1717
import { reactive, ref, computed, watch, toRaw } from 'vue';
1818
import { useMultiSelection } from '@/src/composables/useMultiSelection';
19+
import { isCineImage } from '@/src/core/cine/isCineImage';
1920
2021
const UNNAMED_GROUP_NAME = 'Unnamed Segment Group';
2122
2223
const segmentGroupStore = useSegmentGroupStore();
2324
const { currentImageID } = useCurrentImage();
2425
const dataStore = useDatasetStore();
26+
const isCurrentImageCine = computed(() => isCineImage(currentImageID.value));
2527
2628
const currentSegmentGroups = computed(() => {
2729
if (!currentImageID.value) return [];
@@ -117,6 +119,7 @@ function stopEditing(commit: boolean) {
117119
function createSegmentGroup() {
118120
if (!currentImageID.value)
119121
throw new Error('Cannot create a labelmap without a base image');
122+
if (isCurrentImageCine.value) return;
120123
121124
const id = segmentGroupStore.newLabelmapFromImage(currentImageID.value);
122125
if (!id) throw new Error('Could not create a new labelmap');
@@ -152,6 +155,7 @@ function createSegmentGroupFromImage(selection: DataSelection) {
152155
if (!primarySelection) {
153156
throw new Error('No primary selection');
154157
}
158+
if (isCurrentImageCine.value) return;
155159
segmentGroupStore.convertImageToLabelmap(selection, primarySelection);
156160
}
157161
@@ -228,6 +232,7 @@ function deleteSelected() {
228232
variant="tonal"
229233
color="secondary"
230234
density="compact"
235+
:disabled="isCurrentImageCine"
231236
@click.stop="createSegmentGroup"
232237
>
233238
<v-icon class="mr-1">mdi-plus</v-icon> New Group
@@ -238,6 +243,7 @@ function deleteSelected() {
238243
variant="tonal"
239244
color="secondary"
240245
density="compact"
246+
:disabled="isCurrentImageCine"
241247
v-bind="props"
242248
>
243249
<v-icon class="mr-1">mdi-chevron-down</v-icon>From Image

src/components/tools/polygon/PolygonTool.vue

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
:tool-store="activeToolStore"
2020
v-slot="{ context }"
2121
>
22-
<v-list-item @click.stop>
22+
<v-list-item v-if="!isCurrentImageCine" @click.stop>
2323
<template #prepend>
2424
<v-icon>mdi-grid</v-icon>
2525
</template>
@@ -119,6 +119,7 @@ import { usePaintToolStore } from '@/src/store/tools/paint';
119119
import { useSegmentGroupStore } from '@/src/store/segmentGroups';
120120
import ColorDot from '@/src/components/ColorDot.vue';
121121
import { SegmentMask } from '@/src/types/segment';
122+
import { isCineImage } from '@/src/core/cine/isCineImage';
122123
123124
const useActiveToolStore = usePolygonStore;
124125
const toolType = Tools.Polygon;
@@ -271,7 +272,9 @@ export default defineComponent({
271272
272273
const segmentGroupStore = useSegmentGroupStore();
273274
const paintStore = usePaintToolStore();
275+
const isCurrentImageCine = computed(() => isCineImage(imageId.value));
274276
const currentSegmentGroup = computed(() => {
277+
if (isCurrentImageCine.value) return null;
275278
if (!imageId.value) return null;
276279
const groups = segmentGroupStore.orderByParent[imageId.value];
277280
if (!groups?.length) return null;
@@ -282,6 +285,9 @@ export default defineComponent({
282285
if (!imageId.value) {
283286
throw new Error('No image ID available for rasterization');
284287
}
288+
if (isCurrentImageCine.value) {
289+
throw new Error('Rasterization is not supported for cine images');
290+
}
285291
286292
const groups = segmentGroupStore.orderByParent[imageId.value];
287293
if (!groups?.length) {
@@ -346,6 +352,7 @@ export default defineComponent({
346352
overlayInfo,
347353
rasterize,
348354
currentSegmentGroup,
355+
isCurrentImageCine,
349356
};
350357
},
351358
});

0 commit comments

Comments
 (0)