From 0dd562c5f157cdf05d96b801ef667974e190ca08 Mon Sep 17 00:00:00 2001 From: Forrest Date: Tue, 12 Sep 2023 15:27:07 -0400 Subject: [PATCH 1/2] revert: currentImageID is now Maybe This reverts commit 4a7f0f951e42e9578570071e32614f1714320edc. --- src/components/VtkTwoView.vue | 6 +++--- src/components/tools/SliceScrollTool.vue | 2 +- src/composables/usePersistCameraConfig.ts | 13 ++++++------- src/composables/useSceneBuilder.ts | 3 +-- src/store/tools/crop.ts | 3 +-- src/store/tools/paint.ts | 3 +-- 6 files changed, 13 insertions(+), 17 deletions(-) diff --git a/src/components/VtkTwoView.vue b/src/components/VtkTwoView.vue index 17df7fb5e..5952d4b76 100644 --- a/src/components/VtkTwoView.vue +++ b/src/components/VtkTwoView.vue @@ -310,7 +310,7 @@ export default defineComponent({ get: () => windowingStore.getConfig(viewID.value, curImageID.value), set: (newValue) => { const imageID = curImageID.value; - if (imageID != null && newValue != null) { + if (imageID !== null && newValue != null) { windowingStore.updateConfig(viewID.value, imageID, newValue); } }, @@ -320,7 +320,7 @@ export default defineComponent({ const windowLevel = computed(() => wlConfig.value?.level); const dicomInfo = computed(() => { if ( - curImageID.value != null && + curImageID.value !== null && curImageID.value in dicomStore.imageIDToVolumeKey ) { const volumeKey = dicomStore.imageIDToVolumeKey[curImageID.value]; @@ -362,7 +362,7 @@ export default defineComponent({ // --- setters --- // const setSlice = (slice: number) => { - if (curImageID.value != null) { + if (curImageID.value !== null) { viewSliceStore.updateConfig(viewID.value, curImageID.value, { slice, }); diff --git a/src/components/tools/SliceScrollTool.vue b/src/components/tools/SliceScrollTool.vue index 0feaf6c51..cd04de824 100644 --- a/src/components/tools/SliceScrollTool.vue +++ b/src/components/tools/SliceScrollTool.vue @@ -96,7 +96,7 @@ export default defineComponent({ range.step, () => scrollVal.value, (slice) => { - if (currentImageID.value != null) { + if (currentImageID.value !== null) { viewSliceStore.updateConfig(viewID.value, currentImageID.value, { slice, }); diff --git a/src/composables/usePersistCameraConfig.ts b/src/composables/usePersistCameraConfig.ts index 5bddbe127..2fdfb5eea 100644 --- a/src/composables/usePersistCameraConfig.ts +++ b/src/composables/usePersistCameraConfig.ts @@ -1,13 +1,12 @@ import { manageVTKSubscription } from '@/src/composables/manageVTKSubscription'; import { Ref } from 'vue'; -import { Maybe } from '@/src/types'; import { CameraConfig } from '../store/view-configs/types'; import { vtkLPSViewProxy } from '../types/vtk-types'; import useViewCameraStore from '../store/view-configs/camera'; export function usePersistCameraConfig( viewID: Ref, - dataID: Ref>, + dataID: Ref, viewProxy: Ref, ...toPersist: (keyof CameraConfig)[] ) { @@ -20,7 +19,7 @@ export function usePersistCameraConfig( if (toPersist.indexOf('position') > -1) { persist.push(() => { - if (dataID.value != null && persistCameraConfig) { + if (dataID.value !== null && persistCameraConfig) { viewCameraStore.updateConfig(viewID.value, dataID.value, { position: viewProxy.value.getCamera().getPosition(), }); @@ -29,7 +28,7 @@ export function usePersistCameraConfig( } if (toPersist.indexOf('viewUp') > -1) { persist.push(() => { - if (dataID.value != null && persistCameraConfig) { + if (dataID.value !== null && persistCameraConfig) { viewCameraStore.updateConfig(viewID.value, dataID.value, { viewUp: viewProxy.value.getCamera().getViewUp(), }); @@ -38,7 +37,7 @@ export function usePersistCameraConfig( } if (toPersist.indexOf('focalPoint') > -1) { persist.push(() => { - if (dataID.value != null && persistCameraConfig) { + if (dataID.value !== null && persistCameraConfig) { viewCameraStore.updateConfig(viewID.value, dataID.value, { focalPoint: viewProxy.value.getCamera().getFocalPoint(), }); @@ -47,7 +46,7 @@ export function usePersistCameraConfig( } if (toPersist.indexOf('directionOfProjection') > -1) { persist.push(() => { - if (dataID.value != null && persistCameraConfig) { + if (dataID.value !== null && persistCameraConfig) { viewCameraStore.updateConfig(viewID.value, dataID.value, { directionOfProjection: viewProxy.value .getCamera() @@ -58,7 +57,7 @@ export function usePersistCameraConfig( } if (toPersist.indexOf('parallelScale') > -1) { persist.push(() => { - if (dataID.value != null && persistCameraConfig) { + if (dataID.value !== null && persistCameraConfig) { viewCameraStore.updateConfig(viewID.value, dataID.value, { parallelScale: viewProxy.value.getCamera().getParallelScale(), }); diff --git a/src/composables/useSceneBuilder.ts b/src/composables/useSceneBuilder.ts index 1fbcd7c91..d3d02838c 100644 --- a/src/composables/useSceneBuilder.ts +++ b/src/composables/useSceneBuilder.ts @@ -1,12 +1,11 @@ import vtkAbstractRepresentationProxy from '@kitware/vtk.js/Proxy/Core/AbstractRepresentationProxy'; import { computed, Ref, watch } from 'vue'; -import { Maybe } from '@/src/types'; import { useViewStore } from '../store/views'; import { vtkLPSViewProxy } from '../types/vtk-types'; import { arrayEquals } from '../utils'; interface Scene { - baseImage?: Ref>; + baseImage?: Ref; labelmaps?: Ref; layers?: Ref; models?: Ref; diff --git a/src/store/tools/crop.ts b/src/store/tools/crop.ts index 3af2dd7cb..81a181ec1 100644 --- a/src/store/tools/crop.ts +++ b/src/store/tools/crop.ts @@ -8,7 +8,6 @@ import { MaybeRef } from '@vueuse/core'; import { vec3 } from 'gl-matrix'; import { defineStore } from 'pinia'; import { arrayEqualsWithComparator } from '@/src/utils'; -import { Maybe } from '@/src/types'; import { useImageStore } from '../datasets-images'; import { LPSCroppingPlanes } from '../../types/crop'; import { ImageMetadata } from '../../types/image'; @@ -61,7 +60,7 @@ export const useCropStore = defineStore('crop', () => { croppingByImageID: {} as Record, }); - const getComputedVTKPlanes = (imageID: MaybeRef>) => + const getComputedVTKPlanes = (imageID: MaybeRef) => computed(() => { const id = unref(imageID); if (id && id in state.croppingByImageID && id in imageStore.metadata) { diff --git a/src/store/tools/paint.ts b/src/store/tools/paint.ts index bbe44d3d5..5df201a79 100644 --- a/src/store/tools/paint.ts +++ b/src/store/tools/paint.ts @@ -4,7 +4,6 @@ import { Manifest, StateFile } from '@/src/io/state-file/schema'; import { computed, ref, watch } from 'vue'; import { vec3 } from 'gl-matrix'; import { defineStore } from 'pinia'; -import { Maybe } from '@/src/types'; import { Tools } from './types'; import { useLabelmapStore } from '../datasets-labelmaps'; @@ -35,7 +34,7 @@ export const usePaintToolStore = defineStore('paint', () => { // --- actions --- // - function selectOrCreateLabelmap(imageID: Maybe) { + function selectOrCreateLabelmap(imageID: string | null) { if (!imageID) { activeLabelmapID.value = null; return; From 7b6f1bd13b667bdab734296aa793ca107d4e3514 Mon Sep 17 00:00:00 2001 From: Forrest Date: Tue, 12 Sep 2023 15:27:18 -0400 Subject: [PATCH 2/2] revert(CurrentImageProvider): inject current image This reverts commit f348023f27c9f00be5363b65d99db33c263f0d0d. --- src/components/CurrentImageProvider.vue | 31 ------- src/components/LayoutGrid.vue | 34 ++------ src/composables/useCurrentImage.ts | 109 ++++++++++++------------ 3 files changed, 62 insertions(+), 112 deletions(-) delete mode 100644 src/components/CurrentImageProvider.vue diff --git a/src/components/CurrentImageProvider.vue b/src/components/CurrentImageProvider.vue deleted file mode 100644 index 30c36a965..000000000 --- a/src/components/CurrentImageProvider.vue +++ /dev/null @@ -1,31 +0,0 @@ - - - diff --git a/src/components/LayoutGrid.vue b/src/components/LayoutGrid.vue index 012e27ee3..4325f18df 100644 --- a/src/components/LayoutGrid.vue +++ b/src/components/LayoutGrid.vue @@ -7,14 +7,12 @@
- - - +
@@ -23,9 +21,6 @@