Add viewing thermal reference images - #370
Merged
Merged
Conversation
olaals
force-pushed
the
add-viewing-thermal-reference-images
branch
3 times, most recently
from
May 22, 2026 12:37
bbfc80d to
8eb8f2b
Compare
olaals
force-pushed
the
add-viewing-thermal-reference-images
branch
3 times, most recently
from
June 8, 2026 09:38
f2f9781 to
dccfeee
Compare
There was a problem hiding this comment.
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}/imageendpoint 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 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
force-pushed
the
add-viewing-thermal-reference-images
branch
from
June 8, 2026 10:33
dccfeee to
c208d9b
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Ready for review checklist:
Looks like this: