From 0b8bc68de92088f5428157a526b188b37c1727cb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim=20B=C3=BCchner?= Date: Wed, 13 Dec 2023 11:25:22 +0100 Subject: [PATCH] Add fill_value parameter to postprocess function --- src/electromyogram/plot.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/electromyogram/plot.py b/src/electromyogram/plot.py index d3422c9..549c75d 100644 --- a/src/electromyogram/plot.py +++ b/src/electromyogram/plot.py @@ -300,6 +300,7 @@ def postprocess( triangles_alpha: float = 0.3, invert: bool = False, scheme: Optional[Scheme] = None, + fill_value: int = 255, ) -> np.ndarray: powermap = powermap.copy() @@ -327,7 +328,7 @@ def postprocess( if remove_outer: hull = cv2.convexHull(points, returnPoints=True) mask = cv2.drawContours(np.zeros(powermap.shape[:2]), [hull], 0, 1, -1) - powermap[mask == 0] = 255 if powermap.ndim != 3 else [255, 255, 255] + powermap[mask == 0] = fill_value if powermap.ndim != 3 else [fill_value, fill_value, fill_value] if draw_locations: assert scheme is not None, "scheme must not be None if draw_locations is True"