feat: allow different values per hemisphere (closes #58)#114
feat: allow different values per hemisphere (closes #58)#114AdityaGupta716 wants to merge 1 commit intobrainglobe:mainfrom
Conversation
|
@adamltyson plz review |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #114 +/- ##
==========================================
+ Coverage 69.63% 73.06% +3.43%
==========================================
Files 5 5
Lines 326 401 +75
==========================================
+ Hits 227 293 +66
- Misses 99 108 +9 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
045ed90 to
a41c0f2
Compare
|
hi @adamltyson dropped the manual cutting workaround and bumped minimum to brainrender>=2.1.18. Now delegates hemisphere splitting entirely to add_brain_region(hemisphere=) directly. Deprecated mpl.cm.get_cmap replaced with mpl.colormaps[name].resampled(n) Tested on both allen_mouse_25um and allen_cord_20um (the atlas from the image.sc thread). |
Description
What is this PR
Why is this PR needed?
Users currently cannot visualise different values in each hemisphere — a region is treated as a single bilateral structure. This was requested in the [image.sc forum](https://forum.image.sc/t/allen-spinal-cord-atlas-is-off-axis/99539/4) for use cases like showing an injection affecting one hemisphere more than the other.
What does this PR do?
Allows users to pass a dict with
"left"and/or"right"keys as a region value to visualise different colors per hemisphere:Fully backwards compatible — scalar values behave exactly as before.
References
Closes #58
How has this PR been tested?
parse_values()function covering all input combinations and error casesshow()tested in both 2D and 3D modesImplementation notes:
cut_with_plane()— bypasses brainrender'shemisphere=param which callsget_plane(), broken on numpy>=2.0REGION__left/REGION__rightso the slicer produces unique segment keys (two actors with the same name would overwrite each other in the projected dict)__are now explicitly rejected as that pattern is reserved for internal hemisphere trackingvmin/vmaxcomputed globally across all values for a consistent colormap scaleIs this a breaking change?
No. Scalar values work identically to before. The only new restriction is that region names containing
__are now rejected — no existing atlas acronym uses this pattern (verified acrossallen_mouse_25um,kim_mouse_25um,allen_human_500um).Does this PR require an update to the documentation?
The
valuesparameter inHeatmap.__init__docstring has been updated to document the new dict syntax. A follow-up documentation PR to brainglobe.info showing a hemisphere-specific example would be useful.Checklist: