Skip to content

Commit 4e2e2eb

Browse files
authored
Harden haralick computation. (#1122)
Should resolve #1116.
1 parent d0a8fd9 commit 4e2e2eb

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

histomicstk/features/compute_haralick_features.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -364,7 +364,7 @@ def compute_haralick_features(im_label, im_intensity, offsets=None,
364364
IMC1 = (HXY - HXY1) / max(HX, HY)
365365

366366
# computes information measures of correlation
367-
IMC2 = np.sqrt(1 - np.exp(-2.0 * (HXY2 - HXY)))
367+
IMC2 = np.sqrt(np.maximum(0, 1 - np.exp(-2.0 * (HXY2 - HXY))))
368368

369369
features_per_offset[r] = [
370370
ASM,

0 commit comments

Comments
 (0)