From ab3b767297514e8c5457503ae457794a0e0a0f74 Mon Sep 17 00:00:00 2001 From: Anne Haley Date: Tue, 19 Sep 2023 15:12:01 -0400 Subject: [PATCH 01/10] Create function getChannelColor for use in multiple places --- .../web_client/vue/components/CompositeLayers.vue | 14 ++++++-------- .../web_client/vue/utils/colors.js | 9 +++++++++ 2 files changed, 15 insertions(+), 8 deletions(-) diff --git a/girder/girder_large_image/web_client/vue/components/CompositeLayers.vue b/girder/girder_large_image/web_client/vue/components/CompositeLayers.vue index 268e6a4f0..0a4274977 100644 --- a/girder/girder_large_image/web_client/vue/components/CompositeLayers.vue +++ b/girder/girder_large_image/web_client/vue/components/CompositeLayers.vue @@ -2,7 +2,7 @@ import {restRequest} from '@girder/core/rest'; import {Chrome} from 'vue-color'; -import {CHANNEL_COLORS, OTHER_COLORS} from '../utils/colors'; +import {OTHER_COLORS, getChannelColor} from '../utils/colors'; import HistogramEditor from './HistogramEditor.vue'; export default { @@ -114,13 +114,11 @@ export default { // Assign colors this.layers.forEach((layerName) => { if (!this.compositeLayerInfo[layerName].palette) { - // Search for case-insensitive regex match among known channel-colors - Object.entries(CHANNEL_COLORS).forEach(([channelPattern, color]) => { - if (layerName.match(new RegExp(channelPattern, 'i')) && !usedColors.includes(color)) { - this.compositeLayerInfo[layerName].palette = color; - usedColors.push(color); - } - }); + const channelColor = getChannelColor(layerName) + if (channelColor) { + this.compositeLayerInfo[layerName].palette = channelColor; + usedColors.push(channelColor); + } } }); this.layers.forEach((layerName) => { diff --git a/girder/girder_large_image/web_client/vue/utils/colors.js b/girder/girder_large_image/web_client/vue/utils/colors.js index 11a2e7034..a0c39796a 100644 --- a/girder/girder_large_image/web_client/vue/utils/colors.js +++ b/girder/girder_large_image/web_client/vue/utils/colors.js @@ -12,6 +12,15 @@ export const CHANNEL_COLORS = { '^gr[ae]y(|scale)$': '#FFFFFF' }; +export function getChannelColor(name) { + // Search for case-insensitive regex match among known channel-colors + for (const [channelPattern, color] of Object.entries(CHANNEL_COLORS)) { + if (name.match(new RegExp(channelPattern, 'i'))) { + return color + } + } +} + export const OTHER_COLORS = [ '#FF0000', '#00FF00', From ab79324f7d18d33f8dba683e2b0d391d2537bd99 Mon Sep 17 00:00:00 2001 From: Anne Haley Date: Tue, 19 Sep 2023 15:12:51 -0400 Subject: [PATCH 02/10] Add a "Max-Merge" option to DualInput and use max-merge values in computing style --- .../web_client/vue/components/DualInput.vue | 26 ++++++- .../vue/components/FrameSelector.vue | 67 ++++++++++++++++++- 2 files changed, 89 insertions(+), 4 deletions(-) diff --git a/girder/girder_large_image/web_client/vue/components/DualInput.vue b/girder/girder_large_image/web_client/vue/components/DualInput.vue index 1586a5f94..584f374a7 100644 --- a/girder/girder_large_image/web_client/vue/components/DualInput.vue +++ b/girder/girder_large_image/web_client/vue/components/DualInput.vue @@ -1,10 +1,11 @@