|
| 1 | +<template> |
| 2 | + <div class="d-flex align-center"> |
| 3 | + <mini-expansion-panel> |
| 4 | + <template #title |
| 5 | + >Fill enclosed holes in the segmentation on the axis of the selected |
| 6 | + view.</template |
| 7 | + > |
| 8 | + <ul> |
| 9 | + <li>Finds background regions fully enclosed by segments on a slice.</li> |
| 10 | + <li> |
| 11 | + Fills holes on the current slice by default, or every slice of the |
| 12 | + active view's axis. |
| 13 | + </li> |
| 14 | + <li> |
| 15 | + All-segments mode fills each hole with the surrounding segment's |
| 16 | + label; selected-segment mode fills only the active segment's holes. |
| 17 | + </li> |
| 18 | + </ul> |
| 19 | + </mini-expansion-panel> |
| 20 | + </div> |
| 21 | + |
| 22 | + <div |
| 23 | + v-for="scope in scopes" |
| 24 | + :key="scope.label" |
| 25 | + class="w-100 px-4 mb-4 d-flex flex-column align-center" |
| 26 | + > |
| 27 | + <div class="text-caption mb-1">{{ scope.label }}</div> |
| 28 | + <v-btn-toggle |
| 29 | + :model-value="scope.value" |
| 30 | + density="compact" |
| 31 | + variant="outlined" |
| 32 | + divided |
| 33 | + mandatory |
| 34 | + :disabled="isDisabled" |
| 35 | + @update:model-value="scope.onChange" |
| 36 | + > |
| 37 | + <v-btn |
| 38 | + v-for="option in scope.options" |
| 39 | + :key="option.value" |
| 40 | + :value="option.value" |
| 41 | + size="small" |
| 42 | + > |
| 43 | + {{ option.label }} |
| 44 | + </v-btn> |
| 45 | + </v-btn-toggle> |
| 46 | + </div> |
| 47 | +</template> |
| 48 | + |
| 49 | +<script setup lang="ts"> |
| 50 | +import { computed } from 'vue'; |
| 51 | +import { |
| 52 | + useFillHolesStore, |
| 53 | + FillHolesSliceScope, |
| 54 | + FillHolesSegmentScope, |
| 55 | +} from '@/src/store/tools/fillHoles'; |
| 56 | +import { usePaintProcessStore } from '@/src/store/tools/paintProcess'; |
| 57 | +import MiniExpansionPanel from './MiniExpansionPanel.vue'; |
| 58 | +
|
| 59 | +const fillHolesStore = useFillHolesStore(); |
| 60 | +const processStore = usePaintProcessStore(); |
| 61 | +
|
| 62 | +const isDisabled = computed(() => processStore.processStep !== 'start'); |
| 63 | +
|
| 64 | +type ScopeControl = { |
| 65 | + label: string; |
| 66 | + value: string; |
| 67 | + onChange: (value: string) => void; |
| 68 | + options: { value: string; label: string }[]; |
| 69 | +}; |
| 70 | +
|
| 71 | +const scopes = computed<ScopeControl[]>(() => [ |
| 72 | + { |
| 73 | + label: 'Slices', |
| 74 | + value: fillHolesStore.sliceScope, |
| 75 | + onChange: (value) => |
| 76 | + fillHolesStore.setSliceScope(value as FillHolesSliceScope), |
| 77 | + options: [ |
| 78 | + { value: FillHolesSliceScope.CurrentSlice, label: 'Current slice' }, |
| 79 | + { value: FillHolesSliceScope.WholeVolume, label: 'All slices' }, |
| 80 | + ], |
| 81 | + }, |
| 82 | + { |
| 83 | + label: 'Segments', |
| 84 | + value: fillHolesStore.segmentScope, |
| 85 | + onChange: (value) => |
| 86 | + fillHolesStore.setSegmentScope(value as FillHolesSegmentScope), |
| 87 | + options: [ |
| 88 | + { value: FillHolesSegmentScope.AllSegments, label: 'All segments' }, |
| 89 | + { |
| 90 | + value: FillHolesSegmentScope.SelectedSegment, |
| 91 | + label: 'Selected segment', |
| 92 | + }, |
| 93 | + ], |
| 94 | + }, |
| 95 | +]); |
| 96 | +</script> |
0 commit comments