Skip to content

Commit

Permalink
fix(ResliceCursor): thinner footprint
Browse files Browse the repository at this point in the history
Make the visual footprint of the resliceCursor thinner/smaller
so it does not occlude too much of the data image behind it.

Update vtk-js to include fix for changing/disabling mouse cursor styles.
  • Loading branch information
jadh4v committed Aug 2, 2023
1 parent 5738aa3 commit 1a40a6f
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 13 deletions.
14 changes: 7 additions & 7 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
},
"dependencies": {
"@aws-sdk/client-s3": "^3.321.1",
"@kitware/vtk.js": "^28.4.0",
"@kitware/vtk.js": "^28.6.0",
"@netlify/edge-functions": "^2.0.0",
"@sentry/vue": "^7.54.0",
"@vueuse/core": "^8.5.0",
Expand Down
5 changes: 4 additions & 1 deletion src/components/LayoutGrid.vue
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,10 @@ export default defineComponent({
// Construct the common instance of vtkResliceCursorWidget and provide it
// to all the child ObliqueView components.
const resliceCursor = ref<vtkResliceCursorWidget>(vtkResliceCursorWidget.newInstance());
const resliceCursor = ref<vtkResliceCursorWidget>(vtkResliceCursorWidget.newInstance({
scaleInPixels: true,
rotationHandlePosition: 0.75,
}));
provide(VTKResliceCursor, resliceCursor);
// Orient the planes of the vtkResliceCursorWidget to the orientation
// of the currently set image.
Expand Down
11 changes: 8 additions & 3 deletions src/components/tools/ResliceCursorTool.vue
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,6 @@ export default defineComponent({
}
const state = resliceCursor.getWidgetState() as ResliceCursorWidgetState;
state.getStatesWithLabel('sphere').forEach((handle) => (handle as ResliceCursorWidgetState).setScale1(20));
const widget = ref<vtkResliceCursorViewWidget>();
const VTKViewType = computed(() => {
Expand All @@ -79,8 +77,15 @@ export default defineComponent({
VTKViewType.value
) as vtkResliceCursorViewWidget;
widget.value.setScaleInPixels(true);
widget.value.setKeepOrthogonality(true);
// reset mouse cursor styles
widget.value.setCursorStyles({
translateCenter: 'default',
rotateLine: 'default',
translateAxis: 'default',
});
state.getStatesWithLabel('sphere').forEach((handle) => (handle as ResliceCursorWidgetState).setScale1(10));
state.getStatesWithLabel('line').forEach((handle) => (handle as ResliceCursorWidgetState).setScale3(2, 2, 2));
// update representation to not be as 3D
widget.value.getRepresentations().forEach((rep) => {
Expand Down
8 changes: 7 additions & 1 deletion src/shims-vtk.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -246,11 +246,17 @@ declare module '@kitware/vtk.js/Widgets/Widgets3D/ResliceCursorWidget' {
setImage(image: vtkImageData): void;
setKeepOrthogonality(keepOrthogonality: boolean): void;
setScaleInPixels(scaleInPixels: boolean): void;
setCursorStyles(styles: {
translateCenter: string,
rotateLine: string,
translateAxis: string,
}): boolean;
}

export interface ResliceCursorWidgetState extends vtkWidgetState {
placeWidget(bounds: Bounds): void;
setScale1(scale: number): void;
setScale1(scale: number): boolean;
setScale3(scaleX: number, scaleY: number, scaleZ: number): boolean;
getPlanes(): Record<number, { normal: Vector3, viewUp: Vector3, color3: Vector3 }>;
setPlanes(planes: Record<number, { normal: Vector3, viewUp: Vector3, color3: Vector3 }>): void;
getCenter(): Vector3;
Expand Down

0 comments on commit 1a40a6f

Please sign in to comment.