Skip to content

Resolve "enh(viz): enhance transfer function editor"

Description

The transfer function editor, and to a larger extent, our 2D scene render, received a major update. Here is a summary of the changes.

2D scene render changes

  • Harmonized the floating point precision to double
  • Removed the various custom and redundant 2D point types with glm::dvec2
  • Removed the internal viewport, only adaptors interact with viewports
  • Merged SAxis and SScaleValues adaptor together for simplicity
  • Simplified and corrected many widgets size computations. The display should now be identical whatever the resolution of the screens, the size of the viewport, etc...
  • Added a parser to specify viewport parameters in XML

Transfer function editor changes

  • Major refactor of the histogram computation and display.
    • The histogram data is replaced by a helper that computes the histogram at will and much more efficiently. Indeed, now we use a multithreaded algorithm.
    • Dynamic computation of the histogram with CTRL+mouse wheel in the editor
    • Add a histogram axis that scales with the mouse wheel
    • Remove the SCurveHistogram adaptor. It was buggy and actually, it was not a good idea to smooth the values of an image histogram. We now use the simpler SHistogram instead.
    • Merge all histogram adaptors into one for simplicity
  • The range of the viewport is now computed from the image histogram, and the display adapts dynamically
  • Block the move of points outside the value range
  • Keep the opacity from the previous color when editing point colors in SMultipleTF (and STransferFunction)
  • Add a new configuration TransferFunctionManager that can be used either in a panel or in a modal window. The TransferFunctionManagerWindow configuration call it to share the code.

Closes #725 (closed)

How to test it?

  • Run SightViewer
  • Load an medical image (CT or US)
  • Verify that the viewport of the widget comprises both the selected transfer function and the image values range
  • Scale the histogram in height with mouse wheel, Shift+mouse wheel, and resample it in width with Ctrl+mouse wheel
  • Edit size of elements or fonts in the XML and check that the behavior is correct
  • etc...

Additional tests/tasks to run

  • Some changes are necessary for Night, you can review them at the same time
  • Test with a 4k screen to see if proportions are respected
Edited by Didier WECKMANN

Merge request reports