Skip to content

Add alpha transparency parameter to 3D heatmaps#115

Open
AdityaGupta716 wants to merge 1 commit intobrainglobe:mainfrom
AdityaGupta716:feature/alpha-transparency-3d-heatmap
Open

Add alpha transparency parameter to 3D heatmaps#115
AdityaGupta716 wants to merge 1 commit intobrainglobe:mainfrom
AdityaGupta716:feature/alpha-transparency-3d-heatmap

Conversation

@AdityaGupta716
Copy link

Closes #101

Summary

Adds an alpha parameter to Heatmap.__init__() so users can control
brain region transparency in 3D format directly, without manually
accessing brainrender actors.

Usage

Global alpha (all regions):

bgh.Heatmap(values, ..., format="3D", alpha=0.5)

Per-region alpha:

bgh.Heatmap(values, ..., format="3D", alpha={"HIP": 0.3, "TH": 0.8})

Changes

  • brainglobe_heatmap/heatmaps.py — new alpha parameter with validation
  • tests/test_unit/test_alpha.py — unit and integration tests
  • examples/heatmap_3d_alpha.py — new example

Notes

  • None by default — fully backwards compatible
  • Has no effect in 2D format
  • Values validated at init time with clear error messages

@AdityaGupta716
Copy link
Author

AdityaGupta716 commented Mar 2, 2026

@adamltyson Hi, — this pr adds alpha as a parameter supporting both a global float and a per-region dict mapping region acronyms to individual values. Happy to get feedback!

EDIT -- The issue showed a single global alpha value. I also added per-region dict support (e.g. alpha={"HIP": 0.3, "TH": 0.8}) since the original image.sc thread had users asking for region-specific transparency control. let me know if you'd like to scope it down to global float only.

@codecov
Copy link

codecov bot commented Mar 2, 2026

Codecov Report

❌ Patch coverage is 53.33333% with 7 lines in your changes missing coverage. Please review.
✅ Project coverage is 68.91%. Comparing base (0fea8e1) to head (54830a1).

Files with missing lines Patch % Lines
brainglobe_heatmap/heatmaps.py 53.33% 7 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #115      +/-   ##
==========================================
- Coverage   69.63%   68.91%   -0.72%     
==========================================
  Files           5        5              
  Lines         326      341      +15     
==========================================
+ Hits          227      235       +8     
- Misses         99      106       +7     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@AdityaGupta716 AdityaGupta716 force-pushed the feature/alpha-transparency-3d-heatmap branch 2 times, most recently from 65ec89e to e6ef82a Compare March 2, 2026 21:33
@AdityaGupta716 AdityaGupta716 force-pushed the feature/alpha-transparency-3d-heatmap branch from 98fc4ff to f52760a Compare March 2, 2026 22:06
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.

Allow user to set transparency of region in 3D heatmaps

1 participant