-
Notifications
You must be signed in to change notification settings - Fork 262
ENH: Add manual value limits to OrthoSlicer3D/SpatialImages.orthoview #491
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
Conversation
If this seems reasonable, what about adding a |
Codecov Report
@@ Coverage Diff @@
## master #491 +/- ##
=========================================
Coverage ? 94.29%
=========================================
Files ? 177
Lines ? 24369
Branches ? 2616
=========================================
Hits ? 22979
Misses ? 916
Partials ? 474
Continue to review full report at Codecov.
|
Good idea. Can you add some tests? I know this adds some duplication, but it would be good to write out the arguments specifically, to avoid Maybe make these keyword only? |
Looks like keyword-only is Python 3+. Exposed |
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.
Adding a subspace
or slicer
argument sounds reasonable to me. What do you think?
@@ -61,6 +61,9 @@ def __init__(self, data, affine=None, axes=None, title=None): | |||
title : str or None, optional | |||
The title to display. Can be None (default) to display no | |||
title. | |||
vlim : array-like or None, optional |
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.
What do you think of also allowing strings like 10%
90%
as input, meaning percentile? Then the default could be vlim=('1%', '99%')
.
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.
That works for clim
, but ylim
's default is a bit more complicated.
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.
Aha. I see there's a heuristic for the colorbar around line 205 - is that what you mean?
How about throwing that away and just using the data limits as set by vlim
? As in something like:
if vlim is None:
vlim = ('1%', '99%')
etc.
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 believe the purpose of that heuristic is so that the time-series is guaranteed to fit in the pane, with a slight buffer on top and bottom for visibility. If we set ylim(1%, 99%)
, then some values won't fit in the pane, by default.
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.
Won't that be true for any not-default limits that we set? I mean, don't we need to apply the heuristic for any limits?
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'm not sure I fully understand this comment.
The three use-cases I see, myself, are (1) exploration, (2) comparison, (3) figure-generation. I think the existing default behavior is good for (1). I think the proposed changes are good for (2)+(3), where consistency/predictability is more valuable than smart estimates.
The problem I see in your proposed change is that you're changing the default behavior to something a little less friendly by setting ylim == clim
even in the default case.
Apologies if I'm not making much sense.
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.
Sure - I agree that the ylim == clim thing
is bad in the default case, the question is what to do in the not-default case.
For example - I guess that people will want to use vlim
to get better contrast in the images, but they don't intend to change the time-series pane. Do you think that's right? In which case, should ylim
be another input argument, that defaults to the original heuristic, regardless of vlim
?
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.
@effigies - any comments here?
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.
Hey @matthew-brett. Sorry, busy times.
To clarify my usage when I was working on this: I would have multiple files with different ranges. By setting vlim
, I would be able to directly compare them, both the images and the time series. So for my case, I definitely think keeping them the same was preferable.
However, if what we want is a separate ylim
, we can do that. In which case, should we change vlim
to clim
to drive home that one is for images, one is for time series? I chose vlim
initially specifically to abstract from y/c
.
What do you think?
Pushed a couple commits. Will add tests when I get another minute. |
ae0a828
to
df4fefc
Compare
df4fefc
to
0f56724
Compare
0f56724
to
7d2b9b3
Compare
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.
Sorry to be slow to review.
axes : tuple of mpl.Axes or None, optional | ||
3 or 4 axes instances for the 3 slices plus volumes, | ||
or None (default). | ||
vlim : array-like or None, optional |
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.
Copy vlim
docstring entry from OrthoSlicer3D?
@@ -61,6 +61,9 @@ def __init__(self, data, affine=None, axes=None, title=None): | |||
title : str or None, optional | |||
The title to display. Can be None (default) to display no | |||
title. | |||
vlim : array-like or None, optional |
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.
Aha. I see there's a heuristic for the colorbar around line 205 - is that what you mean?
How about throwing that away and just using the data limits as set by vlim
? As in something like:
if vlim is None:
vlim = ('1%', '99%')
etc.
PR to this branch at effigies#1 |
@effigies - any thoughts on my PR? |
I had some when I first saw it, but was in the midst of writing. Will have another look when I get a chance. |
@effigies - any chance of an update here? |
Oh, and one other point about |
Just to clarify, as I return to this:
At the moment, in this PR |
Hi Matthew. Sorry about the delay. Yes, these statements are all correct. |
8a17f08
to
2cd0c2d
Compare
☔ The latest upstream changes (presumably #562) made this pull request unmergeable. Please resolve the merge conflicts. |
2cd0c2d
to
5fec3c6
Compare
4e2b751
to
35bb818
Compare
35bb818
to
30e5464
Compare
689796a
to
80466d4
Compare
4b441d6
to
af8f3ec
Compare
af8f3ec
to
3e68b3e
Compare
☔ The latest upstream changes (presumably #550) made this pull request unmergeable. Please resolve the merge conflicts. |
☔ The latest upstream changes (presumably #695) made this pull request unmergeable. Please resolve the merge conflicts. |
Pass kwargs to OrthoSlicer3D from SpatialImage.orthoview()
TEST: Test vlim functionality
Setting constant value limits for time series and spatial displays can be useful for comparing two images side-by-side.
Edit: Slicing has been removed from this PR in favor of #550.