Skip to content
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

Histogram range editor #1175

Merged
merged 37 commits into from
Jun 22, 2023
Merged

Histogram range editor #1175

merged 37 commits into from
Jun 22, 2023

Conversation

annehaley
Copy link
Collaborator

@annehaley annehaley commented May 26, 2023

Resolves #1117, resolves #1109, resolves #1122

Histograms include a mode to "exclude distribution tails". When this mode is enabled, the inputs for min and max become percentages from the ends. These automatically chop off 1% from each end (but if a bucket includes more than 1%, it may end up as more - in the below example, the minimum excludes 2%). The user can still change these values.
image

Histograms are drawn with some logic to shorten the height of the max frequency if it eclipses all other values.

From @manthey via Slack:

let v0 be the highest value in the histogram and v1 be the second highest. Make the top of the histogram min(v0, v1 * 1.5), so that the second highest value is 2/3 the total height unless making it so would make the highest value less than the total height.

An example without max frequency shortening:
image

The same histograms drawn with max frequency shortening:
image

@annehaley annehaley marked this pull request as ready for review May 31, 2023 17:55
@annehaley annehaley requested a review from manthey May 31, 2023 17:55
@manthey
Copy link
Member

manthey commented Jun 5, 2023

I see a lot of extraneous parameters in the tile style queries (layerName, custom, defaultMin, etc).

Also, it doesn't seem to switch to the composited image until I fiddle with a setting -- I was expecting the previous behavior where all of the channels are composited without any specified min/max values until some value has been specified. This means that the range we display should probably be based purely on the dtype until we fiddle with values.

I don't seem to be able to type fractional percentages in the scale range (I type 0.2 and immediately it reverts to 0).

@manthey
Copy link
Member

manthey commented Jun 5, 2023

Eventually (in another PR), it'd be nice to be able to specify a default for any channel that has blank min/max values. That is, by default all channels would start with blank min/max values. If the overall defaults are set to 0.2% / 0.2% or 100 / 20000, then any channel with blank values would use those values, but channels with specified values would use those specific values. Clearing the numerical values in a channel would go back to using the default, and clearing the default would mean min / max are unspecified in the style.

The default controls could be much like the individual channel controls, but wouldn't have a histogram (or we have to merge histograms for all channels).

@annehaley annehaley requested a review from manthey June 15, 2023 18:44
@manthey
Copy link
Member

manthey commented Jun 16, 2023

We need to change the color of the grab bars on the histograms -- red and black have no contrast in my vision, which makes the grab bars look like bars on the histogram to me.

The icons for showing the histograms are clunky looking and arranged oddly in my view:
image

@manthey
Copy link
Member

manthey commented Jun 20, 2023

Can we make the default auto-range be 0.2% (not 0.02%) and prevent the user from dragging it past 50%?

@annehaley
Copy link
Collaborator Author

I removed the vue-switches dependency in d5b27c4 and now the tests are passing 👍

overflow-x: auto;
overflow-y: hidden;
overflow: auto;
max-height: 300px;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This makes it surprising to edit the colors, as the color dialog gets hidden near the bottom. Also, if you expand a row such that it causes the scroll bar to appear, then something about the histogram gets cropped and I can't grab the right control handle:
image
The red band was visible before expanding all, and here the right handle isn't grabbable any more.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For the color pickers, I made them relative to the table container in 0799c52. For the scrollbar/canvas resize conflict, my solution was to make the scrollbar always visible: 35601fc

@@ -83,7 +84,7 @@ export default Vue.extend({
this.imageMetadata.bands = Object.values(this.imageMetadata.bands).map(
(b, i) => {
if (!b.interpretation) {
return `Band ${i}`
return `Band ${i + 1}`
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When #1214 is merged, we will always know how many bands an image has. Specifically, if there isn't a bands entry which has the actual interpretation value, we should be using
https://github.com/girder/large_image/blob/master/large_image/tilesource/base.py#L1800-L1803
as the band interpretations if there are <= 4 bands. If there are more than 4 bands, the first three are considered red, green, blue and the are just numbered as we are now doing.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change could be in a separate PR.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should I take out the +1s here?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No. It doesn't have to be in a different PR.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The main difference with #1214 is we now know for all sources how many bands there are and can name them when there are <= 4 bands.

@manthey
Copy link
Member

manthey commented Jun 21, 2023

When I clear the entry in the min or max edit fields, I see a console error: Error: <text> attribute x: Expected length, "NaN".

@manthey
Copy link
Member

manthey commented Jun 21, 2023

When I try to show all the histograms of a many channel image, it is asking for the wrong frame for the histogram. Rather than asking for frames 0,1,2,3,4,... it is asking for 0,1,3,6,10,... My guess is that frame and framedelta are both set.

@annehaley
Copy link
Collaborator Author

When I clear the entry in the min or max edit fields, I see a console error: Error: attribute x: Expected length, "NaN".

Fixed in 4a46617

When I try to show all the histograms of a many channel image, it is asking for the wrong frame for the histogram. Rather than asking for frames 0,1,2,3,4,... it is asking for 0,1,3,6,10,... My guess is that frame and framedelta are both set.

Fixed in 448ef26

@annehaley annehaley requested a review from manthey June 22, 2023 15:30
@manthey
Copy link
Member

manthey commented Jun 22, 2023

When you have scrolled down the list of channels, the color picker is out of view (scrolling up shows it).

@annehaley
Copy link
Collaborator Author

When you have scrolled down the list of channels, the color picker is out of view (scrolling up shows it).

Changed in 3e2fd3a. Rather than having a color picker component for every row in the table with each being relative to the color picker column, we now have one color picker component relative to the table header, which is sticky during scrolling.

@@ -33,7 +34,7 @@ export default Vue.extend({
},
methods: {
updateStyle(style) {
this.style = style
this.style = Object.assign(this.style, style)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What does doing this.style = in front of the Object.assign do?

Copy link
Member

@manthey manthey left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great.

@annehaley annehaley merged commit dcddfaf into master Jun 22, 2023
@annehaley annehaley deleted the histogram-range-editor branch June 22, 2023 19:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants