-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Generalised existing CLAHE implementation to support n dimensions #2761
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
- only change in main function: handling of default argument - changed: _clahe and interpolate extended to nd - unchanged: functions clip_histogram and map_histogram
Hello @m-albert! Thanks for updating this PR. We checked the lines you've touched for PEP 8 issues, and found:
Comment last updated at 2019-07-30 17:51:40 UTC |
@quakberto very cool! Could you add a test that shows this in 3D? Even just checking input against a reference output is useful (to avoid regressions in the future.) Also, please review your changes to docstrings in terms of whitespace/blank lines, as they violate the NumPy docstring conventions. Thanks! |
…me newlines had disappeared in the previous commit for some reason) - fixed PEP8 problems in newly added code and also already existing code (mainly split up too long lines)
…in Nd: assert that dimensions are conserved from input to output and that the resulting images are similar when constructing a stack of 2d images (using the mean of pixelwise absolute differences)
Hi, sorry for coming back to this only now. I still think it would be great to have CLAHE for 3d and higher in scikit-image :)
As you suggested, I added a simple test consisting of two parts:
Here's a visual comparison (vmin=0, vmax=1 for all images):
Corrected this, somehow some newlines had disappeared in my first commit. Two more notes:
Thanks for any comments and let me know what I can improve :) |
1) Stripes in starting tiles in each dimension. Solution: Work on integer slices 2) Unprocessed pixels after the last tile in case of the image shape not being a multiple of the kernel size. Solution: Pad the image before processing and crop accordingly before returning
After adding the proposed fixes to #2219 one of the CLAHE tests fails:
In principle, the existing 2D tests should see these changes:
How to deal with the existing tests? On another note, one thing that might make sense to add is logic to incorporate the |
Hi @rfezzani, great that you fixed the border artefacts and thanks for pinging me :) Do you think it makes sense to continue working with my extension of the existing 2D CLAHE code into nD or directly adapt @anntzer's code (discussed here #2219) which is very elegant and seems to show less artefacts (as you suggested in #4475)? I'd be happy to work on getting any of the two incorporated into scikit-image. |
@rfezzani That makes sense. Great, would you then recommend rebasing this (rather old) pull request? |
This is up to you ;-) I f you feel more comfortable opening a new PR, just refer to this one and close it. |
We (@VincentStimper,@RealPolitiX) have recently implemented an n-dimensional CLAHE algorithm in tensorflow without constraints for the kernel size using padding. We have demonstrated its use with 4D materials science spectroscopy and bioimaging data. |
Wow! @VincentStimper and @RealPolitiX, the demonstrated examples gh-mclahe are really beautiful 👏 |
Thanks! |
Hey, I'm also interested in using mclahe. Are there any updates on this topic and is there anything I can do to help? |
I've finished the NumPy only implementation of MCLAHE (not using Tensorflow), see the numpy branch in my repository |
Was working on this lately and opened a new pull request #4598 with my changes embedded into the current master. |
Closing this PR in favor of (merged) #4598. Thank you to everyone involved :) |
Description
CLAHE (https://en.wikipedia.org/wiki/Adaptive_histogram_equalization) is well defined for n dimensions and I extended the existing implementation in a straight forward manner.
First (and only) tests I performed:
Checklist
References
For reviewers
later.
__init__.py
.doc/release/release_dev.rst
.