From 07fa788fe27bdadd379c9399fb7a2a4ab421d6f1 Mon Sep 17 00:00:00 2001 From: Filip Leonarski Date: Fri, 30 Jan 2026 11:28:15 +0100 Subject: [PATCH] ColorScale: Add magma and inferno colormaps --- broker/OpenAPIConvert.cpp | 25 +++++++++++------ broker/jfjoch_api.yaml | 6 +++- broker/redoc-static.html | 4 +-- common/ColorScale.cpp | 4 +++ common/ColorScale.h | 28 +++++++++++++------ docs/ACKNOWLEDGEMENT.md | 2 +- frontend/package-lock.json | 4 +-- frontend/src/components/PreviewImage.tsx | 4 +++ frontend/src/openapi/models/color_scale.ts | 4 +++ .../src/openapi/services/DefaultService.ts | 2 +- viewer/toolbar/JFJochViewerToolbarDisplay.cpp | 6 ++-- 11 files changed, 63 insertions(+), 26 deletions(-) diff --git a/broker/OpenAPIConvert.cpp b/broker/OpenAPIConvert.cpp index b7a6b86b..a769b669 100644 --- a/broker/OpenAPIConvert.cpp +++ b/broker/OpenAPIConvert.cpp @@ -872,20 +872,27 @@ PlotType ConvertPlotType(const std::optional& input) { "Plot type not recognized"); } -ColorScaleEnum ConvertColorScale(const std::optional& input) { - std::string color = input.value_or("indigo"); +ColorScaleEnum ConvertColorScale(const std::optional &input) { + std::string color = input.value_or("indigo"); if (color == "viridis") return ColorScaleEnum::Viridis; - else if (color == "bw") + if (color == "bw") return ColorScaleEnum::BW; - else if (color == "heat") - return ColorScaleEnum::Heat; - else if (color == "indigo") + if (color == "wb") + return ColorScaleEnum::WB; + if (color == "green") + return ColorScaleEnum::Green3; + if (color == "heat") + return ColorScaleEnum::Heat; + if (color == "indigo") return ColorScaleEnum::Indigo; - else - throw JFJochException(JFJochExceptionCategory::InputParameterInvalid, - "Color scale unknown"); + if (color == "magma") + return ColorScaleEnum::Magma; + if (color == "inferno") + return ColorScaleEnum::Inferno; + throw JFJochException(JFJochExceptionCategory::InputParameterInvalid, + "Color scale unknown"); } IndexingSettings Convert(const org::openapitools::server::model::Indexing_settings &input) { diff --git a/broker/jfjoch_api.yaml b/broker/jfjoch_api.yaml index 1391efa3..57b1445c 100644 --- a/broker/jfjoch_api.yaml +++ b/broker/jfjoch_api.yaml @@ -221,14 +221,18 @@ components: color_scale: in: query name: color - description: "Color scale for preview image: 0 - indigo, 1 - viridis, 2 - B/W, 3 - heat" + description: "Color scale for preview image" schema: type: string enum: - "indigo" - "viridis" - "bw" + - "wb" + - "green" - "heat" + - "magma" + - "inferno" default: "indigo" schemas: grid_scan: diff --git a/broker/redoc-static.html b/broker/redoc-static.html index 5e42adec..426aa7e7 100644 --- a/broker/redoc-static.html +++ b/broker/redoc-static.html @@ -1376,7 +1376,7 @@ This format doesn't transmit information about X-axis, only values, so it i " class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

Quality of JPEG image (100 - highest; 0 - lowest)

show_res_ring
number <float> [ 0.1 .. 100 ]
Default: 0.1

Show resolution ring, provided in Angstrom

-
color
string
Default: "indigo"
Enum: "indigo" "viridis" "bw" "heat"
color
string
Default: "indigo"
Enum: "indigo" "viridis" "bw" "wb" "green" "heat" "magma" "inferno"

Color scale for preview image: 0 - indigo, 1 - viridis, 2 - B/W, 3 - heat

show_res_est
boolean
Default: false

Show resolution estimation as a ring

@@ -1424,7 +1424,7 @@ then image might be replaced in the buffer between calling /images and /image.cb " class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

Test Jungfraujoch system

http://localhost:5232/version