Skip to content

Add anterior/posterior/flat views and small colormaps (#91)#158

Merged
zihuaihuai merged 1 commit into
masterfrom
apply-91-views-and-small-colormaps
May 4, 2026
Merged

Add anterior/posterior/flat views and small colormaps (#91)#158
zihuaihuai merged 1 commit into
masterfrom
apply-91-views-and-small-colormaps

Conversation

@zihuaihuai

Copy link
Copy Markdown
Collaborator

Subset of #91 — landing the cleanly-licensed parts.

Included

  • surface_plotting.py — four new view orientations: anterior, posterior, flatL, flatR. Added an inline note that flatL/flatR assume a pre-flattened mesh.
  • colormaps.py — three new palettes:
    • eco_kos — categorical, 6-color
    • spec_5 — 5-step Spectral from ColorBrewer 2.0 (Apache 2.0)
    • BuGyRd — diverging blue→grey→red, built programmatically by interpolating 5 control points with np.interp. Visually identical to the original 256-row hand-listed array, 4 lines instead of 256, far easier to review.
  • tests/test_colormaps.py — registration, shape, alpha-channel, and smoothness checks.

Skipped

fs_colours2 (the 35-entry FreeSurfer-style palette). FreeSurfer's color LUT is under a non-BSD-compatible license; this needs explicit sourcing/clearance before it can ship in a BSD-3 package. Happy to revisit if @rcruces can confirm an independent source.

@rcruces credited as Co-author on the squashed commit.

Test plan

  • pytest brainspace/tests/test_colormaps.py → 3 passed.
  • Full suite still green.

Subset of #91 — takes the cleanly-licensed parts:

- New view orientations in plotting.surface_plotting: anterior,
  posterior, flatL, flatR. Adds an inline note that flatL/flatR assume
  a pre-flattened mesh (camera angle alone doesn't flatten geometry).
- New small categorical palettes eco_kos and spec_5 (ColorBrewer 5-step
  Spectral, Apache 2.0).
- BuGyRd diverging colormap, but built programmatically by interpolating
  5 control points with np.interp instead of hand-listing 256 RGB tuples.
  Same visual result, 4 lines instead of 256.

Skipped from the original PR pending separate clarification:
- fs_colours2 (FreeSurfer-derived 35-entry palette): non-BSD source
  license needs explicit credit/clearance before merging.

Co-authored-by: Raul Cruces <rcruces@users.noreply.github.com>
@zihuaihuai zihuaihuai merged commit 0adda16 into master May 4, 2026
16 checks passed
@zihuaihuai zihuaihuai deleted the apply-91-views-and-small-colormaps branch May 4, 2026 14:51
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