Skip to content

feat: Add gamma correction toggle#385

Open
igoroctaviano wants to merge 1 commit into
masterfrom
feat/gamma-toggle
Open

feat: Add gamma correction toggle#385
igoroctaviano wants to merge 1 commit into
masterfrom
feat/gamma-toggle

Conversation

@igoroctaviano
Copy link
Copy Markdown
Collaborator

@igoroctaviano igoroctaviano commented May 18, 2026

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

@sonarqubecloud
Copy link
Copy Markdown

@deepsource-io
Copy link
Copy Markdown

deepsource-io Bot commented May 18, 2026

DeepSource Code Review

We reviewed changes in ee5464e...3d5d4ab 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 May 18, 2026 8:58a.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.

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.

1 participant