# HG changeset patch # User imgteam # Date 1771581404 0 # Node ID 99e0ef91ea5e3f98e7e383174b24cdb33b53f82b # Parent b1c2c210813cc218d435482c91e13cb5c9c929b4 planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tree/master/tools/2d_histogram_equalization/ commit 558152251d5d7a1bf77db91aa5388aca7a68ae62 diff -r b1c2c210813c -r 99e0ef91ea5e creators.xml --- a/creators.xml Wed Apr 24 08:11:54 2024 +0000 +++ b/creators.xml Fri Feb 20 09:56:44 2026 +0000 @@ -5,6 +5,16 @@ + + + + + + + + + + @@ -19,5 +29,15 @@ - + + + + + + + + + + + diff -r b1c2c210813c -r 99e0ef91ea5e histogram_equalization.py --- a/histogram_equalization.py Wed Apr 24 08:11:54 2024 +0000 +++ b/histogram_equalization.py Fri Feb 20 09:56:44 2026 +0000 @@ -2,13 +2,21 @@ import sys import giatools.io +import numpy as np import skimage.exposure import skimage.io import skimage.util + +def rescale(img): + assert np.issubdtype(img.dtype, np.floating), str(img.dtype) # sanity check + img = img - img.min() + return img / img.max() if img.max() != 0 else 1 + + hOptions = { - 'default': lambda img_raw: skimage.exposure.equalize_hist(img_raw), - 'clahe': lambda img_raw: skimage.exposure.equalize_adapthist(img_raw) + 'default': lambda img_raw: rescale(skimage.exposure.equalize_hist(img_raw)), # rescale needed for values to be in [0, 1] + 'clahe': lambda img_raw: skimage.exposure.equalize_adapthist(img_raw), # produces image with values in [0, 1] } if __name__ == "__main__": diff -r b1c2c210813c -r 99e0ef91ea5e histogram_equalization.xml --- a/histogram_equalization.xml Wed Apr 24 08:11:54 2024 +0000 +++ b/histogram_equalization.xml Fri Feb 20 09:56:44 2026 +0000 @@ -3,7 +3,7 @@ creators.xml tests.xml - 0.18.1 + 0.25.2 0 @@ -16,11 +16,11 @@ scikit-image scikit-image - + scikit-image - numpy - tifffile - giatools + numpy + tifffile + giatools - + - + + + + + + diff -r b1c2c210813c -r 99e0ef91ea5e test-data/out.tif Binary file test-data/out.tif has changed diff -r b1c2c210813c -r 99e0ef91ea5e test-data/out.tiff Binary file test-data/out.tiff has changed diff -r b1c2c210813c -r 99e0ef91ea5e test-data/out_clahe.tiff Binary file test-data/out_clahe.tiff has changed diff -r b1c2c210813c -r 99e0ef91ea5e test-data/sample.tif Binary file test-data/sample.tif has changed diff -r b1c2c210813c -r 99e0ef91ea5e test-data/sample.tiff Binary file test-data/sample.tiff has changed