-
Notifications
You must be signed in to change notification settings - Fork 10
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow random cmap creation for map.get_color_map
#641
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #641 +/- ##
==========================================
- Coverage 45.41% 45.34% -0.07%
==========================================
Files 75 75
Lines 7212 7229 +17
==========================================
+ Hits 3275 3278 +3
- Misses 3937 3951 +14 ☔ View full report in Codecov by Sentry. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would not return random colors if a colormap is absent. I think it is sufficient if siibra fails, but with a readable Exception which catches this case. An alternative would be to return a commonly used map, so that at least the result is always the same.
@dickscheid I disagree. When plotting, the user can use a default colormap themselves. This is an instance method which implicitly suggests there is a preconfigured colormap for this specific ParcellationMap. Using a random seed, as the pr does, ensures reproducibility too. And we inform the user it is a non native colormap. Additionally, there are maps that are not fully covered. This PR also ensures a reproducible way to color them instead of setting to them the background. |
I think the flag should be renamed to This indicates the action, fill color map, and the target, areas without a color. This flag also implies that this action is not random, but deterministic. (though it may change from version to version of siibra-python) |
@AhmetNSimsek I agree with you that a default colormap is not needed, but I also think that a random colormap is not useful either. I definitely prefer to raise a well defined exception if we don't have a parcellaion-specific colormap to provide. |
This is already done, please see 400520d. Also, a reproducible random map is better than a standard colormap, IMO, since the odds that neighbor regions have similar colors are very slim. Not the mention, the user has to explicitly set it to True, in order to obtain such a colormap. |
I was not aware that this should actually solve the missing region problem. Agreed then. Regarding optimal contrast of neighboring region colors, it is a complicated optimization problem so let's hope the random solution is sufficient. |
Uses the number of regions to determine the random seed for reproducibility.