refactor: extract self-contained colormaps module#98
Open
patrickoleary wants to merge 1 commit into
Open
Conversation
cc66b4c to
bdc32ec
Compare
…ionality QuickView previously embedded ~1,400 lines of colormap state management, color transfer function algorithms, log/symlog/discrete transforms, tick computation, and colorbar/control-panel UI across view_manager.py, components/view.py, app.py, utils/color.py, and utils/math.py. All of that is now provided by the trame-colormaps package (>=1.0.0). Each view creates a ColormapConfig instance that owns the VTK color transfer function, mapper wiring, preset management, range computation, and tick generation. The UI is a single HorizontalScalarBar widget call per view, which renders the colorbar with an integrated popup control panel for preset selection, scale modes, discrete banding, and manual range override. ViewConfiguration retains only layout fields (order, size, offset, break_row, swap_group). State export/import separates layout config from colormap config, with backward compatibility for older state files that stored both in a single "config" key.
bdc32ec to
19125cf
Compare
jourdain
reviewed
May 18, 2026
| @@ -1176,9 +404,9 @@ def render(self): | |||
| self.pending_render = False | |||
|
|
|||
| def update_color_range(self): | |||
Collaborator
There was a problem hiding this comment.
Are you sure you still need that method? What is calling it?
Collaborator
|
Code looks good. I'm just not sure about that |
Member
Author
|
It is necessary. update_color_range is in view_manager.py and in trame-colormaps.py. The ViewManager method just loops over all views and calls view.colormap.update_color_range() on each ColormapConfig when quickview changes the data (_on_slicing_change and _on_downstream_change). The ColormapConfig.update_color_range() in trame-colormaps knows how to recompute (re-read the data array, rescale the CTF, reapply the preset). This split is correct. trame-colormaps doesn't know about QuickView's pipeline lifecycle, so QuickView triggers the recompute at the right moments. |
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.
refactor: use external trame-colormaps package for all colormap functionality
QuickView previously embedded ~1,400 lines of colormap state management,
color transfer function algorithms, log/symlog/discrete transforms, tick
computation, and colorbar/control-panel UI across view_manager.py,
components/view.py, app.py, utils/color.py, and utils/math.py.
All of that is now provided by the trame-colormaps package (>=1.0.0).
Each view creates a ColormapConfig instance that owns the VTK color
transfer function, mapper wiring, preset management, range computation,
and tick generation. The UI is a single HorizontalScalarBar widget call
per view, which renders the colorbar with an integrated popup control
panel for preset selection, scale modes, discrete banding, and manual
range override.
ViewConfiguration retains only layout fields (order, size, offset,
break_row, swap_group). State export/import separates layout config
from colormap config, with backward compatibility for older state files
that stored both in a single "config" key.