From 69cd622b54ea116a01781929a8f7c6cc8a0a4c45 Mon Sep 17 00:00:00 2001 From: Jon Date: Thu, 7 Nov 2024 23:57:38 -0100 Subject: [PATCH 1/5] Add COOP and COEP headers to nginx to try to fix shared buffer not working --- Dockerfile | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Dockerfile b/Dockerfile index faaf1f1..f86a1a0 100644 --- a/Dockerfile +++ b/Dockerfile @@ -16,6 +16,8 @@ RUN echo -e " server {\n" \ " root /app;\n" \ " index index.html;\n" \ " try_files \$uri \$uri/ /index.html;\n" \ + " add_header 'Cross-Origin-Embedder-Policy' 'require-corp';\n" \ + " add_header 'Cross-Origin-Opener-Policy' 'same-origin';\n" \ " }\n" \ " }\n" \ > /etc/nginx/conf.d/datalab.conf From 6b7bbae18ef98d1bdf93f0c5329ae937d27b707f Mon Sep 17 00:00:00 2001 From: Jon Date: Fri, 15 Nov 2024 22:51:34 -0100 Subject: [PATCH 2/5] Add histogram slider component for controlling setting the lower and upper points for scaling --- package-lock.json | 12 +- package.json | 2 +- src/components/Global/HistogramSlider.vue | 230 ++++++++++++++++++++++ src/components/Global/ImageScaler.vue | 88 +++------ 4 files changed, 267 insertions(+), 65 deletions(-) create mode 100644 src/components/Global/HistogramSlider.vue diff --git a/package-lock.json b/package-lock.json index 8c390df..c3f3ed4 100644 --- a/package-lock.json +++ b/package-lock.json @@ -22,7 +22,7 @@ "vue": "^3.5.9", "vue-router": "^4.2.5", "vue3-carousel": "^0.3.1", - "vuetify": "^3.6.0", + "vuetify": "^3.7.4", "webfontloader": "^1.0.0" }, "devDependencies": { @@ -12713,9 +12713,9 @@ } }, "node_modules/vuetify": { - "version": "3.6.0", - "resolved": "https://registry.npmjs.org/vuetify/-/vuetify-3.6.0.tgz", - "integrity": "sha512-ic7VrB+nOTo8F7APhcKPjtDEO3yBCK5CJ2LIQ/4oAC/aaAKtuGuNMBUiUVitDKQjr0tcnDgy9Ar1CrHU5d28IA==", + "version": "3.7.4", + "resolved": "https://registry.npmjs.org/vuetify/-/vuetify-3.7.4.tgz", + "integrity": "sha512-Y8UU5wUDQXC3oz2uumPb8IOdvB4XMCxtxnmqdOc+LihNuPlkSgxIwf92ndRzbOtJFKHsggFUxpyLqpQp+A+5kg==", "engines": { "node": "^12.20 || >=14.13" }, @@ -12727,7 +12727,6 @@ "typescript": ">=4.7", "vite-plugin-vuetify": ">=1.0.0", "vue": "^3.3.0", - "vue-i18n": "^9.0.0", "webpack-plugin-vuetify": ">=2.0.0" }, "peerDependenciesMeta": { @@ -12737,9 +12736,6 @@ "vite-plugin-vuetify": { "optional": true }, - "vue-i18n": { - "optional": true - }, "webpack-plugin-vuetify": { "optional": true } diff --git a/package.json b/package.json index a3c6528..42d63ba 100644 --- a/package.json +++ b/package.json @@ -22,7 +22,7 @@ "vue": "^3.5.9", "vue-router": "^4.2.5", "vue3-carousel": "^0.3.1", - "vuetify": "^3.6.0", + "vuetify": "^3.7.4", "webfontloader": "^1.0.0" }, "devDependencies": { diff --git a/src/components/Global/HistogramSlider.vue b/src/components/Global/HistogramSlider.vue new file mode 100644 index 0000000..22d5cb7 --- /dev/null +++ b/src/components/Global/HistogramSlider.vue @@ -0,0 +1,230 @@ + + + diff --git a/src/components/Global/ImageScaler.vue b/src/components/Global/ImageScaler.vue index c4b04bd..75f5144 100644 --- a/src/components/Global/ImageScaler.vue +++ b/src/components/Global/ImageScaler.vue @@ -3,6 +3,7 @@ import { ref, computed, onMounted, defineEmits, defineProps } from 'vue' import { useConfigurationStore } from '@/stores/configuration' import { fetchApiCall } from '@/utils/api' import RawScaledImage from './RawScaledImage.vue' +import HistogramSlider from './HistogramSlider.vue' // This component gets the raw image data from the server for an image // and then displays the image and the scaling controls under it @@ -33,7 +34,7 @@ const isLoading = ref(true) const errorReason = ref('') const rawData = ref({}) const sliderRange = ref([0, 65535]) -var zScaleValues = null +const zScaleValues = ref([0, 65535]) const titleText = computed(() => { return props.imageName.replace('_', ' ') @@ -49,24 +50,29 @@ const maxPixelValue = computed(() => { } }) -function updateLowerScale(value) { - sliderRange.value = [Number(value), sliderRange.value[1]] - emit('updateScaling', props.imageName, sliderRange.value[0], sliderRange.value[1]) -} - -function updateUpperScale(value) { - sliderRange.value = [sliderRange.value[0], Number(value)] - emit('updateScaling', props.imageName, sliderRange.value[0], sliderRange.value[1]) -} +const histogram = computed(() => { + if (rawData.value && rawData.value.histogram) { + return rawData.value.histogram + } + else { + return [0, 10, 10, 5, 4, 3, 2, 1] + } +}) -function zScaleImage() { - if (zScaleValues){ - sliderRange.value = [...zScaleValues] +const bins = computed(() => { + if (rawData.value && rawData.value.bins) { + return rawData.value.bins + } + else { + return [0, 1, 2, 3, 4, 5, 6, 7] } +}) + +function updateScaleRange(lowerValue, upperValue) { + sliderRange.value = [Number(lowerValue), Number(upperValue)] emit('updateScaling', props.imageName, sliderRange.value[0], sliderRange.value[1]) } - onMounted(async () => { const url = dataSessionsUrl + 'analysis/raw-data/' const body = { @@ -77,8 +83,7 @@ onMounted(async () => { fetchApiCall({url: url, method: 'POST', body: body, successCallback: (response) => { rawData.value = response - zScaleValues = [response.zmin, response.zmax] - zScaleImage() + zScaleValues.value = [response.zmin, response.zmax] isLoading.value = false }, failCallback: (error) => { @@ -106,46 +111,17 @@ onMounted(async () => { - - - - + + + + From 2b4dc949df0e50ba44f81990bfc558ed97a44736 Mon Sep 17 00:00:00 2001 From: Jon Date: Sat, 16 Nov 2024 00:01:03 -0100 Subject: [PATCH 3/5] Remove log --- src/components/Global/HistogramSlider.vue | 1 - 1 file changed, 1 deletion(-) diff --git a/src/components/Global/HistogramSlider.vue b/src/components/Global/HistogramSlider.vue index 22d5cb7..41d2323 100644 --- a/src/components/Global/HistogramSlider.vue +++ b/src/components/Global/HistogramSlider.vue @@ -131,7 +131,6 @@ function zScaleImage() { scaleRange.value = [props.zMin, props.zMax] sliderRange.value = [scaleToSliderValue(props.zMin), scaleToSliderValue(props.zMax)] emit('updateScaling', scaleRange.value[0], scaleRange.value[1]) - console.log('clicked zscale') } watch( From e0b8ae36e7753e36f95aaab60c0de03eda505833 Mon Sep 17 00:00:00 2001 From: Jon Date: Sat, 16 Nov 2024 00:20:09 -0100 Subject: [PATCH 4/5] remove v-main in ImageScalingGroup since it causes issues --- src/components/Global/ImageScalingGroup.vue | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/components/Global/ImageScalingGroup.vue b/src/components/Global/ImageScalingGroup.vue index 80b3370..21c848f 100644 --- a/src/components/Global/ImageScalingGroup.vue +++ b/src/components/Global/ImageScalingGroup.vue @@ -69,7 +69,6 @@ watch( :key="groupName" :value="groupName" > - - From 103cf60ea5fb38cb4ead79835a0fc0722408f5ee Mon Sep 17 00:00:00 2001 From: Jon Date: Tue, 19 Nov 2024 05:54:49 -0100 Subject: [PATCH 5/5] Moved image scaling things into subdir --- src/components/DataSession/OperationWizard.vue | 2 +- src/components/Global/{ => Scaling}/CompositeImage.vue | 0 src/components/Global/{ => Scaling}/HistogramSlider.vue | 0 src/components/Global/{ => Scaling}/ImageScaler.vue | 0 src/components/Global/{ => Scaling}/ImageScalingGroup.vue | 0 src/components/Global/{ => Scaling}/RawScaledImage.vue | 0 6 files changed, 1 insertion(+), 1 deletion(-) rename src/components/Global/{ => Scaling}/CompositeImage.vue (100%) rename src/components/Global/{ => Scaling}/HistogramSlider.vue (100%) rename src/components/Global/{ => Scaling}/ImageScaler.vue (100%) rename src/components/Global/{ => Scaling}/ImageScalingGroup.vue (100%) rename src/components/Global/{ => Scaling}/RawScaledImage.vue (100%) diff --git a/src/components/DataSession/OperationWizard.vue b/src/components/DataSession/OperationWizard.vue index 505a7f5..2af91d0 100644 --- a/src/components/DataSession/OperationWizard.vue +++ b/src/components/DataSession/OperationWizard.vue @@ -3,7 +3,7 @@ import { ref, onMounted, computed, defineEmits, defineProps} from 'vue' import { fetchApiCall, handleError } from '@/utils/api' import { calculateColumnSpan } from '@/utils/common' import ImageGrid from '../Global/ImageGrid' -import ImageScalingGroup from '../Global/ImageScalingGroup' +import ImageScalingGroup from '../Global/Scaling/ImageScalingGroup' import { useConfigurationStore } from '@/stores/configuration' import { useAlertsStore } from '@/stores/alerts' diff --git a/src/components/Global/CompositeImage.vue b/src/components/Global/Scaling/CompositeImage.vue similarity index 100% rename from src/components/Global/CompositeImage.vue rename to src/components/Global/Scaling/CompositeImage.vue diff --git a/src/components/Global/HistogramSlider.vue b/src/components/Global/Scaling/HistogramSlider.vue similarity index 100% rename from src/components/Global/HistogramSlider.vue rename to src/components/Global/Scaling/HistogramSlider.vue diff --git a/src/components/Global/ImageScaler.vue b/src/components/Global/Scaling/ImageScaler.vue similarity index 100% rename from src/components/Global/ImageScaler.vue rename to src/components/Global/Scaling/ImageScaler.vue diff --git a/src/components/Global/ImageScalingGroup.vue b/src/components/Global/Scaling/ImageScalingGroup.vue similarity index 100% rename from src/components/Global/ImageScalingGroup.vue rename to src/components/Global/Scaling/ImageScalingGroup.vue diff --git a/src/components/Global/RawScaledImage.vue b/src/components/Global/Scaling/RawScaledImage.vue similarity index 100% rename from src/components/Global/RawScaledImage.vue rename to src/components/Global/Scaling/RawScaledImage.vue