Skip to content

Commit 76df00a

Browse files
committed
refactor(paintProcess): address PR review feedback
- Rename store from 'process' to 'paintProcess' to better reflect paint-oriented purpose - Rename computeProcess function to startProcess for clarity - Export sigma constants directly from module instead of through store - Update all import statements to use @/src/store alias pattern
1 parent b8e954d commit 76df00a

6 files changed

Lines changed: 31 additions & 22 deletions

File tree

src/components/GaussianSmoothParameterControls.vue

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,14 +34,18 @@
3434

3535
<script setup lang="ts">
3636
import { computed } from 'vue';
37+
import {
38+
useGaussianSmoothStore,
39+
MIN_SIGMA,
40+
MAX_SIGMA,
41+
} from '@/src/store/tools/gaussianSmooth';
42+
import { usePaintProcessStore } from '@/src/store/tools/paintProcess';
3743
import MiniExpansionPanel from './MiniExpansionPanel.vue';
38-
import { useGaussianSmoothStore } from '../store/tools/gaussianSmooth';
39-
import { useProcessStore } from '../store/tools/process';
4044
4145
const gaussianSmoothStore = useGaussianSmoothStore();
42-
const processStore = useProcessStore();
46+
const processStore = usePaintProcessStore();
4347
4448
const sigma = computed(() => gaussianSmoothStore.sigma);
4549
const isDisabled = computed(() => processStore.processStep === 'previewing');
46-
const { MIN_SIGMA, MAX_SIGMA, setSigma } = gaussianSmoothStore;
50+
const { setSigma } = gaussianSmoothStore;
4751
</script>

src/components/ProcessControls.vue

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,15 +16,18 @@
1616

1717
<script setup lang="ts">
1818
import { computed } from 'vue';
19-
import { ProcessType, useProcessStore } from '../store/tools/process';
19+
import {
20+
ProcessType,
21+
usePaintProcessStore,
22+
} from '@/src/store/tools/paintProcess';
2023
import ProcessTypeSelector from './ProcessTypeSelector.vue';
2124
import ProcessWorkflow from './ProcessWorkflow.vue';
2225
import FillBetweenParameterControls from './FillBetweenParameterControls.vue';
2326
import GaussianSmoothParameterControls from './GaussianSmoothParameterControls.vue';
2427
import { useFillBetweenStore } from '../store/tools/fillBetween';
2528
import { useGaussianSmoothStore } from '../store/tools/gaussianSmooth';
2629
27-
const processStore = useProcessStore();
30+
const processStore = usePaintProcessStore();
2831
const fillBetweenStore = useFillBetweenStore();
2932
const gaussianSmoothStore = useGaussianSmoothStore();
3033

src/components/ProcessTypeSelector.vue

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,9 +42,12 @@
4242

4343
<script setup lang="ts">
4444
import { computed } from 'vue';
45-
import { ProcessType, useProcessStore } from '../store/tools/process';
45+
import {
46+
ProcessType,
47+
usePaintProcessStore,
48+
} from '@/src/store/tools/paintProcess';
4649
47-
const processStore = useProcessStore();
50+
const processStore = usePaintProcessStore();
4851
4952
const activeProcessType = computed({
5053
get: () => processStore.activeProcessType,

src/components/ProcessWorkflow.vue

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -47,16 +47,19 @@
4747

4848
<script setup lang="ts">
4949
import { computed } from 'vue';
50-
import { useProcessStore, type ProcessAlgorithm } from '../store/tools/process';
51-
import { usePaintToolStore } from '../store/tools/paint';
50+
import {
51+
usePaintProcessStore,
52+
type ProcessAlgorithm,
53+
} from '@/src/store/tools/paintProcess';
54+
import { usePaintToolStore } from '@/src/store/tools/paint';
5255
5356
interface Props {
5457
algorithm: ProcessAlgorithm;
5558
}
5659
5760
const props = defineProps<Props>();
5861
59-
const processStore = useProcessStore();
62+
const processStore = usePaintProcessStore();
6063
const paintStore = usePaintToolStore();
6164
6265
const processStep = computed(() => processStore.processStep);
@@ -65,7 +68,7 @@ const showingOriginal = computed(() => processStore.showingOriginal);
6568
function startCompute() {
6669
const id = paintStore.activeSegmentGroupID;
6770
if (!id) return;
68-
processStore.computeProcess(id, props.algorithm);
71+
processStore.startProcess(id, props.algorithm);
6972
}
7073
7174
function handleToggleChange(value: number | string) {

src/store/tools/gaussianSmooth.ts

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@ import * as Comlink from 'comlink';
44
import vtkLabelMap from '@/src/vtk/LabelMap';
55
import { gaussianSmoothLabelMapWorker } from '@/src/core/tools/paint/gaussianSmooth.worker';
66

7-
const DEFAULT_SIGMA = 1.0;
8-
const MIN_SIGMA = 0.1;
9-
const MAX_SIGMA = 5.0;
7+
export const DEFAULT_SIGMA = 1.0;
8+
export const MIN_SIGMA = 0.1;
9+
export const MAX_SIGMA = 5.0;
1010

1111
// Worker management
1212
type WorkerApi = {
@@ -74,9 +74,5 @@ export const useGaussianSmoothStore = defineStore('gaussianSmooth', () => {
7474
sigma,
7575
setSigma,
7676
computeAlgorithm,
77-
// Expose constants for UI
78-
MIN_SIGMA,
79-
MAX_SIGMA,
80-
DEFAULT_SIGMA,
8177
};
8278
});
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ export type ProcessAlgorithm = (
4141
activeSegment: number
4242
) => Promise<TypedArray | number[]>;
4343

44-
export const useProcessStore = defineStore('process', () => {
44+
export const usePaintProcessStore = defineStore('paintProcess', () => {
4545
const processState = ref<ProcessState>({ step: 'start' });
4646
const activeProcessType = ref<ProcessType>(ProcessType.FillBetween);
4747

@@ -89,7 +89,7 @@ export const useProcessStore = defineStore('process', () => {
8989
activeProcessType.value = processType;
9090
}
9191

92-
async function computeProcess(groupId: string, algorithm: ProcessAlgorithm) {
92+
async function startProcess(groupId: string, algorithm: ProcessAlgorithm) {
9393
const segImage = segmentGroupStore.dataIndex[groupId];
9494
const state = processState.value;
9595

@@ -200,7 +200,7 @@ export const useProcessStore = defineStore('process', () => {
200200
activeProcessType,
201201
showingOriginal,
202202
setActiveProcessType,
203-
computeProcess,
203+
startProcess,
204204
confirmProcess,
205205
cancelProcess,
206206
togglePreview,

0 commit comments

Comments
 (0)