Add color-grouping + per-region export options to plot_subcortical - #15
Open
anniegbryant wants to merge 5 commits into
Open
Add color-grouping + per-region export options to plot_subcortical#15anniegbryant wants to merge 5 commits into
anniegbryant wants to merge 5 commits into
Conversation
Owner
|
@anniegbryant I made some edits to your PR; feel free to take a look/test and tell me if these edits are good and would be compatible with subcortex_visualization now. I will plan to release the new version somewhere before the end of August, and then this PR would be integrated to it. |
Contributor
Author
|
@teanijarv, your changes look great! I've confirmed everything works smoothly with |
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.
Summary
Adds three new keyword arguments to
plot_subcorticalfor controlling region coloring/export in atlas mode (i.e., no data passed in), plus a naming helper and test coverage. Builds on top of the.round()fix from #14 — no further changes toatlas_builder.py.Motivation
The functionality introduced in this PR is designed to increase user flexibility in region rendering separately for visibility of occluded regions. Additionally, this functionality is designed to integrate with the
subcortex_visualizationpipeline for converting from three-dimensional NIFTI volume to mesh to two-dimensional vector graphic.What has changed
hemisphere_colors(bool, defaultFalse): Bilateral region pairs (e.g., left/right putamen) share one color instead of each getting its own, via a new get_base_name() helper that strips hemisphere naming conventions (l/r, -lh/-rh, l-/r-, left/right/etc).shuffle_colors(bool, defaultFalse): Reproducibly (seed-fixed) shuffles the generated palette across regions to help separate adjacent regions with similar neighboring colors.plot_regions_separately(bool, defaultFalse): Renders one transparent-background PNG per region/view ({region}_{view_face}.png) intoexport_pathas an output directory, for downstream SVG-tracing pipelines. ReturnsNonein this mode.cmapcan now optionally drive atlas-mode region colors too (sampled acrosslinspace(0, 1, n_regions)) when explicitly passed as a colormap name. This is opt-in only; default behavior (generate_distinct_colors) is unchanged.Testing
Unit tests were added for
get_base_name,hemisphere_colors=True, andplot_regions_separately=True. The full suite (51 tests) passes locally viauv run pytest tests/.