# HG changeset patch
# User imgteam
# Date 1771581396 0
# Node ID 77455af98d88d494dc0cee30c59ca4cf30b58e83
# Parent d54f14727f7771f8b5f9f1383d80b1c489e034ec
planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tree/master/tools/2d_histogram_equalization/ commit 558152251d5d7a1bf77db91aa5388aca7a68ae62
diff -r d54f14727f77 -r 77455af98d88 creators.xml
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/creators.xml Fri Feb 20 09:56:36 2026 +0000
@@ -0,0 +1,43 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff -r d54f14727f77 -r 77455af98d88 histogram_equalization.py
--- a/histogram_equalization.py Tue Jul 23 14:06:42 2019 -0400
+++ b/histogram_equalization.py Fri Feb 20 09:56:36 2026 +0000
@@ -1,13 +1,22 @@
import argparse
-import os
import sys
+
+import giatools.io
+import numpy as np
+import skimage.exposure
import skimage.io
-import skimage.exposure
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__":
@@ -17,7 +26,7 @@
parser.add_argument('h_type', choices=hOptions.keys(), help='histogram equalization method')
args = parser.parse_args()
- img_in = skimage.io.imread(args.input_file.name)
+ img_in = giatools.io.imread(args.input_file.name)
res = hOptions[args.h_type](img_in)
res = skimage.util.img_as_uint(res)
skimage.io.imsave(args.out_file.name, res, plugin="tifffile")
diff -r d54f14727f77 -r 77455af98d88 histogram_equalization.xml
--- a/histogram_equalization.xml Tue Jul 23 14:06:42 2019 -0400
+++ b/histogram_equalization.xml Fri Feb 20 09:56:36 2026 +0000
@@ -1,19 +1,35 @@
-
- automatic histogram equalization
-
- scikit-image
- numpy
- pillow
- tifffile
-
-
-
-
-
-
-
+
+ with scikit-image
+
+ creators.xml
+ tests.xml
+ 0.25.2
+ 0
+
+
+
+
+
+ operation_3443
+
+
+ scikit-image
+ scikit-image
+
+
+ scikit-image
+ numpy
+ tifffile
+ giatools
+
+
+
+
+
+
+
@@ -23,13 +39,20 @@
-
-
+
+
+
+
+
+
+
- Applies histogram equalization to an image.
+
+ **Applies histogram equalization to an image.**
+
10.1016/j.jbiotec.2017.07.019
diff -r d54f14727f77 -r 77455af98d88 test-data/out.tif
Binary file test-data/out.tif has changed
diff -r d54f14727f77 -r 77455af98d88 test-data/out.tiff
Binary file test-data/out.tiff has changed
diff -r d54f14727f77 -r 77455af98d88 test-data/out_clahe.tiff
Binary file test-data/out_clahe.tiff has changed
diff -r d54f14727f77 -r 77455af98d88 test-data/sample.tif
Binary file test-data/sample.tif has changed
diff -r d54f14727f77 -r 77455af98d88 test-data/sample.tiff
Binary file test-data/sample.tiff has changed
diff -r d54f14727f77 -r 77455af98d88 tests.xml
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/tests.xml Fri Feb 20 09:56:36 2026 +0000
@@ -0,0 +1,95 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+