Skip to content

feat: Add gamma correction toggle - #385

Merged
igoroctaviano merged 4 commits into
masterfrom
feat/gamma-toggle
Aug 5, 2026
Merged

feat: Add gamma correction toggle#385
igoroctaviano merged 4 commits into
masterfrom
feat/gamma-toggle

Conversation

@igoroctaviano

@igoroctaviano igoroctaviano commented May 18, 2026

Copy link
Copy Markdown
Collaborator

Summary

Adds a Gamma correction switch in Settings → Display (next to ICC Profiles) so users can enable/disable palette display gamma compensation at runtime.

Depends on DMV exposing setPaletteDisplayGammaCorrectionEnabled / getPaletteDisplayGammaCorrectionEnabled (slim#384, follow-up to dicom-microscopy-viewer#211).

DMV PR: (link dmv-pr branch / PR here)

What changed

  • SlideViewer.tsx

    • State: isPaletteDisplayGammaCorrectionEnabled (initialized from volumeViewer.getPaletteDisplayGammaCorrectionEnabled()).
    • Handler handlePaletteDisplayGammaCorrectionTogglevolumeViewer.setPaletteDisplayGammaCorrectionEnabled(checked).
    • Settings panel: Gamma correction switch under Display, beside ICC Profiles.
    • After constructViewers on route/slide change, reapplies stored preference via setPaletteDisplayGammaCorrectionEnabled.
    • Custom segment palettes use the viewer’s current gamma flag when built.
  • SlideViewer/types.tsisPaletteDisplayGammaCorrectionEnabled on component state.

  • types/dicom-microscopy-viewer/index.d.ts

    • VolumeImageViewerOptions.paletteDisplayGammaCorrection
    • setPaletteDisplayGammaCorrectionEnabled / getPaletteDisplayGammaCorrectionEnabled
    • PaletteColorLookupTable / buildPaletteColorLookupTable gamma options

Dependency

Bump dicom-microscopy-viewer to a release that includes the gamma toggle API (after the DMV PR merges).

Until then, local testing:

  1. In dicom-microscopy-viewer: bun link (or npm link).
  2. In slim: bun link dicom-microscopy-viewer and reinstall, or use "dicom-microscopy-viewer": "file:../dicom-microscopy-viewer" and run npm run build in DMV so dist/ matches src/.

Note: Slim’s webpack alias resolves DMV to dist/dynamic-import/dicomMicroscopyViewer.min.js. A linked package without rebuilding dist will not pick up new APIs.

How to test

  1. Start Slim with a DMV build that includes the gamma API.
  2. Open a slide that uses palette LUT channels (e.g. CyCIF-style data), not only true RGB color.
  3. Open Settings (gear) → Display.
  4. Toggle Gamma correction:
    • On (default): brighter mid-tones, consistent with PR #211.
    • Off: linear palette mapping (darker mid-tones).
  5. Change series/slide and confirm the toggle state is restored.
  6. With visible segmentations or parametric maps, confirm overlays update when toggling.

Limitations

  • No effect on true RGB optical paths or monochrome tint-only channels (no palette LUT).
  • ICC Profiles and Gamma correction are independent settings.

Related

@deepsource-io

deepsource-io Bot commented May 18, 2026

Copy link
Copy Markdown

DeepSource Code Review

We reviewed changes in 4313727...51dd4cc on this pull request. Below is the summary for the review, and you can see the individual issues we found as inline review comments.

See full review on DeepSource ↗

PR Report Card

Overall Grade   Security  

Reliability  

Complexity  

Hygiene  

Code Review Summary

Analyzer Status Updated (UTC) Details
JavaScript Aug 5, 2026 5:06p.m. Review ↗

Important

AI Review is run only on demand for your team. We're only showing results of static analysis review right now. To trigger AI Review, comment @deepsourcebot review on this thread.

@sonarqubecloud

sonarqubecloud Bot commented Jun 7, 2026

Copy link
Copy Markdown

@fedorov

fedorov commented Aug 5, 2026

Copy link
Copy Markdown
Member

@igoroctaviano let's merge this.

Resolve conflict in DMV type defs by keeping master's Uint8Array
palette data types and the gamma correction option from this branch.
@sonarqubecloud

sonarqubecloud Bot commented Aug 5, 2026

Copy link
Copy Markdown

@github-actions

github-actions Bot commented Aug 5, 2026

Copy link
Copy Markdown

Visit the preview URL for this PR (updated for commit 51dd4cc):

https://idc-external-006--pr385-feat-gamma-toggle-t4piythp.web.app

(expires Wed, 12 Aug 2026 17:09:00 GMT)

🔥 via Firebase Hosting GitHub Action 🌎

Sign: 88aacecd98ba54d2f9c8d201a9444e43d1ad8307

@igoroctaviano
igoroctaviano merged commit bb99e98 into master Aug 5, 2026
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants