Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Colorbar feature #605

Open
wants to merge 36 commits into
base: master
Choose a base branch
from
Open

Colorbar feature #605

wants to merge 36 commits into from

Conversation

Tom-TBT
Copy link
Contributor

@Tom-TBT Tom-TBT commented Dec 9, 2024

This PR implements the optional display of a colorbar next to a panel. The colorbar shows the mapping between pixel values and LUT ("normal" color included). This is work from @MinaEnayat and me.
There are still adjustments to be made, but this is functional and mature enough that we thought it was ready to receive comments/ideas.

image

Implemented features:

  • colorbar display showing the LUT of the first active channel (opinion on what other behavior when more than 1 channel?)
  • The colorbar can be placed on one of the four sides of the panel
  • Parameters for:
    • thickness of the colorbar
    • spacing between colorbar and panel
    • number of ticks+labels
    • ticks+labels+spine color
    • tick length
    • label margin (distance between label and dash)
    • label font size
  • Crop page around panels handles horizontal labels (measure the CSS property of generated labels). Could be adapted for the handling of right/left normal labels
  • Export to pdf / tiff

A spine with the ticks and labels gives a visual clue when the LUT is the same color as the page background, but only on one side to avoid confusion with the LUT when the LUT is the same color as the spine:
image

Suggestions for tests:

  • Intensity range:
    • 0-255 (full range)
    • 40-190 (different start-end value)
    • 16-bit range
  • reversed channel flips the colorbar (not the labels)
  • uneven panel resizing (width/height without keeping the ratio).
  • Parameter testing thickness, spacing, label font, label margin, and tick length:
    • python export handles them all
    • "crop page around panel" handles them all
  • all tests above for the python export to tiff & pdf

Known issues / work left:

  • CSS display of ticks's dashes is uneven (not the case with the exported figure)
  • Labels in python left/right justified, when JS has them centered (options?, possibility to rotate labels?)
  • Labels in python do not always match the labels in JS (rounding difference)
  • Handle left/right normal labels for "crop page around panels"
  • Rearrange Colorbar form (adding/removing options ?)
  • if color start-end range is too low, labels are duplicated from rounding (what about float range?)

MinaEnayat and others added 30 commits November 18, 2024 16:56
break;
}
}
var lut_url = await FigureLutPicker.loadLuts(false) // Ensure lut url and list are loaded
Copy link
Member

Choose a reason for hiding this comment

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

Wow, this looks great. Haven't tested yet, but just noticed you don't need the false here (or below) since that's the default.

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.

3 participants