Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions src/components/ObliqueSliceViewer.vue
Original file line number Diff line number Diff line change
Expand Up @@ -145,10 +145,15 @@
// setup plane origin/normal
const planeOrigin = vtkFieldRef(resliceCursorState, {
get: () => resliceCursorState.getCenter(),
set: (v) => resliceCursor.setCenter(v),
set: (v) => {
resliceCursor.setCenter(v);
return true;
},
});
const planes = vtkFieldRef(resliceCursorState, 'planes');

Check failure on line 153 in src/components/ObliqueSliceViewer.vue

View workflow job for this annotation

GitHub Actions / Code check and tests

No overload matches this call.

Check failure on line 153 in src/components/ObliqueSliceViewer.vue

View workflow job for this annotation

GitHub Actions / E2E Testing on ubuntu-latest

No overload matches this call.

Check failure on line 153 in src/components/ObliqueSliceViewer.vue

View workflow job for this annotation

GitHub Actions / E2E Testing on macos-latest

No overload matches this call.
const planeNormal = computed(() => planes.value[widgetViewType.value].normal);
// The reslice cursor is created with the default X/Y/Z planes, so the entry
// for this view's type is always present.
const planeNormal = computed(() => planes.value[widgetViewType.value]!.normal);

// slicing domain/range

Expand Down
30 changes: 19 additions & 11 deletions src/components/tools/ResliceCursorTool.vue
Original file line number Diff line number Diff line change
@@ -1,9 +1,17 @@
<script setup lang="ts">
import { computed, inject, ref, toRefs } from 'vue';
import {
vtkResliceCursorViewWidget,
ResliceCursorWidgetState,
} from '@kitware/vtk.js/Widgets/Widgets3D/ResliceCursorWidget';
import { vtkResliceCursorWidgetDefaultInstance } from '@kitware/vtk.js/Widgets/Widgets3D/ResliceCursorWidget/behavior';
import { vtkColor3MixinState } from '@kitware/vtk.js/Widgets/Core/StateBuilder/color3Mixin';

Check failure on line 4 in src/components/tools/ResliceCursorTool.vue

View workflow job for this annotation

GitHub Actions / Code check and tests

Could not find a declaration file for module '@kitware/vtk.js/Widgets/Core/StateBuilder/color3Mixin'. '/home/runner/work/VolView/VolView/node_modules/@kitware/vtk.js/Widgets/Core/StateBuilder/color3Mixin.js' implicitly has an 'any' type.

Check failure on line 4 in src/components/tools/ResliceCursorTool.vue

View workflow job for this annotation

GitHub Actions / E2E Testing on ubuntu-latest

Could not find a declaration file for module '@kitware/vtk.js/Widgets/Core/StateBuilder/color3Mixin'. '/home/runner/work/VolView/VolView/node_modules/@kitware/vtk.js/Widgets/Core/StateBuilder/color3Mixin.js' implicitly has an 'any' type.

Check failure on line 4 in src/components/tools/ResliceCursorTool.vue

View workflow job for this annotation

GitHub Actions / E2E Testing on macos-latest

Could not find a declaration file for module '@kitware/vtk.js/Widgets/Core/StateBuilder/color3Mixin'. '/Users/runner/work/VolView/VolView/node_modules/@kitware/vtk.js/Widgets/Core/StateBuilder/color3Mixin.js' implicitly has an 'any' type.
import { vtkScale1MixinState } from '@kitware/vtk.js/Widgets/Core/StateBuilder/scale1Mixin';

Check failure on line 5 in src/components/tools/ResliceCursorTool.vue

View workflow job for this annotation

GitHub Actions / Code check and tests

Could not find a declaration file for module '@kitware/vtk.js/Widgets/Core/StateBuilder/scale1Mixin'. '/home/runner/work/VolView/VolView/node_modules/@kitware/vtk.js/Widgets/Core/StateBuilder/scale1Mixin.js' implicitly has an 'any' type.

Check failure on line 5 in src/components/tools/ResliceCursorTool.vue

View workflow job for this annotation

GitHub Actions / E2E Testing on ubuntu-latest

Could not find a declaration file for module '@kitware/vtk.js/Widgets/Core/StateBuilder/scale1Mixin'. '/home/runner/work/VolView/VolView/node_modules/@kitware/vtk.js/Widgets/Core/StateBuilder/scale1Mixin.js' implicitly has an 'any' type.

Check failure on line 5 in src/components/tools/ResliceCursorTool.vue

View workflow job for this annotation

GitHub Actions / E2E Testing on macos-latest

Could not find a declaration file for module '@kitware/vtk.js/Widgets/Core/StateBuilder/scale1Mixin'. '/Users/runner/work/VolView/VolView/node_modules/@kitware/vtk.js/Widgets/Core/StateBuilder/scale1Mixin.js' implicitly has an 'any' type.
import { vtkScale3MixinState } from '@kitware/vtk.js/Widgets/Core/StateBuilder/scale3Mixin';

Check failure on line 6 in src/components/tools/ResliceCursorTool.vue

View workflow job for this annotation

GitHub Actions / Code check and tests

Could not find a declaration file for module '@kitware/vtk.js/Widgets/Core/StateBuilder/scale3Mixin'. '/home/runner/work/VolView/VolView/node_modules/@kitware/vtk.js/Widgets/Core/StateBuilder/scale3Mixin.js' implicitly has an 'any' type.

Check failure on line 6 in src/components/tools/ResliceCursorTool.vue

View workflow job for this annotation

GitHub Actions / E2E Testing on ubuntu-latest

Could not find a declaration file for module '@kitware/vtk.js/Widgets/Core/StateBuilder/scale3Mixin'. '/home/runner/work/VolView/VolView/node_modules/@kitware/vtk.js/Widgets/Core/StateBuilder/scale3Mixin.js' implicitly has an 'any' type.

Check failure on line 6 in src/components/tools/ResliceCursorTool.vue

View workflow job for this annotation

GitHub Actions / E2E Testing on macos-latest

Could not find a declaration file for module '@kitware/vtk.js/Widgets/Core/StateBuilder/scale3Mixin'. '/Users/runner/work/VolView/VolView/node_modules/@kitware/vtk.js/Widgets/Core/StateBuilder/scale3Mixin.js' implicitly has an 'any' type.

// The reslice cursor builds its sphere handles from the color3/scale1 mixins
// and its line handles from the color3/scale3 mixins.
type SphereHandleState = vtkColor3MixinState & vtkScale1MixinState;
type LineHandleState = vtkColor3MixinState & vtkScale3MixinState;
// Per-axis label queries mix line handles (scale3) with rotation handles
// (scale1), so only the color3 mixin is common to every result.
type ColoredHandleState = vtkColor3MixinState;
import { OBLIQUE_OUTLINE_COLORS } from '@/src/constants';
import { getLPSAxisFromDir, getVTKViewTypeFromLPSAxis } from '@/src/utils/lps';
import { LPSAxisDir } from '@/src/types/lps';
Expand All @@ -27,14 +35,14 @@
const resliceCursorStore = useResliceCursorStore();
const { resliceCursor, resliceCursorState } = resliceCursorStore;

const widget = ref<vtkResliceCursorViewWidget>();
const widget = ref<vtkResliceCursorWidgetDefaultInstance>();
const vtkViewType = computed(() => getVTKViewTypeFromLPSAxis(viewAxis.value));

onViewMounted(view.renderWindowView, () => {
widget.value = view.widgetManager.addWidget(
resliceCursor,
vtkViewType.value
) as vtkResliceCursorViewWidget;
) as vtkResliceCursorWidgetDefaultInstance;

widget.value.setKeepOrthogonality(true);
// reset mouse cursor styles
Expand All @@ -44,14 +52,14 @@
translateAxis: 'default',
});

resliceCursorState.getStatesWithLabel('sphere').forEach((handle) => {

Check failure on line 55 in src/components/tools/ResliceCursorTool.vue

View workflow job for this annotation

GitHub Actions / Code check and tests

Parameter 'handle' implicitly has an 'any' type.

Check failure on line 55 in src/components/tools/ResliceCursorTool.vue

View workflow job for this annotation

GitHub Actions / E2E Testing on ubuntu-latest

Parameter 'handle' implicitly has an 'any' type.
const h = handle as ResliceCursorWidgetState;
const h = handle as SphereHandleState;
h.setScale1(10);
h.setOpacity(128);
});

resliceCursorState.getStatesWithLabel('line').forEach((handle) => {

Check failure on line 61 in src/components/tools/ResliceCursorTool.vue

View workflow job for this annotation

GitHub Actions / Code check and tests

Parameter 'handle' implicitly has an 'any' type.

Check failure on line 61 in src/components/tools/ResliceCursorTool.vue

View workflow job for this annotation

GitHub Actions / E2E Testing on ubuntu-latest

Parameter 'handle' implicitly has an 'any' type.
const h = handle as ResliceCursorWidgetState;
const h = handle as LineHandleState;
h.setScale3(1, 1, 1);
h.setOpacity(100);
});
Expand All @@ -61,7 +69,7 @@
...resliceCursorState.getStatesWithLabel('XinY'),
];
xLines.forEach((handle) => {
const h = handle as ResliceCursorWidgetState;
const h = handle as ColoredHandleState;
h.setColor3(OBLIQUE_OUTLINE_COLORS[InitViewIDs.ObliqueSagittal]);
});

Expand All @@ -70,7 +78,7 @@
...resliceCursorState.getStatesWithLabel('YinX'),
];
yLines.forEach((handle) => {
const h = handle as ResliceCursorWidgetState;
const h = handle as ColoredHandleState;
h.setColor3(OBLIQUE_OUTLINE_COLORS[InitViewIDs.ObliqueCoronal]);
});

Expand All @@ -79,7 +87,7 @@
...resliceCursorState.getStatesWithLabel('ZinY'),
];
zLines.forEach((handle) => {
const h = handle as ResliceCursorWidgetState;
const h = handle as ColoredHandleState;
h.setColor3(OBLIQUE_OUTLINE_COLORS[InitViewIDs.ObliqueAxial]);
});

Expand Down
4 changes: 2 additions & 2 deletions src/composables/useVolumeThumbnailing.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { onBeforeUnmount, reactive, ref, watch } from 'vue';
import { Mode as LookupTableProxyMode } from '@kitware/vtk.js/Proxy/Core/LookupTableProxy';
import vtkImageData from '@kitware/vtk.js/Common/DataModel/ImageData';
import vtkPiecewiseFunctionProxy from '@kitware/vtk.js/Proxy/Core/PiecewiseFunctionProxy';
import vtkColorMaps from '@kitware/vtk.js/Rendering/Core/ColorTransferFunction/ColorMaps';
import { getPresetByName } from '@/src/types/color-map-preset';
import type { Vector3 } from '@kitware/vtk.js/types';
import { createVolumeThumbnailer } from '../core/thumbnailers/volume-thumbnailer';
import { useCameraOrientation } from './useCameraOrientation';
Expand All @@ -22,7 +22,7 @@ function resetOpacityFunction(
// reset pwf proxy range
pwfProxy.setDataRange(...dataRange);

const preset = vtkColorMaps.getPresetByName(presetName);
const preset = getPresetByName(presetName);
if (preset.OpacityPoints) {
const OpacityPoints = preset.OpacityPoints as number[];
const points = [];
Expand Down
Loading
Loading