-
Notifications
You must be signed in to change notification settings - Fork 24
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
Fix initial min/max values of a histogram of a color layer #5853
Conversation
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.
Great find! Only see my one comment before merging :)
Math.max( | ||
currentLayerConfig.intensityRange[0], | ||
currentLayerConfig.min != null ? currentLayerConfig.min : minimumInHistogramData, | ||
), |
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.
Can you add a comment which explains the intuition here? I think, I kind of got now, but I had think this through for a few minutes and I'm still not 100% sure. My take would be:
intensityRange
is the range for which the histogram is plotted, right? By default, it's defined by the data type (e.g., uint16), but it can be configured per dataset layer.
That range serves as a boundary (i.e., the range cannot be increased by something else), but can still be narrowed down. If nothing else is provided, that down-narrowing is done by the sampled histogram. If the user specified a default min/max value, that is used instead.
Also interesting: intensityRange is more like a "theoretical" range which is not exceeded by the data (e.g., the microscope did only emit values between x and y), whereas min
/max
is more like a recommended cut-off to get a good rendering?
Did I get this right? 😆
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.
intensityRange
is the range for which the histogram is plotted, right?
It is the exact opposite. The min/max is the range of the histogram (slider) while the intensityRange
is the range to which the color values are clamped.
Is my new comment explaining the code good enough? I tried keeping it short.
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.
Ah, makes sense! Yes, should be good to go now :)
frontend/javascripts/oxalis/model/sagas/load_histogram_data_saga.js
Outdated
Show resolved
Hide resolved
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.
Feel free to merge 🚢
Math.max( | ||
currentLayerConfig.intensityRange[0], | ||
currentLayerConfig.min != null ? currentLayerConfig.min : minimumInHistogramData, | ||
), |
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.
Ah, makes sense! Yes, should be good to go now :)
It is possible to configure only the
min
andmax
for a color layer in the view configurations of a dataset. This causes that the backend to send the default values for theintensityRange
for the color layer.IIn case the
min
is higher than the sent intensity minimum or the max is lower than the sent intensity maximum the frontend got into an inconsistent state where theintensityRange
is out of bounds considering themin
andmax
.A short solution to this is to force the intensityRange to be within the range given by
min
andmax
.URL of deployed dev instance (used for testing):
Steps to test:
min
to 100 andmax
to 150.[100,150]
.Issues:
[ ] Updated (unreleased) migration guide if applicable[ ] Updated documentation if applicable[ ] Adapted wk-connect if datastore API changes[ ] Needs datastore update after deployment