From 4f0ebf52fc5711b5b74669f34d6d6bfe0d322353 Mon Sep 17 00:00:00 2001 From: Laurent Chauvin Date: Wed, 2 Oct 2024 21:44:14 -0400 Subject: [PATCH] Prettify --- src/components/ImageDataBrowser.vue | 17 ++++++-------- src/io/import/processors/importSingleFile.ts | 7 ++++-- src/store/datasets-images.ts | 2 +- src/store/view-configs/camera.ts | 24 ++++++++++++-------- src/store/view-configs/slicing.ts | 14 +++++++----- 5 files changed, 36 insertions(+), 28 deletions(-) diff --git a/src/components/ImageDataBrowser.vue b/src/components/ImageDataBrowser.vue index 457575fe..2fe67e5a 100644 --- a/src/components/ImageDataBrowser.vue +++ b/src/components/ImageDataBrowser.vue @@ -120,8 +120,8 @@ export default defineComponent({ { immediate: true, deep: true } ); - // --- sync --- // - const sameSpaceImages = computed(() => { + // --- sync --- // + const sameSpaceImages = computed(() => { return imageStore.checkAllImagesSameSpace(); }); const isSync = computed(() => { @@ -132,13 +132,10 @@ export default defineComponent({ viewCameraStore.toggleSyncCameras(); viewCameraStore.disableCameraAutoReset = isSync.value; } - watch( - isSync, - () => { - viewSliceStore.updateSyncConfigs(); - viewCameraStore.updateSyncConfigs(); - } - ); + watch(isSync, () => { + viewSliceStore.updateSyncConfigs(); + viewCameraStore.updateSyncConfigs(); + }); // --- selection --- // @@ -206,7 +203,7 @@ export default defineComponent({ :disabled="!sameSpaceImages" @click.stop="toggleSyncImages" > - mdi-lock + mdi-lock mdi-lock-open-variant { // Create a default view for each viewID useViewStore().viewIDs.forEach((viewID: string) => { const { lpsOrientation, dimensions } = useImageStore().metadata[dataID]; - const axisDir = InitViewSpecs[viewID].props.viewDirection + const axisDir = InitViewSpecs[viewID].props.viewDirection; const lpsFromDir = getLPSAxisFromDir(axisDir); const lpsOrient = lpsOrientation[lpsFromDir]; const dimMax = dimensions[lpsOrient]; - useViewSliceStore().updateConfig(viewID, dataID, { axisDirection: axisDir, max: dimMax - 1 }); + useViewSliceStore().updateConfig(viewID, dataID, { + axisDirection: axisDir, + max: dimMax - 1, + }); useViewSliceStore().resetSlice(viewID, dataID); }); diff --git a/src/store/datasets-images.ts b/src/store/datasets-images.ts index 460d8921..58001737 100644 --- a/src/store/datasets-images.ts +++ b/src/store/datasets-images.ts @@ -85,7 +85,7 @@ export const useImageStore = defineStore('images', { const dataFirst = this.dataIndex[this.idList[0]]; const allEqual = this.idList.slice(1).every((id) => { - return compareImageSpaces(this.dataIndex[id], dataFirst); + return compareImageSpaces(this.dataIndex[id], dataFirst); }); return allEqual; diff --git a/src/store/view-configs/camera.ts b/src/store/view-configs/camera.ts index 846a6f7b..0355808f 100644 --- a/src/store/view-configs/camera.ts +++ b/src/store/view-configs/camera.ts @@ -32,12 +32,12 @@ export const useViewCameraStore = defineStore('viewCamera', () => { patchDoubleKeyRecord(configs, viewID, dataID, config); }; - + const disableCameraAutoReset = ref(false); const toggleCameraAutoReset = () => { disableCameraAutoReset.value = !disableCameraAutoReset.value; - } + }; const removeView = (viewID: string) => { delete configs[viewID]; @@ -56,18 +56,20 @@ export const useViewCameraStore = defineStore('viewCamera', () => { Object.keys(configs).forEach((viewID) => { imageStore.idList.forEach((imageID) => { const { syncState } = { - ...getConfig(viewID, imageID) + ...getConfig(viewID, imageID), }; updateConfig(viewID, imageID, { syncState: !syncState }); }); }); - } + }; const isSync = () => { - const allSync = Object.keys(configs).every((sc) => Object.keys(configs[sc]).every((c) => configs[sc][c].syncState)); + const allSync = Object.keys(configs).every((sc) => + Object.keys(configs[sc]).every((c) => configs[sc][c].syncState) + ); return allSync; - } + }; const updateSyncConfigs = () => { Object.keys(configs).forEach((viewID) => { @@ -75,15 +77,19 @@ export const useViewCameraStore = defineStore('viewCamera', () => { const config = getConfig(viewID, currentImageID.value); imageStore.idList.forEach((imageID) => { const { syncState } = { - ...getConfig(viewID, imageID) + ...getConfig(viewID, imageID), }; if (syncState) { - updateConfig(viewID, imageID, { position: config?.position, focalPoint: config?.focalPoint, parallelScale: config?.parallelScale }); + updateConfig(viewID, imageID, { + position: config?.position, + focalPoint: config?.focalPoint, + parallelScale: config?.parallelScale, + }); } }); }); - } + }; const serialize = createViewConfigSerializer(configs, 'camera'); diff --git a/src/store/view-configs/slicing.ts b/src/store/view-configs/slicing.ts index ac53ac07..e45ad15f 100644 --- a/src/store/view-configs/slicing.ts +++ b/src/store/view-configs/slicing.ts @@ -74,18 +74,20 @@ export const useViewSliceStore = defineStore('viewSlice', () => { imageStore.idList.forEach((imageID) => { const { syncState } = { ...defaultSliceConfig(), - ...getConfig(viewID, imageID) + ...getConfig(viewID, imageID), }; updateConfig(viewID, imageID, { syncState: !syncState }); }); }); - } + }; const isSync = () => { - const allSync = Object.keys(configs).every((sc) => Object.keys(configs[sc]).every((c) => configs[sc][c].syncState)); + const allSync = Object.keys(configs).every((sc) => + Object.keys(configs[sc]).every((c) => configs[sc][c].syncState) + ); return allSync; - } + }; const updateSyncConfigs = () => { Object.keys(configs).forEach((viewID) => { @@ -94,7 +96,7 @@ export const useViewSliceStore = defineStore('viewSlice', () => { imageStore.idList.forEach((imageID) => { const { syncState } = { ...defaultSliceConfig(), - ...getConfig(viewID, imageID) + ...getConfig(viewID, imageID), }; if (syncState) { @@ -102,7 +104,7 @@ export const useViewSliceStore = defineStore('viewSlice', () => { } }); }); - } + }; const serialize = createViewConfigSerializer(configs, 'slice');