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

CompareImage: Feature a consistent autoscale #3823

Merged
merged 7 commits into from
Jun 14, 2023

Conversation

vallsv
Copy link
Contributor

@vallsv vallsv commented May 12, 2023

Feature a consistent autoscale for the CompareImage.

Now

  • the autoscale statistics are computer globally for the 2 images
  • it is also computed on the raw image (instead of in the sliced left/right image)
  • This makes the autoscale usable, from the ColormapDialog, including 3stddev
  • subsequently when you are about to slice, the statistics are not recomputed -> that's faster

Changelog:

  • CompareImage: Colormap autoscale is now global to the 2 raw images to compare
  • CompareImage: updateColormap= was dropped, this can be set with getColormap()

@vallsv vallsv force-pushed the image-compare-autoscale branch 2 times, most recently from d7a725e to 77af645 Compare May 19, 2023 07:59
@t20100 t20100 added this to the 2.0.0 milestone Jun 7, 2023
@t20100 t20100 changed the title Draft: CompareImage: Feature a consistent autoscale CompareImage: Feature a consistent autoscale Jun 7, 2023
Copy link
Member

@t20100 t20100 left a comment

Choose a reason for hiding this comment

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

There's a miss-spelling of pinned and probably a missing change regarding colormap2.

Otherwise, it's OK for me. We can live with ColormapWithPinnedData as long as it is not exposed publicly.

src/silx/gui/plot/CompareImages.py Outdated Show resolved Hide resolved
src/silx/gui/plot/CompareImages.py Outdated Show resolved Hide resolved
src/silx/gui/plot/CompareImages.py Outdated Show resolved Hide resolved
src/silx/gui/plot/CompareImages.py Outdated Show resolved Hide resolved
src/silx/gui/plot/CompareImages.py Outdated Show resolved Hide resolved
src/silx/gui/plot/CompareImages.py Outdated Show resolved Hide resolved
src/silx/gui/plot/CompareImages.py Outdated Show resolved Hide resolved
src/silx/gui/plot/CompareImages.py Outdated Show resolved Hide resolved
@vallsv vallsv changed the title CompareImage: Feature a consistent autoscale Draft: CompareImage: Feature a consistent autoscale Jun 12, 2023
@vallsv
Copy link
Contributor Author

vallsv commented Jun 12, 2023

This have to be rebaed on top of #3845

@vallsv
Copy link
Contributor Author

vallsv commented Jun 12, 2023

I have committed an alternative implementation to drop the custom colormap class.

  • The virtual item is used to hold the concatenation of the 2 images
  • When the colormap is changed, an updated colormap is sealed with the range and set to the displayed images

That maybe a bit less efficient than the previous implementation, but this could be improved, and for now who cares.

The good thing is that the displayed histogram is properly computed from the concatenation (previously the histogram was computed from the crop of one of the images)

@vallsv vallsv changed the title Draft: CompareImage: Feature a consistent autoscale CompareImage: Feature a consistent autoscale Jun 12, 2023
@vallsv vallsv requested a review from t20100 June 12, 2023 16:47
@vallsv vallsv force-pushed the image-compare-autoscale branch 2 times, most recently from 6e4e9cd to 5d650bb Compare June 12, 2023 17:04
@t20100
Copy link
Member

t20100 commented Jun 13, 2023

Can you rebase to include commit ccdc13b from main to fix CI on Windows?

Copy link
Member

@t20100 t20100 left a comment

Choose a reason for hiding this comment

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

Great! Colormap range handling is as expected, thanks!

I'd keep backward compatibility for the updateColormap arguments, it's doesn't hurt.

src/silx/gui/plot/CompareImages.py Show resolved Hide resolved
src/silx/gui/plot/CompareImages.py Outdated Show resolved Hide resolved
src/silx/gui/plot/CompareImages.py Show resolved Hide resolved
src/silx/gui/plot/CompareImages.py Outdated Show resolved Hide resolved
src/silx/gui/plot/CompareImages.py Show resolved Hide resolved
src/silx/gui/plot/CompareImages.py Outdated Show resolved Hide resolved
src/silx/gui/plot/CompareImages.py Show resolved Hide resolved
vallsv and others added 2 commits June 13, 2023 17:28
@vallsv
Copy link
Contributor Author

vallsv commented Jun 13, 2023

While i was here, i have used the auto scale to improve the contrast on the composite image comparison.

The result is probably not exactly the same for the B&W composition. @payno would you have some times to check if it's fine for you? Else i anyway have to fix something because the B&W was not working anyway.

The good thing with this change is the colormap is used in a consistent way anyway the visualisation mode.

@vallsv
Copy link
Contributor Author

vallsv commented Jun 13, 2023

@payno thinking about that a bit more, i think it is better to revert my change on the compare image for the B&W composition, it would be better to talk about that together before merging.

@t20100
Copy link
Member

t20100 commented Jun 14, 2023

I'd be +1 to merge this PR as it was and work on additional feature/fix in another PR.

@vallsv
Copy link
Contributor Author

vallsv commented Jun 14, 2023

@t20100 i am fine with it, let's merge it as it is

Copy link
Member

@t20100 t20100 left a comment

Choose a reason for hiding this comment

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

LGTM

@t20100 t20100 merged commit 357a49b into silx-kit:main Jun 14, 2023
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants