From 9522fe59122a271befe361f4d0891069abc69364 Mon Sep 17 00:00:00 2001 From: Paul Elliott Date: Wed, 15 Nov 2023 15:20:11 -0500 Subject: [PATCH 1/2] fix(paint): fix paint not drawing if selected at start If session.volview.zip is loaded with the paint tool initially selected, clicking on the image did not paint. Fix is to pass correct idMap to paint tool and only `setActiveSegment` when a segmentGroup is selected. --- src/store/tools/index.ts | 4 ++++ src/store/tools/paint.ts | 3 ++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/store/tools/index.ts b/src/store/tools/index.ts index ccf52f3d0..bd6988028 100644 --- a/src/store/tools/index.ts +++ b/src/store/tools/index.ts @@ -95,7 +95,11 @@ export const useToolStore = defineStore('tool', { ) { const { tools } = manifest; + usePaintToolStore().deserialize(manifest, segmentGroupIDMap); + Object.values(ToolStoreMap) + // paint store uses segmentGroupIDMap + .filter((useStore) => useStore !== usePaintToolStore) .map((useStore) => useStore?.()) .filter((store): store is IToolStore => !!store) .forEach((store) => { diff --git a/src/store/tools/paint.ts b/src/store/tools/paint.ts index 431d96f5e..e7716e657 100644 --- a/src/store/tools/paint.ts +++ b/src/store/tools/paint.ts @@ -191,13 +191,14 @@ export const usePaintToolStore = defineStore('paint', () => { ) { const { paint } = manifest.tools; setBrushSize.call(this, paint.brushSize); - setActiveSegment.call(this, paint.activeSegment); setLabelmapOpacity.call(this, paint.labelmapOpacity); isActive.value = manifest.tools.current === Tools.Paint; if (paint.activeSegmentGroupID !== null) { activeSegmentGroupID.value = segmentGroupIDMap[paint.activeSegmentGroupID]; + setActiveLabelmap(activeSegmentGroupID.value); + setActiveSegment.call(this, paint.activeSegment); } } From 155da25ac1e9d422e1a97ff544a2fe75220587fb Mon Sep 17 00:00:00 2001 From: Paul Elliott Date: Wed, 15 Nov 2023 15:23:01 -0500 Subject: [PATCH 2/2] fix(paint): stencil size is correct for when mouse starts in view If paint tool is activated when mouse is within a view, the stencil shape would not be correct. So call setSliceAxis at widget startup. --- src/components/tools/paint/PaintWidget2D.vue | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/components/tools/paint/PaintWidget2D.vue b/src/components/tools/paint/PaintWidget2D.vue index ffa5269c5..bf09c8634 100644 --- a/src/components/tools/paint/PaintWidget2D.vue +++ b/src/components/tools/paint/PaintWidget2D.vue @@ -155,7 +155,8 @@ export default defineComponent({ const viewInteractor = computed(() => viewProxy.value!.getInteractor()); - // Turn on widget visibility if mouse starts within view + // Turn on widget visibility and update stencil + // if mouse starts within view onVTKEvent(viewInteractor, 'onMouseMove', () => { if (!checkIfPointerInView) { return; @@ -163,6 +164,7 @@ export default defineComponent({ checkIfPointerInView = false; widgetRef.value!.setVisibility(true); + paintStore.setSliceAxis(viewAxisIndex.value); }); onVTKEvent(viewInteractor, 'onMouseEnter', () => {