Skip to content

Add viewing thermal reference images - #370

Merged
olaals merged 1 commit into
equinor:mainfrom
olaals:add-viewing-thermal-reference-images
Jun 8, 2026
Merged

Add viewing thermal reference images#370
olaals merged 1 commit into
equinor:mainfrom
olaals:add-viewing-thermal-reference-images

Conversation

@olaals

@olaals olaals commented May 21, 2026

Copy link
Copy Markdown
Contributor

Ready for review checklist:

  • A self-review has been performed
  • All commits run individually
  • Temporary changes have been removed, like logging, TODO, etc.
  • The PR has been tested locally
  • A test has been written
    • This change doesn't need a new test
  • Relevant issues are linked
  • Remaining work is documented in issues
    • There is no remaining work from this PR that requires new issues
  • The changes do not introduce dead code as unused imports, functions etc.

Looks like this:

image

@olaals
olaals force-pushed the add-viewing-thermal-reference-images branch 3 times, most recently from bbfc80d to 8eb8f2b Compare May 22, 2026 12:37
@olaals
olaals force-pushed the add-viewing-thermal-reference-images branch 3 times, most recently from f2f9781 to dccfeee Compare June 8, 2026 09:38
@olaals
olaals requested a review from Copilot June 8, 2026 10:24

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds end-to-end support for viewing thermal reference images: a new API endpoint streams temperature pixels from a stored TIFF, and the frontend fetches and renders the data as an Inferno-colored image with a legend.

Changes:

  • Backend: add blob download + TIFF temperature extraction service and a new /api/ThermalReferenceMetadata/id/{id}/image endpoint that returns float payload + metadata headers.
  • Frontend: add thermal image fetch on the thermal reference metadata detail page and render via a new Konva-based ThermalImageViewer.
  • Frontend utilities: add a fast Inferno LUT-based colormap + colorbar generator and include required dependencies (d3-scale-chromatic, konva/react-konva).

Reviewed changes

Copilot reviewed 11 out of 12 changed files in this pull request and generated 8 comments.

Show a summary per file
File Description
frontend/src/utils/thermalColormap.ts New LUT-based Inferno colormap application + legend canvas generation.
frontend/src/pages/thermal-reference-images/detail.tsx Fetch and display the thermal reference image on the detail page.
frontend/src/components/ThermalImageViewer.tsx New Konva-based thermal image renderer with vertical color scale labels.
frontend/src/api/client.ts Adds client helper to fetch binary thermal image data + headers.
frontend/package.json Adds dependencies for colormap + Konva rendering.
frontend/pnpm-lock.yaml Lockfile updates for new frontend dependencies.
api/Services/ThermalImageService.cs New service to read TIFF temperatures and compute min/max.
api/Services/BlobStorageService.cs New service to download blobs from Azure Storage.
api/Program.cs Registers new blob storage and thermal image services in DI.
api/Controllers/ThermalReferenceMetadataController.cs Adds a new id/{id}/image endpoint returning thermal image payload + headers.
api/api.csproj Adds LibTiff dependency needed for TIFF parsing.
api/.env.example Minor env example adjustments around storage configuration.
Files not reviewed (1)
  • frontend/pnpm-lock.yaml: Language not supported

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +123 to +125
setImageLoading(true);
setImageError(null);
getThermalReferenceImageData(id)
Comment on lines +458 to +469
const buffer = await response.arrayBuffer();
return {
temperatures: new Float32Array(buffer),
width: parseInt(response.headers.get("X-Image-Width") ?? "0", 10),
height: parseInt(response.headers.get("X-Image-Height") ?? "0", 10),
minTemperature: parseFloat(
response.headers.get("X-Temperature-Min") ?? "0"
),
maxTemperature: parseFloat(
response.headers.get("X-Temperature-Max") ?? "0"
),
};
Comment on lines +78 to +82
for (let y = 0; y < barHeight; y++) {
// t=1 at top (hot), t=0 at bottom (cold)
const t = 1 - y / (barHeight - 1);
const lutIdx = Math.round(t * 255) * 3;
const r = INFERNO_LUT[lutIdx];
Comment on lines +39 to +42
// Serialize float[] to little-endian bytes.
var floatBytes = new byte[temperatures.Length * sizeof(float)];
MemoryMarshal.AsBytes(temperatures.AsSpan()).CopyTo(floatBytes);

Comment on lines +196 to +197
Response.Headers["Access-Control-Expose-Headers"] =
"X-Image-Width, X-Image-Height, X-Temperature-Min, X-Temperature-Max";
Comment on lines +22 to +27
public async Task<ThermalImageData> GetThermalImageDataAsync(BlobStorageLocation location)
{
using var tiffStream = await blobStorageService.DownloadBlobAsync(location);

var (temperatures, width, height) = ReadTiffTemperatures(tiffStream);


<ColorScaleContainer>
<ColorBarWrapper>
<canvas ref={colorBarRef} style={{ display: "block", width: COLOR_BAR_WIDTH }} />
Comment thread frontend/package.json
Comment on lines 16 to +19
"@equinor/eds-tokens": "^2.2.0",
"@types/d3-scale-chromatic": "^3.1.0",
"d3-scale-chromatic": "^3.1.0",
"konva": "^10.3.0",
@olaals
olaals force-pushed the add-viewing-thermal-reference-images branch from dccfeee to c208d9b Compare June 8, 2026 10:33
@olaals
olaals merged commit d328733 into equinor:main Jun 8, 2026
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants