From 0c8946cfbd242976876353f137714c4af02558bb Mon Sep 17 00:00:00 2001 From: Paul Elliott Date: Thu, 7 Nov 2024 12:40:45 -0500 Subject: [PATCH] fix(segment groups): fix typing --- src/components/vtk/VtkLayerSliceRepresentation.vue | 4 +++- src/components/vtk/VtkSegmentationSliceRepresentation.vue | 4 ++++ src/io/state-file/schema.ts | 1 + 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/src/components/vtk/VtkLayerSliceRepresentation.vue b/src/components/vtk/VtkLayerSliceRepresentation.vue index 553c7951..f34ef58e 100644 --- a/src/components/vtk/VtkLayerSliceRepresentation.vue +++ b/src/components/vtk/VtkLayerSliceRepresentation.vue @@ -73,7 +73,9 @@ const applyLayerColoring = () => { if (!config) return; const cfun = sliceRep.property.getRGBTransferFunction(0); - const ofun = sliceRep.property.getScalarOpacity(0); + const ofun = sliceRep.property.getPiecewiseFunction(0); + + if (!cfun || !ofun) throw new Error('Missing transfer functions'); applyColoring({ props: { diff --git a/src/components/vtk/VtkSegmentationSliceRepresentation.vue b/src/components/vtk/VtkSegmentationSliceRepresentation.vue index 79663ae2..01017f8f 100644 --- a/src/components/vtk/VtkSegmentationSliceRepresentation.vue +++ b/src/components/vtk/VtkSegmentationSliceRepresentation.vue @@ -105,6 +105,8 @@ const applySegmentColoring = () => { const cfun = sliceRep.property.getRGBTransferFunction(0); const ofun = sliceRep.property.getPiecewiseFunction(0); + if (!cfun || !ofun) throw new Error('Missing transfer functions'); + cfun.removeAllPoints(); ofun.removeAllPoints(); @@ -142,10 +144,12 @@ const config = computed(() => ); const outlineThickness = computed(() => config.value?.outlineThickness ?? 2); +// @ts-expect-error vtk.js types are incomplete sliceRep.property.setUseLabelOutline(true); sliceRep.property.setUseLookupTableScalarRange(true); watchEffect(() => { + // @ts-expect-error vtk.js types are incomplete sliceRep.property.setLabelOutlineOpacity(config.value?.outlineOpacity ?? 1); }); diff --git a/src/io/state-file/schema.ts b/src/io/state-file/schema.ts index 536fb279..980990fb 100644 --- a/src/io/state-file/schema.ts +++ b/src/io/state-file/schema.ts @@ -218,6 +218,7 @@ const LayersConfig = z.object({ const SegmentGroupConfig = z.object({ outlineOpacity: z.number(), + outlineThickness: z.number(), }) satisfies z.ZodType; const ViewConfig = z.object({