Skip to content

Commit

Permalink
refactor(vtk-js): refactor oblique proxy to vtk-js and other fixes
Browse files Browse the repository at this point in the history
This commit should be squashed before merging the PR.
  • Loading branch information
jadh4v committed Sep 1, 2023
1 parent 7ed11a9 commit 443ff8a
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 145 deletions.
10 changes: 3 additions & 7 deletions src/components/VtkObliqueThreeView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,10 @@ import {
watch,
} from 'vue';
import { storeToRefs } from 'pinia';
import { vec3 } from 'gl-matrix';
import vtkImageDataOutlineFilter from '@kitware/vtk.js/Filters/General/ImageDataOutlineFilter';
import vtkGeometryRepresentationProxy from '@kitware/vtk.js/Proxy/Representations/GeometryRepresentationProxy';
import vtkBoundingBox from '@kitware/vtk.js/Common/DataModel/BoundingBox';
import ViewOverlayGrid from '@src/components/ViewOverlayGrid.vue';
import { useVTKCallback } from '@/src/composables/useVTKCallback';
Expand All @@ -71,7 +71,7 @@ import { useCameraOrientation } from '../composables/useCameraOrientation';
import { InitViewIDs } from '../config';
import { useResizeObserver } from '../composables/useResizeObserver';
import { useCustomEvents } from '../store/custom-events';
import { /* ToolContainer, VTKTwoViewWidgetManager, */ VTKResliceCursor } from '../constants';
import { VTKResliceCursor } from '../constants';
import { useSceneBuilder } from '../composables/useSceneBuilder';
export default defineComponent({
Expand Down Expand Up @@ -169,11 +169,7 @@ export default defineComponent({
const resetCamera = () => {
const bounds = currentImageMetadata.value.worldBounds;
const center = [
(bounds[0] + bounds[1]) / 2,
(bounds[2] + bounds[3]) / 2,
(bounds[4] + bounds[5]) / 2,
] as vec3;
const center = vtkBoundingBox.getCenter(bounds);
viewProxy.value.updateCamera(
cameraDirVec.value,
Expand Down
6 changes: 4 additions & 2 deletions src/components/VtkObliqueView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -135,9 +135,9 @@ import { onKeyStroke } from '@vueuse/core';
import type { Vector3 } from '@kitware/vtk.js/types';
import vtkMatrixBuilder from '@kitware/vtk.js/Common/Core/MatrixBuilder';
import vtkReslicReperesentationProxy from '@kitware/vtk.js/Proxy/Representations/ResliceRepresentationProxy';
import { useResizeToFit } from '@src/composables/useResizeToFit';
import vtkLPSView2DProxy from '@src/vtk/LPSView2DProxy';
import vtkObliqueRepresentationProxy from '@/src/vtk/ObliqueRepresentationProxy';
import { SlabTypes } from '@kitware/vtk.js/Rendering/Core/ImageResliceMapper/Constants';
import { ViewTypes } from '@kitware/vtk.js/Widgets/Core/WidgetManager/Constants';
import { ResliceCursorWidgetState } from '@kitware/vtk.js/Widgets/Widgets3D/ResliceCursorWidget';
Expand Down Expand Up @@ -287,7 +287,7 @@ export default defineComponent({
});
const { baseImageRep } = useSceneBuilder<
vtkObliqueRepresentationProxy
vtkReslicReperesentationProxy
>(viewID, {
baseImage: curImageID
});
Expand Down Expand Up @@ -482,6 +482,8 @@ export default defineComponent({
baseImageRep,
(obliqueRep) => {
if (obliqueRep) {
obliqueRep.setOutlineVisibility(true);
obliqueRep.setOutlineLineWidth(5.0);
switch(viewDirection.value) {
case 'Left':
case 'Right':
Expand Down
12 changes: 0 additions & 12 deletions src/vtk/ObliqueRepresentationProxy/index.d.ts

This file was deleted.

121 changes: 0 additions & 121 deletions src/vtk/ObliqueRepresentationProxy/index.js

This file was deleted.

6 changes: 3 additions & 3 deletions src/vtk/proxy.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@ import vtkPiecewiseFunctionProxy from '@kitware/vtk.js/Proxy/Core/PiecewiseFunct

import vtkSourceProxy from '@kitware/vtk.js/Proxy/Core/SourceProxy';

import vtkVolumeRepresentationProxy from '@kitware/vtk.js/Proxy/Representations/VolumeRepresentationProxy';
import vtkGeometryRepresentationProxy from '@kitware/vtk.js/Proxy/Representations/GeometryRepresentationProxy';
import vtkResliceRepresentationProxy from '@kitware/vtk.js/Proxy/Representations/ResliceRepresentationProxy';
import vtkVolumeRepresentationProxy from '@kitware/vtk.js/Proxy/Representations/VolumeRepresentationProxy';

import vtkLPSView3DProxy from '@/src/vtk/LPSView3DProxy';
import vtkLPSView2DProxy from '@/src/vtk/LPSView2DProxy';
import vtkIJKSliceRepresentationProxy from '@/src/vtk/IJKSliceRepresentationProxy';
import vtkObliqueRepresentationProxy from '@/src/vtk/ObliqueRepresentationProxy';
import vtkLabelMapSliceRepProxy from '@/src/vtk/LabelMapSliceRepProxy';

function createProxyDefinition(
Expand Down Expand Up @@ -44,7 +44,7 @@ export default {
TrivialProducer: createProxyDefinition(vtkSourceProxy),
},
Representations: {
ImageReslice: createProxyDefinition(vtkObliqueRepresentationProxy),
ImageReslice: createProxyDefinition(vtkResliceRepresentationProxy),
ImageSlice: createProxyDefinition(vtkIJKSliceRepresentationProxy),
LabelMapSlice: createProxyDefinition(vtkLabelMapSliceRepProxy),
Volume: createProxyDefinition(vtkVolumeRepresentationProxy),
Expand Down

0 comments on commit 443ff8a

Please sign in to comment.