Skip to content

Commit

Permalink
Add fill_value parameter to postprocess function
Browse files Browse the repository at this point in the history
  • Loading branch information
Timozen committed Dec 13, 2023
1 parent 9aa41e8 commit 0b8bc68
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/electromyogram/plot.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()

Expand Down Expand Up @@ -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"
Expand Down

0 comments on commit 0b8bc68

Please sign in to comment.