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

Add docs on advanced contrast limits widget #542

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

melissawm
Copy link
Member

References and relevant issues

Closes #535

Description

Borrows some word from the discussion on #533, and adds a small video to showcase and document the advanced contrast limits widget.

Copy link
Member

@psobolewskiPhD psobolewskiPhD left a comment

Choose a reason for hiding this comment

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

I made some suggestions to elaborate a few of the details a bit more.

docs/howtos/layers/image.md Outdated Show resolved Hide resolved
docs/howtos/layers/image.md Outdated Show resolved Hide resolved
docs/howtos/layers/image.md Outdated Show resolved Hide resolved
docs/howtos/layers/image.md Show resolved Hide resolved

To avoid such issues, you can reset the contrast limits by clicking the
"auto-contrast: once" button, or, if that fails, right-clicking on the contrast
limits to do manual adjustment, including directly editing the numbers shown or
Copy link
Member

Choose a reason for hiding this comment

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

We can leave this, but looking at the code and testing a bit with:

data = np.array([[10, 15], [20 ,25]], dtype=np.uint8)

I think that once and reset do exactly the same thing.
I was expecting once to use the data range, but it uses dtype range.

once and continuous should get tooltips -- i'll add that to an existing issue with contrast limits in napari/napari

Copy link
Member

Choose a reason for hiding this comment

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

Ok , nvm, confusingly, once and reset do the same thing for the case of unit8 but not the others, where once will only reset contrast limits and not their range.

docs/howtos/layers/image.md Outdated Show resolved Hide resolved
@psobolewskiPhD psobolewskiPhD added this to the 0.5.6 milestone Dec 19, 2024
Co-authored-by: Peter Sobolewski <[email protected]>
Copy link
Member

@psobolewskiPhD psobolewskiPhD left a comment

Choose a reason for hiding this comment

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

thanks @melissawm !!

Copy link
Contributor

@TimMonko TimMonko left a comment

Choose a reason for hiding this comment

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

Overall, these are great changes! The animation is super useful and I think the explanation of the advanced contrast limits works great. Two more things I could see being useful to add (could be in a separate PR):

  1. Explanation of once/continuous buttons. Continuous in particular has a lot of use that is not immediately obvious.
  2. Explanation of gamma, since that is the last main way to change the visualization of the cmaps.

Copy link
Contributor

@TimMonko TimMonko Dec 21, 2024

Choose a reason for hiding this comment

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

Fabulous animation. I'm just checking that you intend for it to be slowed down. I think it being slowed down helps the user see the actions being made, but I also wouldn't want people to think napari is laggy. I am in favour of keeping it the way it currently is.

Copy link
Member Author

Choose a reason for hiding this comment

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

Yeah - I made two versions, and remembered that we got feedback the other day about GIFs/animations being too quick for the user to see what was happening. Happy to redo if we think this is too much, though!

the image data that will get mapped to the color defined by 0 in the colormap,
meaning that in most cases any value under the smaller contrast limit will appear as black. On
the other hand, the larger contrast limit corresponds to the value of the image
data that will get mapped to the color defined by 1 in the colormap. For example, for an image using the `gray` colormap, all values larger than this value will appear as white.
Copy link
Contributor

@TimMonko TimMonko Dec 21, 2024

Choose a reason for hiding this comment

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

Suggested change
data that will get mapped to the color defined by 1 in the colormap. For example, for an image using the `gray` colormap, all values larger than this value will appear as white.
data that will get mapped to the color defined by 1 in the colormap; for an image using the `gray` colormap, all values larger than this value will appear as white. Note that the values set in the contrast limits do not change the underlying values of the image, only the visualization of the colormap.

Comment on lines +359 to +360
meaning that in most cases any value under the smaller contrast limit will appear as black. On
the other hand, the larger contrast limit corresponds to the value of the image
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
meaning that in most cases any value under the smaller contrast limit will appear as black. On
the other hand, the larger contrast limit corresponds to the value of the image
meaning that in most cases any value under the lower contrast limit will appear as black. On
the other hand, the upper contrast limit corresponds to the value of the image

Copy link
Contributor

Choose a reason for hiding this comment

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

Is it worth using lower/upper language isntead of smaller/larger (there's a few other places this is relevant)? I suppose it's equivalent language, but I do find that perhaps for arrays with signed values lower/upper is more intuitive when I explain to others (because while -2 is smaller than -0.1, the magnitude is larger)

@@ -395,19 +395,54 @@ Because the contrast limits are defined by two values, the corresponding slider
has two handles: one adjusts the smaller value, and one adjusts the larger
value.

As of right now, adjusting the contrast limits has no effect for `rgb` data.
For RGB images, adjusting the contrast limits adjusts the black point and white point of the image.
Copy link
Contributor

Choose a reason for hiding this comment

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

Should these lines be moved to above the L375 code cell? on the webpage it feels a bit caught out between the image and the admonition

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation priority-high
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add the advanced contrast limits widget to the Image layer tutorial
3 participants